Easy Web & API Security +100 XP

Include me

Start the machine, hack the system, and find the hidden flags to complete this challenge and earn XP!

70% solve it 1,935 hackers played 1 flag Updated Oct 03, 2026 First blood GHunter
PHPLFI
Start Your Challenge

Launch your dedicated machine to begin hacking

  1. 1Create a free account, then click "Start Lab"You'll get your own private machine with an IP address
  2. 2Explore the targetOpen the IP in your browser and look for vulnerabilities
  3. 3Find and submit flagsFlags are secret text strings hidden in the system - paste them below to score
  • ~1-2 min setup
  • Private instance
  • 30 min per session. Restart it for free, as often as you like.

Local File Inclusion (LFI) is a web application vulnerability that allows attackers to read files from the server by manipulating file path parameters. It occurs when an application uses user-supplied input to construct file paths without proper validation or sanitization. LFI vulnerabilities are commonly found in PHP applications that dynamically include files based on URL parameters or form inputs.

How Local File Inclusion Works

Web applications often include files dynamically to serve different pages or load configuration data. When developers use functions like include(), require(), or file_get_contents() with user-controllable input, attackers can manipulate the file path to access arbitrary files on the server. A typical LFI attack involves traversing directories using sequences like ../ to escape the intended directory and reach sensitive system files such as /etc/passwd or application configuration files containing credentials.

Why LFI Matters in Web Security

Local File Inclusion vulnerabilities are particularly dangerous because they can serve as a stepping stone to more severe attacks. By reading configuration files, attackers can discover database credentials, API keys, and internal application details. In some cases, LFI can be escalated to Remote Code Execution (RCE) by including log files that contain injected PHP code, or by leveraging PHP wrappers like php://filter to read source code. Understanding LFI is essential for anyone learning web application security, as it remains one of the most frequently discovered vulnerabilities in PHP-based applications.

Common LFI Attack Vectors

Attackers use several techniques to exploit LFI vulnerabilities. Directory traversal sequences allow reading files outside the web root. PHP stream wrappers like php://filter/convert.base64-encode/resource= enable reading PHP source code that would otherwise be executed. Null byte injection (in older PHP versions) can truncate appended file extensions. Defensive measures include input validation, using whitelists for allowed files, disabling dangerous PHP functions, and implementing proper access controls on the filesystem.

What You Will Learn

  • Understand how Local File Inclusion (LFI) vulnerabilities arise in PHP applications
  • Learn directory traversal techniques to read arbitrary files on a server
  • Identify common LFI attack vectors including PHP wrappers and path manipulation
  • Practice exploiting LFI in a controlled lab environment
  • Recognize the signs of LFI vulnerabilities during web application testing

Prerequisites

Basic PHP understanding Web application fundamentals HTTP request basics Linux file system knowledge
Contributors

Credited contributors

These hackers reported issues, improved content, and helped harden this page.