sqlmapproject / sqlmap

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

SQLMAP cannot find the sql injection vulnerability in the juiceshop login page #4428

Closed mendickxiao closed 3 years ago

mendickxiao commented 3 years ago

Describe the bug A clear and concise description of what the bug is. I run the juice shop in my mac book, the version is "12.11", there is a vulnerability in the login page, the field is "email", but the sqlmap cannot find it.

To Reproduce

  1. Run the juice shop in the my local mac.
  2. Use burp to catch the http post request POST /rest/user/login HTTP/1.1 Host: localhost:3000 Content-Length: 49 Accept: application/json, text/plain, / User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 Content-Type: application/json Origin: http://localhost:3000 Sec-Fetch-Site: same-origin Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Referer: http://localhost:3000/ Accept-Encoding: gzip, deflate Accept-Language: zh-CN,zh;q=0.9 Cookie: io=9sCr6Nc12EAyrTFKAAAA; language=en; welcomebanner_status=dismiss; cookieconsent_status=dismiss Connection: close

{"email":"test@juiceshop.sh","password":"123456"}

  1. Save this request as a text file, called sqli-2.txt
  2. Run the sqlmap to scan it. python sqlmap.py -r ../test/sqli-2.txt
  3. SQLmap throws an error. H [']__ _ {1.4.11.8#dev} | -| . [,] | .'| . | || [(]|||_,| | ||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 @ 11:35:04 /2020-11-17/

[11:35:04] [INFO] parsing HTTP request from '../test/sqli-2.txt' JSON data found in POST body. Do you want to process it? [Y/n/q] Y [11:35:06] [INFO] testing connection to the target URL [11:35:06] [CRITICAL] not authorized, try to provide right HTTP authentication type and valid credentials (401) [11:35:06] [WARNING] HTTP error codes detected during run: 401 (Unauthorized) - 1 times

[*] ending @ 11:35:06 /2020-11-17/

  1. Using the post data in the sqlmap. python sqlmap.py -u http://localhost:3000/#/login --data="{\"email\":\"test@juiceshop.sh\",\"password\":\"123456\"}"

  2. There is no injectable parameter found H [.]__ _ {1.4.11.8#dev} | -| . ['] | .'| . | || [,]|||_,| | ||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 @ 11:45:46 /2020-11-17/

JSON data found in POST body. Do you want to process it? [Y/n/q] Y [11:45:48] [INFO] testing connection to the target URL [11:45:48] [INFO] testing if the target URL content is stable [11:45:49] [INFO] target URL content is stable [11:45:49] [INFO] testing if (custom) POST parameter 'JSON email' is dynamic [11:45:49] [WARNING] (custom) POST parameter 'JSON email' does not appear to be dynamic [11:45:49] [WARNING] heuristic (basic) test shows that (custom) POST parameter 'JSON email' might not be injectable [11:45:49] [INFO] testing for SQL injection on (custom) POST parameter 'JSON email' [11:45:49] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' [11:45:49] [INFO] testing 'Boolean-based blind - Parameter replace (original value)' [11:45:49] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)' [11:45:49] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause' [11:45:49] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)' [11:45:49] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)' [11:45:50] [INFO] testing 'MySQL >= 5.0 error-based - Parameter replace (FLOOR)' [11:45:50] [INFO] testing 'Generic inline queries' [11:45:50] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)' [11:45:50] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)' [11:45:50] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)' [11:45:50] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' [11:45:50] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind' [11:45:50] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind (IF)' [11:45:50] [INFO] testing 'Oracle AND time-based blind' it is recommended to perform only basic UNION tests if there is not at least one other (potential) technique found. Do you want to reduce the number of requests? [Y/n] Y [11:45:53] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns' [11:45:54] [WARNING] (custom) POST parameter 'JSON email' does not seem to be injectable [11:45:54] [INFO] testing if (custom) POST parameter 'JSON password' is dynamic [11:45:54] [WARNING] (custom) POST parameter 'JSON password' does not appear to be dynamic [11:45:54] [WARNING] heuristic (basic) test shows that (custom) POST parameter 'JSON password' might not be injectable [11:45:54] [INFO] testing for SQL injection on (custom) POST parameter 'JSON password' [11:45:54] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' [11:45:54] [INFO] testing 'Boolean-based blind - Parameter replace (original value)' [11:45:54] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)' [11:45:54] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause' [11:45:54] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause (IN)' [11:45:54] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)' [11:45:55] [INFO] testing 'MySQL >= 5.0 error-based - Parameter replace (FLOOR)' [11:45:55] [INFO] testing 'Generic inline queries' [11:45:55] [INFO] testing 'PostgreSQL > 8.1 stacked queries (comment)' [11:45:55] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries (comment)' [11:45:55] [INFO] testing 'Oracle stacked queries (DBMS_PIPE.RECEIVE_MESSAGE - comment)' [11:45:55] [INFO] testing 'MySQL >= 5.0.12 AND time-based blind (query SLEEP)' [11:45:55] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind' [11:45:55] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind (IF)' [11:45:55] [INFO] testing 'Oracle AND time-based blind' [11:45:55] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns' [11:45:56] [WARNING] (custom) POST parameter 'JSON password' does not seem to be injectable [11:45:56] [CRITICAL] all tested parameters do not appear to be injectable. Try to increase values for '--level'/'--risk' options if you wish to perform more tests. If you suspect that there is some kind of protection mechanism involved (e.g. WAF) maybe you could try to use option '--tamper' (e.g. '--tamper=space2comment') and/or switch '--random-agent'

[*] ending @ 11:45:56 /2020-11-17/

  1. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Running environment:

Target details:

Additional context Add any other context about the problem here.

stamparm commented 3 years ago

Basics of sqlmap. If you are targeting login pages which require OR payloads, you have to use --risk=3

storenth commented 3 years ago

Basics of sqlmap. If you are targeting login pages which require OR payloads, you have to use --risk=3

Does this mean that --risk=3 and --level=5 executes slower because more tests? I need sqlmap immediately stops and check another line in target file when [WARNING] parameter 'param' does not seem to be injectable arise. Thanks.

stamparm commented 3 years ago

Yes. sqlmap will need to execute more tests.