Skip to content
Path traversal Write-up Beginner

Local File Inclusion in a PHP Reservation System — From Paramet

The application includes a file specified by the 'page' parameter without validation, allowing an authenticated attacker to read arbitrary PHP source files via PHP stream wrappers. This can disclose database credentials and password hashes, and may lead to remote code execution under certain conditions.

Cyber Tamarin Follow

Published on cybertamarin.medium.com

A technical analysis of a critical LFI vulnerability in a publicly available PHP application.

Cyber Tamarin, on cybertamarin.medium.com

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 application directly uses user-controlled input in an include() statement without validation or an allowlist.

Impact

An authenticated attacker can read arbitrary PHP source files, extract database credentials and password hashes, and potentially escalate to remote code execution under certain conditions.

What the attacker needed

Authenticated user with low privileges

The fix

The issue should be fixed by implementing a strict allowlist of permitted pages and avoiding direct use of user input in file inclusion functions.

How it was found

  1. Send a request to the application with the 'page' parameter set to a PHP filter wrapper that base64-encodes the target file.
  2. The server returns the base64-encoded contents of the requested file.
  3. Decode the output to read the full source code of the file.

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 application lets users choose which page to show by putting a filename in the URL. It does not check that the filename is safe, so an attacker can trick it into showing other files on the server, like source code. This can reveal secrets like database passwords.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More by Cyber Tamarin

View all

9 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.