I Hired A Penetration Tester To Attack My Own Side Project It Took Him Under An Hour
A debug endpoint that read files by name without authentication or path sanitisation allowed an attacker to read arbitrary files as the application user. The attacker used this to read a .env file containing production database credentials and live API keys.
Here’s the part I want to be honest about up front, because it’s the whole point: this box was already hardened. Not “I moved SSH off port 22 once” hardened.
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
Likely the debug endpoint lacked authentication and failed to sanitise the user-supplied filename, allowing path traversal.
Impact
The attacker obtained production database credentials and live third-party API keys, and could potentially have used a forwarded SSH agent to reach other systems if the timing had been right.
What the attacker needed
Network access to the server; no authentication required
The fix
The application should be sandboxed with systemd, secrets moved to a root-only file loaded via EnvironmentFile, egress default-denied, agent forwarding disabled, and production error handling forced.
How it was found
- Scan the target with nmap to find open ports.
- Fuzz routes and notice a JSON parse error instead of a 404, indicating a file-reading endpoint.
- Use path traversal to read arbitrary files as the application user.
- Read the systemd unit to find the application's working directory.
- Read the .env file in that directory to obtain production secrets.
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 had a leftover debugging feature that let anyone ask it to read a file by name. Because the name wasn't checked, an attacker could use a trick called path traversal to make it read files outside the intended folder, including a file holding secret passwords and keys.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.