File path traversal/Local File Inclusion

Wordlists

Windows: https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/file_inclusion_windows.txt

Linux: https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/file_inclusion_linux.txt

Awesome Wordlist

File Inclusion Functions

Function

Read Content

Execute

Remote URL

PHP

include()/include_once()

Yes

Yes

Yes

require()/require_once()

Yes

Yes

No

file_get_contents()

Yes

No

Yes

fopen()/file()

Yes

No

No

NodeJS

fs.readFile()

Yes

No

No

fs.sendFile()

Yes

No

No

res.render()

Yes

Yes

No

Java

include

Yes

No

No

import

Yes

Yes

Yes

.NET

@Html.Partial()

Yes

No

No

@Html.RemotePartial()

Yes

No

Yes

Response.WriteFile()

Yes

No

No

include

Yes

Yes

Yes

Cheetsheet

Remote File Inclusion (RFI)

Remote File Inclusion doesn't work anymore on a default configuration since allow_url_include is now disabled since PHP 5.

Wrappers

Automated Scanning

Log Poisoning attack

Server log poisoning

By default, Apache logs are located in /var/log/apache2/ on Linux and in C:\\xampp\\apache\\logs\\ on Windows, while Nginx logs are located in /var/log/nginx/ on Linux and in C:\\nginx\\log\\ on Windows.

Files in:

  • access.log

  • error.log

Payload: http://<SERVER_IP>:<PORT>/index.php?language=/var/log/apache2/access.log

Poisoning the logs

Read the logs through LFI

PHP Session Poisoning

Most PHP web applications utilize PHPSESSID cookie and these details are stored in session files on the back-end, and saved:

  • Linux: /var/lib/php/sessions/sess_<PHPSESSID>

  • Windows: C:\Windows\Temp\sess_<PHPSESSID>

The name of the file that contains our user's data matches the name of our PHPSESSID cookie with the sess_ prefix.

Interesting Files

LFI Interesting Wordpress Files

Last updated