Local or Remote File Inclusion or Read

Local or Remote File Inclusion or Read

Knowledge Base>Local or Remote File Inclusion or Read

Summary

LFI/RFI allows an attacker to include local or remote files into a web application, leading to potential information disclosure, code execution, or server compromise.

Testing methodology

Common Parameters CheckRetrieve a Known FilePaths in Stack Trace ErrorsCheck for Directory ListingUse Traversal PayloadsIdentify Tech StackIdentify Tech Stack~/.aws/credentialsPHP Wrappers (phar://, expect://, etc.)access_log InjectionFile Upload FunctionalityWrite PHP WebshellCheck for External URLsLoad PHP Webshellweb.config - Machine Key.NET DeserializationSource Code ReviewSource Code RCEDefault Config Files~/.ssh/id_rsaSSH to RCE
Potential Entry Points
File Path Functionality
Confirmed File Read
Directory Traversal
Stack Trace Errors
PHP
.NET
AWS
Local File Inclusion
Remote File Inclusion
RCE
Sensitive File Read

Description

Local File Inclusion (LFI) and Remote File Inclusion (RFI) are vulnerabilities that occur when a web application allows user-controlled input to specify a file to be included or executed. Attackers can exploit this vulnerability to disclose sensitive information, execute arbitrary code, or compromise the server.

Remediations

  • Use an Allow-List of allowed directories application users may read files from.
  • If possible, disable file inclusion features for the application users.

By using this site you agree to our Terms of Service and Privacy Policy.