![]() |
|
Shell Upload via phpMyAdmin 4.5.4? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45) +--- Forum: Whitehat • Blue Team • Defensive Security (https://hackforums.net/forumdisplay.php?fid=448) +---- Forum: Pentesting and Forensics (https://hackforums.net/forumdisplay.php?fid=231) +---- Thread: Shell Upload via phpMyAdmin 4.5.4? (/showthread.php?tid=5608941) |
Shell Upload via phpMyAdmin 4.5.4? - Xphile - Apr 26, 2017 Hey all, I'm currently working through the Orcus CTF from HackFest last year. I've already gained access to the PHPMA panel and have access to the MySQL (5.7.16) database, however I now need a shell so I can gain root on the actual VM. Does anyone have a method of doing this? Here's some more info about the target: Code DB Info:Code Webserver Info:Code Configuration file:As soon as I complete this VM I'll post a walkthrough for other members playing this CTF series. Thanks for any helpful suggestions. 🤝 * - zifor - Apr 26, 2017 Here what i do if got access to phpmyadmin. 1. Search any writable area in server. Sometime database can write to entire folder of web server, in this case you can write your shell in same folder with index.html. But if database can't write, you can search where is "upload" folder, it's writable folder. or any tmp folder in web server. Let's say sql can write to html folder. ex : /var/www/html/site 2. Use SQL command to write shell or any php code you wan't. If it longtext, you can create new table and copy all of your code to the column. 2a. create table 'shellz' that have one or two column. 2b. copy your code to it. it will look like this if you create two column table : shellz PHP Code 3. Use select to write into file. Select 'code' from 'shellz' where id=1 into DumpFile "/var/www/html/site/shellz.php"; Correct me if i wrong, i always use click to create syntaxt in phpmyadmin, so i don't remember what syntaxt look correctly, but this is the logic. So you maybe get error if only copy and paste. 4. Access your php code via browser or curl. Easy.. just litle tricky :) 🤝🤝 * - Xphile - Apr 28, 2017 (Apr 26, 2017 04:37 PM)zifor Wrote: -snip- Thanks for the response. However it seems that this scenario has countermeasures against that. Apparently due to the '--secure-file-priv' option being enabled, I can't write to any files. Instead, I found another route in and I'm currently trying to obtain root privileges. Either way, it's greatly appreciated that you tried to help. Thanks a lot man. 🤝 * - Byte-Array - Apr 28, 2017 Check log files if they are and do log poisoning.... |