How a Simple 401 Error Revealed the Keys to the Kingdom
An endpoint returned a 401 Unauthorized response whose body contained sensitive internal configuration data, including plaintext credentials, API keys, tokens, camera IPs, root access credentials and internal server paths. An attacker could use this exposed data to take over accounts, compromise the server and leak data.
medium.com
Published on medium.com
After doing recon on my target website I found and endpoint that looked pretty normal…I wasn’t doing anything fancy that day just exploring a flashcard-style website that required login access. As soon as I landed on the page, a small login prompt popped up:
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 custom error handler printed internal environment variables or debug information in the 401 response, and the developer forgot to remove it before going live.
Impact
The exposed data could lead to account takeovers, full server compromise and data leaks.
What the attacker needed
Access to the website; no valid credentials needed
The fix
Error messages should be sanitised so that 401, 403 or 500 responses only tell the user what they need to know, and debug data should be kept in logs, not responses.
How it was found
- Visit the flashcard-style website that requires login.
- Intercept the request with Burp Suite.
- Observe the 401 Unauthorized response.
- Scroll down the response body to see the exposed sensitive data.
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 website says you are not allowed to see something, it should only send back a short error message. Here, the server accidentally included private information like passwords and secret keys in that error message. Anyone who visited the page could read those secrets and use them to break into the system.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.