I Found a Stored XSS in an API Explorer — Here’s Exactly How
A stored cross-site scripting flaw existed in an API explorer's navigation tree, where repository names were saved without sanitisation and rendered as raw HTML. An attacker could inject script that executes for any user, including administrators, who loads the tree.
Published on medium.com
Every bug hunter knows the feeling. You’ve been staring at the main application for hours.
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
User-supplied repository names were stored without sanitisation and then inserted directly into the page as raw HTML instead of being escaped.
Impact
Any user, including administrators, who loads the navigation tree triggers the stored script, which could lead to session hijacking, credential theft, or unauthorised API actions.
What the attacker needed
Access to the WsgExplorer interface; ability to create a repository entry
The fix
The application should sanitise or reject HTML tags on input and encode output before rendering, for example by using textContent instead of innerHTML.
How it was found
- Open the WsgExplorer interface and go to the navigation tree's Repositories section.
- Create a new repository whose name contains HTML markup.
- Save the repository and refresh the navigation tree.
- Observe that the markup is rendered and script executes.
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.
Cross-site scripting (XSS) is when a website lets someone sneak in code that runs in other people's browsers. Here, a name typed into an API testing tool was saved and shown back without cleaning it, so a malicious name could run code for anyone who viewed the page. Because the bad name stays saved, every visitor triggers it automatically.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.