Skip to content

Commit e975864

Browse files
authored
Merge pull request #1208 from HackTricks-wiki/update_SQLMap__Testing_SQL_Database_Vulnerabilities_20250729_183209
SQLMap Testing SQL Database Vulnerabilities
2 parents 926ffe0 + 8102d66 commit e975864

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

src/pentesting-web/sql-injection/sqlmap.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@
2323
--proxy=PROXY
2424
```
2525

26+
### Technique flags (`--technique`)
27+
28+
The `--technique` argument defines which SQL injection methods sqlmap will attempt.
29+
Each character in the string represents a technique:
30+
31+
| Letter | Technique | Description |
32+
| ------ | --------- | ----------- |
33+
| B | Boolean-based blind | Uses true/false conditions to infer data |
34+
| E | Error-based | Leverages verbose DBMS error messages to exfiltrate results |
35+
| U | UNION query | Injects `UNION SELECT` statements to fetch data via the same channel |
36+
| S | Stacked queries | Adds additional statements separated by `;` |
37+
| T | Time-based blind | Relies on delays (`SLEEP`, `WAITFOR`) to detect injection |
38+
| Q | Inline / out-of-band | Uses functions such as `LOAD_FILE()` or OOB channels like DNS |
39+
40+
Default order is `BEUSTQ`. You can rearrange or limit them, e.g. only Boolean and Time-based in that order:
41+
42+
```bash
43+
sqlmap -u "http://target/?id=1" --technique="BT" --batch
44+
```
45+
2646
### Retrieve Information
2747

2848
#### Internal
@@ -192,6 +212,9 @@ sqlmap -r r.txt -p id --not-string ridiculous --batch
192212
| versionedmorekeywords.py | Encloses each keyword with versioned MySQL comment |
193213
| xforwardedfor.py | Append a fake HTTP header 'X-Forwarded-For' |
194214

215+
## References
216+
- [SQLMap: Testing SQL Database Vulnerabilities](https://blog.bughunt.com.br/sqlmap-vulnerabilidades-banco-de-dados/)
217+
195218
{{#include ../../banners/hacktricks-training.md}}
196219

197220

src/pentesting-web/sql-injection/sqlmap/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@
2525
--union-char "GsFRts2" #Help sqlmap identify union SQLi techniques with a weird union char
2626
```
2727

28+
### Technique flags (`--technique`)
29+
30+
The `--technique` option lets you restrict or reorder the SQL injection techniques sqlmap will test.
31+
Each letter corresponds to a different class of payloads:
32+
33+
| Letter | Technique | Description |
34+
| ------ | --------- | ----------- |
35+
| B | Boolean-based blind | Uses true/false conditions in the page response to infer results |
36+
| E | Error-based | Leverages verbose DBMS error messages to extract data |
37+
| U | UNION query | Injects `UNION SELECT` statements to fetch data via the same channel |
38+
| S | Stacked queries | Appends extra statements separated by a SQL delimiter (`;`) |
39+
| T | Time-based blind | Relies on `SLEEP/WAITFOR` delays to detect injectable conditions |
40+
| Q | Inline / out-of-band | Utilises functions such as `LOAD_FILE()` or DNS exfiltration to extract data |
41+
42+
The default order that sqlmap will follow is `BEUSTQ` (all techniques).
43+
You can change both the order and the subset. For instance, the following command will **only** attempt UNION query and Time-based blind techniques, trying UNION first:
44+
45+
```bash
46+
sqlmap -u "http://target.tld/page.php?id=1" --technique="UT" --batch
47+
```
48+
2849
### Retrieve Information
2950

3051
#### Internal
@@ -228,6 +249,9 @@ Remember that **you can create your own tamper in python** and it's very simple.
228249
| xforwardedfor.py | Append a fake HTTP header 'X-Forwarded-For' |
229250

230251

252+
## References
253+
- [SQLMap: Testing SQL Database Vulnerabilities](https://blog.bughunt.com.br/sqlmap-vulnerabilidades-banco-de-dados/)
254+
231255
{{#include ../../../banners/hacktricks-training.md}}
232256

233257

0 commit comments

Comments
 (0)