Information Disclosure
A backup Java source file was left publicly accessible and listed in robots.txt, and it contained a hard-coded PostgreSQL password. An attacker could read the file and use the exposed credentials to reach the database.
medium.com
Published on medium.com
As we have to access the hidden files so we added robots.txt to the URL. robots.txt is a text file that websites use to communicate with web crawlers and search engines. It plays a very vital role in telling about hidden directories.
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 a source file was left in a web-accessible directory and the database password was hard-coded in the source.
Impact
Anyone who could reach the backup file could read the database credentials and potentially access the stored data.
What the attacker needed
None
The fix
Backup files should be removed or secured in production and credentials should never be hard-coded in source code.
How it was found
- Open the lab and add robots.txt to the URL to find hidden directories.
- Notice a backup directory containing a backup Java source file.
- Open the backup file and read the Java code inside it.
- Send the file request through the proxy to the Repeater and inspect the response.
- Find the code showing how the PostgreSQL connection is established, including the password.
- Submit the hard-coded PostgreSQL password to complete the lab.
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.
Websites sometimes keep old copies of their code, called backup files, on the server. If those files are reachable by anyone, a visitor can read the source code and find secrets inside it, such as a database password. Here the site even pointed to the backup folder in a file meant to guide search engines.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.