Hack Smarter Polution Prototype Pollution To Xss
A client-side prototype pollution vulnerability in a web application's URL fragment handling allowed an attacker to inject properties into Object.prototype, which was then used by an existing gadget to execute arbitrary JavaScript. By delivering a crafted link to an administrator, the attacker could steal the admin's session cookie and access an admin-only page.
Published on systemweakness.com
You are a member of the Hack Smarter Red Team, and your organization is beginning to roll out a managed SOC service. You’ve been provided access to a staging version of the web app before it’s pushed to production.
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
Impact
An attacker could execute arbitrary JavaScript in an administrator's browser and steal their session cookie, gaining access to admin-only functionality.
What the attacker needed
Victim clicks a crafted link; victim is an administrator
How it was found
- Scan the target and find the web application on port 3000 running Express.
- Inspect the application's inline scripts and identify the executeSearch and syncState functions.
- Craft a URL fragment that sets __proto__.polluted to true and verify in the console that a new object inherits the property.
- Identify the gadget: executeSearch checks for options.renderCallback and passes it to createContextualFragment.
- Craft a URL fragment that sets __proto__.renderCallback to an XSS payload and confirm the script executes.
- Send the crafted URL to the admin and capture the admin's session cookie via an out-of-band request.
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.
This report describes a bug where a website's JavaScript code took part of the URL (the bit after the #) and used it to add properties to a shared object that all other objects inherit from. Because of a coding mistake, an attacker could add a property that the site later used to insert HTML into the page, letting them run their own JavaScript in the victim's browser. When an admin clicked the crafted link, the attacker's script ran and stole the admin's login cookie.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.