Installation
Relevant source files
The following files were used as context for generating this wiki page:PPScan is a client-side prototype pollution scanner packaged as a browser extension. It is designed to be loaded directly into Chrome in developer mode. The installation process involves cloning the source code repository and loading it as an unpacked extension. The extension has been tested on Chrome version 86.
Upon installation, the extension sets up background listeners and injects content scripts into web pages to detect potential prototype pollution vulnerabilities. It functions by checking for vulnerable location parsers and provides different modes of operation, including an "Active Mode," a "Passive Mode," and a "Window Mode" for applications using frame busting.
Sources: README.md:1-22, manifest.json:2-5
Installation Steps
The extension is installed by loading the cloned repository folder directly into the browser.
Sources: README.md:11-18
Prerequisites
- Google Chrome (tested on version 86)
- Git, for cloning the repository
Sources: README.md:22
Procedure
- Clone the repository to your local machine: `git clone https://github.com/msrkp/PPScan.git%60
- Open Chrome and navigate to the extensions page:
chrome://extensions - Enable "Developer Mode" using the toggle switch.
- Click the "Load unpacked" button.
- Select the root directory of the cloned
PPScanrepository.
The extension icon will appear in the browser toolbar, and it will be active.
Sources: README.md:12-18
Extension Architecture and Components
The extension's structure is defined in manifest.json, which orchestrates the various scripts and pages. The core logic is split between a persistent background script, content scripts injected into web pages, and a browser action popup for user interaction.
Sources: manifest.json
Manifest Configuration
The manifest.json file specifies the core properties and components of the extension.
| Property | Value/Description |
|---|---|
name | PPScan |
version | 1.0 |
manifest_version | 2 |
description | Client Side Prototype Pollution Scanner |
options_page | pages/options.html |
background | Defines pages/background.html as the persistent background page. |
content_scripts | Injects scripts/content_script.js into all frames on all URLs (<all_urls>). |
web_accessible_resources | Makes pages/iframe.html and scripts/exp.js accessible from web page contexts. |
browser_action | Sets pages/popup.html as the default popup for the extension's toolbar icon. |
Sources: manifest.json:2-31
Component Relationships
The following diagram illustrates how the components defined in the manifest are interconnected.
This diagram shows how manifest.json links HTML pages to their corresponding scripts and defines entry points like the background page and content scripts.
Sources: manifest.json, pages/background.html:6-7, pages/popup.html:86, pages/iframe.html:9
Permissions
The extension requires several permissions to function:
| Permission | Purpose |
|---|---|
tabs | To interact with browser tabs, likely for executing scripts. |
storage | To save and retrieve user settings (toggle, buster, passive modes). |
<all_urls> | To run content scripts and intercept network requests on all websites. |
webRequest | To monitor network requests for passive scanning. |
webRequestBlocking | To modify headers (e.g., CSP, X-Frame-Options) in Active Mode. |
activeTab | To interact with the currently active tab. |
Sources: manifest.json:8-15, scripts/background.js:50-70, scripts/popup.js:4-10
First-Time Initialization
When the extension is first installed or updated, the chrome.runtime.onInstalled event listener in the background script is triggered. This process sets the default state for the different scanning modes.
The initialization flow is as follows:
This diagram shows the sequence of storage operations that configure the default state of the extension upon installation.
Sources: scripts/background.js:38-47
Default Settings
The following settings are stored in chrome.storage.sync upon installation:
| Key | Default Value | Description |
|---|---|---|
toggle | false | Disables "Active Mode" by default. |
buster | false | Disables "Window Mode" by default. |
passive | true | Enables "Passive Mode" by default, which scans scripts for patterns. |
These settings can be changed by the user via the extension's popup interface.