Reputation: 21401
Is there a way to execute commands using directory traversal attacks?
For instance, I access a server's etc/passwd
file like this
http://server.com/..%01/..%01/..%01//etc/passwd
Is there a way to run a command instead? Like...
http://server.com/..%01/..%01/..%01//ls
..... and get an output?
To be clear here, I've found the vuln in our company's server. I'm looking to raise the risk level (or bonus points for me) by proving that it may give an attacker complete access to the system
Upvotes: 3
Views: 19459
Reputation: 21
Chroot on Linux is easily breakable (unlike FreeBSD). Better solution is to switch on SELinux and run Apache in SELinux sandbox:
run_init /etc/init.d/httpd restart
Make sure you have mod_security installed and properly configured.
Upvotes: 2
Reputation: 233
If you already can view etc/passwd then the server must be poorly configured... if you really want to execute commands then you need to know the php script running in the server whether there is any system() command so that you can pass commands through the url.. eg: url?command=ls try to view the .htaccess files....it may do the trick..
Upvotes: 0
Reputation: 34592
Edit#2: I have edited out my comments as they were deemed sarcastic and blunt. Ok now as more information came from gAMBOOKa about this, Apache with Fedora - which you should have put into the question - I would suggest:
Hope this helps, Best regards, Tom.
Upvotes: 0
Reputation: 366
If you are able to view /etc/passwd as a result of the document root or access to Directory not correctly configured on the server, then the presence of this vulnerability does not automatically mean you can execute commands of your choice.
On the other hand if you are able view entries from /etc/passwd as a result of the web application using user input (filename) in calls such as popen, exec, system, shell_exec, or variants without adequate sanitization, then you may be able to execute arbitrary commands.
Upvotes: 2
Reputation: 31903
Yes it is possible (the first question) if the application is really really bad (in terms of security).
http://www.owasp.org/index.php/Top_10_2007-Malicious_File_Execution
Upvotes: 0
Reputation: 60023
Unless the web server is utterly hideously programmed by someone with no idea what they're doing, trying to access ls
using that (assuming it even works) would result in you seeing the contents of the ls
binary, and nothing else.
Which is probably not very useful.
Upvotes: 0