Lab Icon

LFI Log Poison

πŸ”“ Can you turn file reading into complete system control?

Challenge Updated 21 Jun 2026 Solution (Pro)
Local File Inclusion User-Agent Log Poisoning Remote Code Execution Directory Traversal Web Security Apache Security System Administration Log Analysis

🎯 Master Local File Inclusion (LFI) vulnerabilities and advanced log poisoning techniques
πŸ”₯ Learn to chain multiple attack vectors for devastating remote code execution
πŸ“Š LFI vulnerabilities are found in 23% of web applications during security assessments
πŸš€ Develop skills in sophisticated penetration testing and vulnerability chaining

1
Flags
50
XP
53%
Success Rate

Local File Inclusion (LFI) combined with log poisoning is a powerful attack chain that can escalate from information disclosure to remote code execution. LFI vulnerabilities occur when web applications include files from the server's filesystem based on user-controlled input without proper validation. When attackers chain LFI with log poisoning techniques, they can inject malicious code into server log files and then include those logs through the LFI vulnerability to achieve code execution.

Understanding Local File Inclusion

LFI vulnerabilities arise when applications use user input to construct file paths for dynamic includes. A common pattern involves a page parameter like page=dashboard that the application translates to a file path for inclusion. If the application does not properly sanitize this input, attackers can use directory traversal sequences (../) to break out of the intended directory and read arbitrary files on the server, such as /etc/passwd, application configuration files, or server logs.

How Log Poisoning Works

Log poisoning leverages the fact that web servers record request details - including User-Agent headers, URLs, and other client-controlled data - into log files. An attacker sends a request with malicious code (such as PHP code) injected into the User-Agent header. The web server writes this code into its access log file. When the attacker then uses the LFI vulnerability to include the log file, the web server processes the injected code, achieving remote code execution. This technique transforms a read-only file inclusion into full server compromise.

Attack Chain in Practice

A typical LFI-to-RCE attack through log poisoning follows a methodical process: first, the attacker confirms the LFI vulnerability by reading known files. Next, they identify the location of server log files (commonly /var/log/apache2/access.log or /var/log/nginx/access.log). They then inject a code payload through an HTTP header that gets logged. Finally, they include the poisoned log file through the LFI vulnerability to execute their code. This attack chain demonstrates how seemingly minor vulnerabilities can be chained for devastating impact.

Prevention and Detection

Defending against LFI and log poisoning requires multiple layers of security. Applications should use whitelists for file includes rather than relying on blacklists or sanitization. Input validation must prevent directory traversal sequences. Web server configurations should restrict the PHP engine from processing log files. File permissions should limit which files the web application process can read. Security monitoring should alert on unusual file access patterns and suspicious log entries containing code-like patterns.

What You Will Learn

  • How Local File Inclusion vulnerabilities enable arbitrary file reading
  • Using directory traversal to access files outside the web root
  • Injecting malicious code into web server logs through HTTP headers
  • Chaining LFI with log poisoning to achieve remote code execution
  • Defending against LFI attacks through proper input validation and server hardening

Prerequisites

Basic web application security Understanding of web server architecture Familiarity with Linux file system

Ready to hack this lab?

Create a free account and start practicing cybersecurity hands-on.

Start Hacking - It's Free
Start Your Challenge
~1-2 min setup
Dedicated server
Private instance
Standard power
New here? Here's what to do
1
Click "Start Lab" above You'll get your own private machine with an IP address
2
Explore the target Open the IP in your browser and look for vulnerabilities
3
Find and submit flags Flags are secret text strings hidden in the system - paste them below to score

Ready to hack this lab?

Create a free account to start your own dedicated server, submit flags, and earn XP on the leaderboard.

Start Hacking Free
13,000+ Hackers 100+ Labs & Courses Free
Start Hacking Free