Local File Inclusion (LFI) in Leave Application System (PHP & SQL
The application builds an include path directly from a user-supplied page parameter, so an attacker can use a PHP stream wrapper to read the source of internal PHP files. This exposes source code, and the author claims it could reveal database credentials and lead to full compromise.
Published on medium.com
During further security analysis of the Leave Application System in PHP and SQLite3, I identified a Local File Inclusion (LFI) vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The page parameter is passed straight into an include statement with no validation or whitelist, so PHP stream wrappers and other paths are accepted.
Impact
An attacker could read sensitive source files, discover database credentials and study the authentication logic, which the author says could lead to complete compromise of the application.
What the attacker needed
No authentication needed
The fix
The page parameter should be checked against a strict whitelist of allowed page names before any file is included.
How it was found
- Send a request to the page parameter using a PHP filter wrapper that base64-encodes the target file.
- Receive the base64-encoded source of the requested file in the response.
- Decode the base64 output to read the source code.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The page takes a value from the web address and uses it to decide which file to load, without checking it. A visitor can put a special value there that makes the server hand back the contents of its own code files instead of a normal page. Reading code can reveal passwords and how logins work.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.