Skip to content
XSS Write-up Advanced

“Day 21: The Ghost API — How I Found a Secret Backdoor in a Fortune 500’s JavaScript”

A hidden administrative API was discovered in a production JavaScript bundle, and a debug override variable allowed bypassing its authentication. Combined with a low-severity DOM XSS in a profile bio, an attacker could impersonate an administrator and achieve full account takeover.

Aman Sharma Follow

Published on amannsharmaa.medium.com

free link

Aman Sharma, on amannsharmaa.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, internal administrative API client code and a debug override mechanism were shipped to production, and a flawed sanitizer allowed DOM XSS.

Impact

An attacker could impersonate an administrator and achieve full account takeover, though the exploit required an admin to view a malicious profile and relied on a low-severity XSS.

What the attacker needed

Admin views attacker's profile; attacker can set profile bio; DOM XSS in profile bio

The fix

The text does not state that the issue was fixed; it recommends removing debug/internal API clients from production builds, enforcing a strong CSP, isolating internal APIs on separate domains, and auditing JavaScript bundles.

How it was found

  1. Inspect the application's JavaScript files using the browser's Sources panel.
  2. Search for keywords like 'internal', 'admin', and 'debug' across all files.
  3. Identify a file named 'vendor~internal-chunk.js' and beautify it.
  4. Find an Axios client configured with an internal admin base URL and an authentication header.
  5. Discover that a debug mode can be enabled via URL parameters and that the token can be overridden by a global variable.
  6. Use a DOM XSS in the profile bio to set the override variable and call the impersonation endpoint when an admin views the profile.

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.

The website's code included a secret backdoor for administrators that was accidentally left in the public files. A small bug in the profile page let an attacker run their own code when an admin viewed it, and that code used the backdoor to log in as the admin.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by Aman Sharma

View all

34 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.