Manifest Breakdown (manifest.json)
Relevant source files
The following files were used as context for generating this wiki page:The manifest.json file is the central configuration file for the PPScan Chrome extension. It uses Manifest Version 2 and serves as the blueprint for the entire extension. It defines the extension's identity, required browser permissions, and the relationships between its core components, including background scripts, content scripts, and the user interface popup. This file dictates how and when different parts of the extension are loaded and executed.
Sources: manifest.json
Core Properties
The manifest begins with fundamental metadata that identifies and describes the extension.
| Key | Value | Description |
|---|---|---|
name | "PPScan" | The name of the extension displayed in the browser. |
version | "1.0" | The version number of the extension. |
manifest_version | 2 | The version of the manifest file format the extension uses. |
description | "Client Side Prototype Pollution Scanner" | A brief description of the extension's purpose. |
Sources: manifest.json:2-5
Extension Architecture Overview
The manifest.json file defines the primary components of the extension and how they interact. The following diagram illustrates the architecture orchestrated by the manifest.
This diagram shows that manifest.json is the central file that registers all other major components of the extension.
Sources: manifest.json
Permissions
The extension requests a set of permissions to perform its scanning and reporting functions. These are crucial for its operation, allowing it to interact with web pages, network requests, and browser storage.
| Permission | Purpose |
|---|---|
tabs | Allows interaction with the browser's tab system. Used by the popup to execute scripts in the current tab for gadget brute-forcing. |
storage | Used to store and retrieve user settings for "Active", "Passive", and "Window" modes. |
<all_urls> | Grants access to run content scripts on all websites and to intercept network requests from any URL for passive scanning. |
webRequest | Allows the extension to observe network traffic. This is fundamental for the passive scanning mode, which inspects completed script requests. |
webRequestBlocking | Enables the extension to modify network requests in-flight. It is used in "Active Mode" to modify Content-Security-Policy and X-Frame-Options headers to facilitate testing. |
activeTab | Grants temporary access to the active tab when the user interacts with the extension's browser action (popup). |
Sources: manifest.json:7-13, scripts/popup.js:51-57, scripts/background.js:32-40, 45-62, scripts/utils.js:115-122
Background Script
The manifest registers a persistent background script, which is essential for long-running tasks and state management.
- Declaration:
pages/background.htmlis registered as the background page. - Persistence:
"persistent": trueensures the script runs continuously in the background. - Implementation:
pages/background.htmlis a simple loader for the main logic scripts:scripts/utils.jsandscripts/background.js.
The background script (background.js) is responsible for:
- State Management: Initializes and manages the state of scanning modes (
toggle,buster,passive) inchrome.storage. - Event Listening: Listens for messages from content scripts (
chrome.runtime.onMessage) when a potential vulnerability is found and updates thefoundset. - Popup Communication: Establishes a connection with the popup (
chrome.extension.onConnect) to send the list of found vulnerabilities and handle log clearing requests. - Network Interception: When active mode is on, it uses
webRequest.onHeadersReceivedto modify security headers like CSP and X-Frame-Options, making pages more amenable to testing. - Passive Scanning: When passive mode is on, it registers a listener on
webRequest.onCompletedto scan scripts for patterns indicating vulnerable libraries.
Sources: manifest.json:14-17, pages/background.html:6-7, scripts/background.js:11-26, 32-40, 45-66
Content Scripts
The manifest configures a content script to be injected into web pages to perform active scanning.
- Declaration:
scripts/content_script.jsis injected into all URLs (<all_urls>). - Framing:
"all_frames": trueensures the script runs in all iframes on a page, not just the top-level document.
The content script (content_script.js) is responsible for:
- Active Probing: If "Active Mode" is enabled, it injects logic to test for prototype pollution by manipulating the URL and checking
Object.prototype. - Brute-Force Triggering: It listens for
TriggerBruteandTriggerBruteHashcustom events dispatched from the popup. Upon receiving an event, it creates a hidden iframe pointing to a web-accessible resource (pages/iframe.html) to start gadget brute-forcing. - Communication: It uses
window.postMessageto send the target URL to the testing iframe andchrome.runtime.sendMessageto report findings back to the background script.
Sources: manifest.json:18-26, scripts/content_script.js:1-22, 31-88
Browser Action
The browser_action key defines the extension's user interface, which is a popup that appears when the extension icon is clicked.
- Declaration:
pages/popup.htmlis set as thedefault_popup. - UI: The popup provides buttons to enable/disable scanning modes, trigger gadget brute-forcing, and clear results. It also contains a table to display found vulnerabilities.
- Logic:
scripts/popup.jshandles all UI interactions. It communicates with the background script to retrieve and display findings and sends commands to the active tab's content script to initiate scans.
The following diagram shows the communication flow when a user clicks the "Brute" button in the popup.
Web Accessible Resources
The manifest declares certain extension files as "web-accessible," meaning they can be loaded by web pages or iframes within them.
- Declaration:
pages/iframe.htmlandscripts/exp.jsare listed as web-accessible resources. - Purpose: This is critical for the active scanning and gadget brute-forcing feature. The content script creates an iframe whose source is
pages/iframe.html. This iframe then loadsscripts/exp.js, which contains the list of prototype pollutionPAYLOADSandGADGETS. Theexp.jsscript listens for messages from the content script and iterates through the gadgets, applying them to the target URL in new, sandboxed iframes.
Sources: manifest.json:27-31, scripts/content_script.js:8, pages/iframe.html:10, scripts/exp.js:45-59
Options Page
The manifest defines an options page for the extension.
- Declaration:
pages/options.htmlis registered as theoptions_page. - Functionality: In its current state,
pages/options.htmlis a placeholder and does not contain any user-configurable settings. It links to a non-existentscripts/options.js.
Sources: manifest.json:6, pages/options.html