Bugged by Backup Files: How .zip and .bak Gave Me the Source Code
Backup files (.zip and .bak) were publicly accessible on production subdomains, exposing source code and hardcoded secrets including database credentials, JWT secret, AWS key, and a Google API key. An attacker could download these files and use the secrets to access the production database and Firebase, potentially leading to full cloud takeover.
infosecwriteups.com
Published on infosecwriteups.com
Free Link🎈
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, backup files containing sensitive source code and secrets were stored in a publicly accessible directory on production servers without proper access controls.
Impact
The exposed secrets could lead to RCE, full database dump, and cloud takeover, as the attacker successfully connected to the production database and confirmed full access to Firebase with read/write permissions.
What the attacker needed
Backup files publicly accessible; No authentication required
The fix
Backup files should be removed from public web directories and access to them should be restricted.
How it was found
- Perform subdomain enumeration and collect URLs.
- Filter URLs for backup file extensions such as .zip, .bak, .tar, .tar.gz, .rar.
- Download the discovered backup files.
- Extract the .zip file to reveal source code and .env file.
- Read the .env file to obtain database credentials and other secrets.
- Use the credentials to connect to the production database.
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.
Backup files are copies of a website's code or data that developers sometimes leave on the server. If these files are publicly accessible, anyone can download them and see sensitive information like passwords or API keys. Here, the backup files contained secrets that allowed access to the company's database and cloud services.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.