The Website Didn’t Need to Be Hacked. It Exposed Itself. Twice.
Two PortSwigger labs are described: a debug page reachable without authentication exposed PHP configuration and a secret key, and a publicly accessible backup file in a backup directory revealed full source code with hard-coded credentials and database details. An attacker could read these secrets and internal configuration.
medium.com
Published on medium.com
But this week, I solved two labs that flipped that belief completely. Some websites don’t need to be hacked.
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 leftover development and debug artefacts (a commented-out link to a debug endpoint and backup files) were deployed to production without access controls or removal.
Impact
Anyone could read the debug page and backup file, exposing a secret key, hard-coded credentials and database connection details.
What the attacker needed
None
The fix
Debug endpoints and backup files should be removed from production and access to them should be restricted.
How it was found
- View the page source of the shopping site.
- Find a commented-out link at the bottom of the HTML.
- Open that path in the browser to reach the debug page.
- Read the PHP configuration and find the secret key.
- Test common backup file patterns in the URL.
- Open the backup file in the backup directory to read the source code.
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 website can accidentally leave files or pages that were meant to be private on the public internet. Here, a hidden debug page and an old backup file were both reachable by anyone, and they contained passwords and server details. This is called information disclosure: the site gives away information instead of being broken into.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.