Skip to content
Info disclosure Write-up Beginner

Beyond Inspect Element: How I Looted an Application’s Internal

The application exposed its JavaScript source map files in production, allowing an attacker to download and reconstruct the original source code. This revealed a hardcoded admin password, which the attacker used to authenticate to the admin portal.

Shreejalkc Follow

Published on medium.com

I recently downloaded an entire enterprise web application’s proprietary source code, complete with hidden backend routing, candid developer comments, and internal directory structures. I didn’t deploy a sophisticated zero-day exploit, nor did I bypass their Web Application Firewall.

Shreejalkc, on medium.com

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 the build process generated source map files and deployed them to the production server without removing or restricting access to them.

Impact

The attacker could reconstruct the full source code and obtain a hardcoded admin password, leading to unauthorised access to the admin portal.

What the attacker needed

Source map files deployed to production; no authentication required to access .map files

The fix

Source maps should not be generated for production, or if needed for error tracking, they should be uploaded securely and then deleted before deployment, and the web server should be configured to block requests for .map files.

How it was found

  1. Enumerate JavaScript assets loaded by the application using curl and grep.
  2. Inspect the minified JavaScript for the sourceMappingURL directive.
  3. Append .map to the JavaScript file URL and request it directly.
  4. Download the exposed source map file.
  5. Use a tool like shuji to reconstruct the original source code from the map file.
  6. Search the extracted source for sensitive strings such as 'Admin' to find hardcoded credentials.

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.

When developers build a website, they often shrink the code to make it load faster, a process called minification. Sometimes they also create a map file that helps translate the shrunk code back to the original, readable code. If that map file is left on the public server, anyone can download it and see the original source, including secrets like passwords.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.