How a Fake Image and an Expired Token Made a Server Confess Every
A profile image upload endpoint returned a verbose debug error page when an expired token and invalid image were sent together, exposing a stack trace. The trace contained an admin API secret key, a session token, internal file paths and the application architecture.
Published on medium.com
During a recent assessment of a mobile application’s backend API, I triggered a verbose error response from a profile image upload endpoint that disclosed far more than it should have. The finding required no exploit chain, no injection, no tooling beyond Burp Suite and patience.
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 a missing try/catch around the outbound Guzzle call in the session validation method, combined with the framework's debug error handler being left enabled in production.
Impact
The exposed admin API secret key could let an attacker call privileged server endpoints for user data, account changes and administrative actions, giving full administrative access to the backend.
What the attacker needed
An authenticated account; a session token that can expire; ability to send crafted multipart requests
The fix
The code should catch the Guzzle exception and return a clean 401, and debug mode should be disabled in production.
How it was found
- Send an authenticated avatar upload request with a valid token and a fake image to confirm clean validation.
- Let the session token expire and resend with a valid image to confirm a clean rejection.
- Send one request containing both the expired token and the fake image data.
- Observe the 500 response and read the debug exception page for secrets and paths.
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.
When a web server hits an unexpected problem, it can either show a tidy error message or, if debugging is left on, dump technical details. Here the server was left in that detailed mode, so a request that failed in two ways at once made it print out its internal workings, including a powerful password used between servers.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.