Local File Inclusion (also known as LFI) is the process of including files, that are already locally present on the server, through the exploiting of vulnerable inclusion procedures implemented in the application. This vulnerability occurs, for example, when a page receives, as input, the path to the file that has to be included and this input is not properly sanitized, allowing directory traversal characters (such as dot-dot-slash) to be injected. Although most examples point to vulnerable PHP scripts, we should keep in mind that it is also common in other technologies such as JSP, ASP and others.
Code execution on the web server
Denial of Service (DoS)
Sensitive Information Disclosure
FTP cli interface
How to find:
Locate phpinfo page?
Google dork example:
Interesting files to include:
/etc/passwd /etc/shadow /etc/issue /etc/group /etc/hostname /etc/ssh/ssh_config /etc/ssh/sshd_config /root/.ssh/id_rsa /root/.ssh/authorized_keys /home/user/.ssh/authorized_keys /home/user/.ssh/id_rsa
– %SYSTEMROOT%\repair\system – %SYSTEMROOT%\repair\SAM – %WINDIR%\win.ini – %SYSTEMDRIVE%\boot.ini – %WINDIR%\Panther\sysprep.inf – %WINDIR%\system32\config\AppEvent.Evt
More LFI paths to test:
Automating the audit:
\ at the start of the folder name to try and reach the root directory.
%5c (percent encoded versions of the above).
Try using 16-bit Unicode encoding (
Try double URL encoding (
Try overlong UTF-8 Unicode encoding (
. can be
/ can be
\ can be