Skip to content
Path traversal Write-up Beginner

Path Traversal Attack: How I Accessed Admin Secrets

A download endpoint accepted a user-supplied filename and allowed directory traversal, so an attacker could read files outside the intended folder. The author used this to retrieve configuration files containing database credentials, JWT signing keys and admin credentials, and logged into the admin panel.

infosecwriteups.com

Published on infosecwriteups.com

Web apps are supposed to protect their files, right? But what if I told you that just a small trick could let you sneak in and peek at hidden admin files, secrets, and sensitive stuff? ๐Ÿ˜ˆ

Vipul Sonule, on infosecwriteups.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 download endpoint passed user-controlled input directly into a file path without validating or restricting it to an allowed directory.

What the attacker needed

A download endpoint that takes a filename; no authentication needed to reach it

The fix

The application should restrict downloads to an allow-list of filenames, sanitise the path with a function such as basename, avoid building file paths from user input, and run the web server with minimal filesystem permissions.

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.

A web app sometimes lets you ask for a file by name, like a download link. If it does not check that name carefully, you can use special characters to climb out of the intended folder and read other files on the server. Here the author reached configuration files that held passwords and keys, then used them to log in as an administrator.

What is Path traversal?

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

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.