Supported Environments
Relevant source files
The following files were used as context for generating this wiki page:PPScan is a client-side prototype pollution scanner implemented as a browser extension. Its environment is defined by the browser it runs in, the permissions it requires, and the specific execution contexts it creates to perform scans. The extension is designed to operate within the Google Chrome browser, leveraging its extension APIs to monitor web traffic, inject scripts, and modify security headers to facilitate vulnerability detection.
The tool supports multiple scanning modes, each creating a distinct testing environment. A "Passive Mode" inspects JavaScript files for known vulnerable patterns, while an "Active Mode" directly attempts to pollute the Object.prototype on visited pages. This architecture allows PPScan to create a specialized and permissive environment for identifying prototype pollution vulnerabilities that might otherwise be missed.
Sources: README.md, manifest.json
Browser & Extension Manifest
The primary supported environment for PPScan is the Google Chrome browser. The extension has been specifically tested on Chrome version 86. Installation is performed by loading the extension in "Developer Mode" within Chrome's extensions page.
Sources: README.md:14-18, 32
Manifest Configuration
The extension's capabilities and structure are defined in manifest.json. It uses Manifest Version 2 and outlines the core components, permissions, and accessible resources that constitute its operational environment.
| Manifest Key | Description | Source File |
|---|---|---|
manifest_version | 2 | manifest.json:3 |
background | Defines a persistent background page (pages/background.html) that loads the main logic. | manifest.json:14-17 |
content_scripts | Injects scripts/content_script.js into all web pages (<all_urls>) and frames. | manifest.json:18-25 |
browser_action | Specifies pages/popup.html as the UI popup. | manifest.json:30-32 |
web_accessible_resources | Makes pages/iframe.html and scripts/exp.js available to web pages, which is essential for the active scanning injection mechanism. | manifest.json:26-29 |
permissions | A list of required browser permissions to function. See the table below for details. | manifest.json:6-13 |
Required Permissions
PPScan requires several powerful permissions to create its scanning environment. These permissions allow it to inspect and modify network traffic, access page content, and manage its own state across all websites.
| Permission | Purpose | Source File |
|---|---|---|
tabs | To get information about the currently active tab for context. | manifest.json:7 |
storage | To save user settings for different modes (Active, Passive, Window). | manifest.json:8 |
<all_urls> | To run content scripts on all websites and intercept network requests from any origin. | manifest.json:9 |
webRequest | To monitor network requests, specifically for completed script downloads in Passive Mode. | manifest.json:10 |
webRequestBlocking | To intercept and modify response headers, primarily for bypassing CSP and X-Frame-Options in Active Mode. | manifest.json:11 |
activeTab | To grant temporary access to the active tab when the user interacts with the extension. | manifest.json:12 |
Sources: manifest.json:6-13
Architectural Components
PPScan's environment is managed by several interconnected components typical of a Chrome extension. These components work together to provide the user interface, background processing, and in-page testing capabilities.
This diagram illustrates the high-level architecture and interaction between the main components of the extension.
Scanning Environments & Modes
PPScan operates in several modes, configured via the extension popup. Each mode establishes a different type of environment for detecting vulnerabilities.
Sources: pages/popup.html:20-33, scripts/popup.js:13-56
Passive Scanning Mode
When Passive Mode is enabled (which it is by default), the extension passively monitors network traffic for JavaScript files. It does not interact with the page DOM directly.
- The background script registers a listener for
chrome.webRequest.onCompletedevents, filtered toscripttypes. - When a script finishes loading, the
scanfunction inutils.jsis triggered. - The script's content is downloaded and matched against a database of known vulnerable patterns (
database.csv). - If a match is found, the finding is recorded, and the browser action badge is updated.
This flow is illustrated in the sequence diagram below.
Active Scanning Mode
When Active Mode is enabled, the extension takes a more intrusive approach by modifying the environment and injecting test payloads.
Header Modification
To ensure its test payloads can execute, the background script registers a webRequest.onHeadersReceived listener that modifies security headers on the fly. This creates a more permissive environment.
- It overwrites the
Content-Security-Policyheader to be'default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;'. - It renames
X-Frame-Optionsand cache-related headers (If-None-Match) to neutralize them.
Sources: scripts/background.js:61-76, scripts/utils.js:134-145
Payload Injection
The active scan injects an iframe into the visited page, which then runs tests to pollute the prototype.
- The
content_script.jschecks if Active Mode is enabled. - It creates a hidden iframe pointing to the web-accessible
pages/iframe.html. - It posts a message to this iframe containing the parent page's URL.
- The
exp.jsscript within the iframe receives the message and proceeds to create more iframes, each with a specific prototype pollution payload in its URL (either in the search query or hash). - The
content_script.jsalso injects a checker script directly into the main page to monitorObject.prototypefor changes and report any successful pollution back to the background script.
This process is visualized below.
Window Mode
Window Mode is a special variant of Active Mode designed to bypass "frame busting" techniques. Instead of injecting an iframe, it opens the test URL in a new window (window.open). This is useful when a target application actively prevents itself from being framed. This mode is controlled by the buster flag in storage.
Sources: README.md:27-29, scripts/exp.js:73-80, scripts/popup.js:35-46
Gadget Brute-Forcing
From the popup, a user can trigger a gadget brute-force attack on the current page.
- Clicking "Search" or "Hash" in the popup executes a script in the active tab.
- This script dispatches a
TriggerBruteorTriggerBruteHashcustom event. - The
content_script.jslistens for this event and initiates the injection process, similar to Active Mode. - However, the message sent to
exp.jshasfoo: 'baz', which instructs it to iterate through theGADGETSlist instead of the standardPAYLOADS, testing for known post-pollution exploitation vectors.
Sources: scripts/popup.js:58-69, scripts/content_script.js:1-22, scripts/exp.js:47-68