Remote File Inclusion Exploitation
Remote File Inclusion executes PHP code fetched from an attacker-controlled URL. It requires allow_url_include = On in the PHP configuration, which is disabled by default on modern installs. When it's enabled, it's a direct path to code execution without needing to write anything to disk on the target. Confirm RFI is active before proceeding — a false positive wastes time and generates noise.
Confirm RFI is Active
Host a test file on your Kali machine and point the vulnerable parameter at it. An incoming request on your HTTP server confirms the target is fetching remote URLs:
RFICONFIRM
RFICONFIRM in the response means the server fetched your file and included its content. If there is no output but your HTTP server received a request, the content is being included but not displayed — still confirmed, just blind.
Deploy a Web Shell
Host a minimal PHP web shell and include it via the vulnerable parameter:
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Get a Reverse Shell
Set up your listener and host a reverse shell payload:
If bash is not available, use the mkfifo method or a Python reverse shell via the cmd parameter on the hosted shell. Run the HTTP server on a different port from the netcat listener.
Filter Bypasses
Some applications filter http:// but miss other protocols or encoding variants:
References
-
PayloadsAllTheThings — File Inclusiongithub.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion (opens in new tab)
RFI payload collection and filter bypass techniques
Was this helpful?
Your feedback helps improve this page.