Exploits Explained: Persisting Through a Client-Side Prototype Pollution
The application was vulnerable to client-side prototype pollution, allowing an attacker to inject properties into the global object prototype. By finding a gadget that used the polluted property in an innerHTML sink, the attacker could achieve DOM-based cross-site scripting.
Published on synack.com
I recently delved into a fascinating finding on one of Synack’s targets, what ended up being a client-side prototype pollution (CSPP). When I researched more about CSPPs, I found valuable resources scattered across the internet.
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 application used a vulnerable version of Adobe Dynamic Tag Management that merged user-controlled input into objects without proper validation, allowing prototype pollution.
Impact
An attacker could execute arbitrary JavaScript in the context of the victim's browser, potentially leading to data theft or other malicious actions.
What the attacker needed
Victim visits a crafted URL; vulnerable JavaScript library
How it was found
- Enable Prototype Pollution and PostMessage Interception in DOM Invader.
- Visit a URL with a prototype pollution payload in the query string.
- Verify injection by checking Object.__proto__ in the browser console.
- Use DOM Invader's 'Scan for gadgets' to find exploitable properties.
- On the 404 error page, identify the cspNonce gadget reaching element.innerHTML.
- Manually inject an XSS payload via the cspNonce property to execute JavaScript.
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.
Prototype pollution is a JavaScript bug where an attacker can add properties to a base object that all other objects inherit from. This can change how the application behaves. If the polluted property is later used in a dangerous way, such as inserting HTML into the page, it can lead to script execution.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.