File inclusion vulnerability is a type of vulnerability most often found on websites. It allows an attacker to include a file, usually through a script on the web server.
The vulnerability occurs due to the use of user-supplied input without
proper validation. This can lead to something as minimal as outputting
the contents of the file or more serious events such as:
- Code execution on the web server
- Code execution on the client-side such as JavaScript which can lead to other attacks such as cross site scripting (XSS)
- Denial of service (DoS)
- Data theft/manipulation
<?php
include
(
"inc/"
.
$_GET
[
'file'
]); ?>
- Including files in the same directory:
?file=.htaccess - Path Traversal:
?file=../../../../../../../../../var/lib/locate.db
(this file is very interesting because it lets you search the filesystem, other files) - Including injected PHP code:
?file=../../../../../../../../../var/log/apache/error.log- Tricks:
- list of possible Apache dirs
- include access log from file descriptor /proc/self/fd/XX
- include email log files
- include ssh auth.log
- abuse avatar/image/attachment file uploads
- include session files
- include PHP’s temporarily uploaded files
- If you additionally have a phpinfo() output, read here.
No comments:
Post a Comment