The Comment That Handed Me a Secret Key
A developer comment in the page source pointed to a live phpinfo page, which exposed a SECRET_KEY used to sign sessions. An attacker could use that key to forge a session for any account, including admin.
Lab 2 of my Information Disclosure series. One hidden note in the code.
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 developer comment pointing to a debug page that was left enabled in production, which exposed a secret key.
Impact
An attacker could use the exposed secret key to forge a session for any account, including the admin, leading to full account takeover.
What the attacker needed
None
The fix
Debug and phpinfo pages should never be left on a live site, developer comments should be stripped before shipping, and any exposed secret key should be rotated.
How it was found
- Open the lab page and view its source code.
- Read the source and find a comment pointing to a file path.
- Add that path to the website address and load the page.
- Search the page for the secret key and copy its value.
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 comment in a web page's source code is like a sticky note that visitors can read but that doesn't appear on the page. Here, a developer left a note pointing to a debug page that was still live, and that page showed a secret key. With that key, someone could pretend to be any user, including an administrator.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.