Web & network
File inclusion
Local File Inclusion (LFI), Remote File Inclusion (RFI)
A vulnerable application includes a local or remote file chosen by an attacker, potentially exposing data or executing code.
Fiche de sensibilisationPrête à diffuser à vos équipes ou clients
MIGHT YOU BE AFFECTED?
Turn knowledge into action.
How does this work?
When a user-controlled parameter is passed directly to a server-side file inclusion function, path manipulation or remote resources may cause the application to load files outside its intended set.
REAL-WORLD EXAMPLE
« A PHP page accepts a template name from a URL parameter. An attacker causes it to include an application log containing previously injected text. »
Typical sequence
- 1The attacker finds an endpoint that selects a file using user input.
- 2They manipulate the file name or path to select an unintended file.
- 3The application loads the file from the server or a remote location.
- 4Sensitive content may be disclosed or malicious code executed, depending on configuration.
Warning signs
- File paths or URLs are accepted as template or language parameters.
- Include or file-not-found errors expose filesystem locations.
- Unexpected source code, log data or configuration appears in responses.
- A server reads files outside its intended template directory.
How to protect yourself
- Choose files from a strict server-side allowlist rather than arbitrary paths.
- Canonicalise and validate resolved paths against an approved directory.
- Disable remote file inclusion and apply least-privilege filesystem permissions.
- Separate writable uploads and logs from executable or includable code.
If you think you are affected
Disable the vulnerable endpoint, preserve logs and inspect for file disclosure or code execution. Patch the inclusion logic, remove persistence and rotate credentials or secrets that could have been accessed.
Last updated: 8 October 2026