Information Disclosure part-3 : Source code disclosure via backu
A backup file left in a hidden directory exposed the application's source code, including a hard-coded database password. An attacker who found the file could read the password and other secrets.
Published on medium.com
As someone who is active in the world of penetration testing and often conducts assessments of various web applications, I realize that information disclosure is not only limited to configuration errors or error messages that are too verbose. There is another form that often goes unnoticed by developers — source 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 backup copy of the application source was left in a publicly reachable directory and the server did not block access to it.
Impact
An attacker could read the full source code and hard-coded secrets such as the database password, which may enable further attacks.
What the attacker needed
None
The fix
Backup files should be removed from public directories before deployment and the server should be configured to block access to backup extensions.
How it was found
- Enumerate directories on the target site with a content discovery tool.
- Find a directory named backup.
- Open the backup directory and see a file listed.
- Access the file, which contains the application source code with hard-coded credentials.
- Copy the database password from the source and submit it.
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 backup file is a copy of a website's code that developers keep in case something goes wrong. If that copy is left where anyone can download it, people can read the website's private instructions and any passwords written inside. Here, a backup file in a hidden folder let anyone read the database password.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.