Browser Extension Reverse Engineering
Overview
Browser extensions (Chrome/Edge MV2/MV3, Firefox) run with privileges a web
page does not have: cross-origin requests, webRequest interception, storage
access, and native messaging. That elevated trust makes them a high-value
target for both attackers (malicious extensions, supply-chain poisoning of
popular extensions) and defenders (credential or traffic logic recovery).
This skill covers the full extension analysis workflow: package acquisition,
manifest permission audit, content/background script tracing, dynamic
loading in developer mode, and the data-flow reconstruction that ties it
together. Complex obfuscated inner logic routes into the general JavaScript
workflow (js-reverse); poisoning investigations route into supply-chain
and malware analysis.
Source: cherry-picked and translated from zhaoxuya520/reverse-skill
(skills/browser-extension-reverse, MIT license); reference notes
(extension-analysis.md) inlined.
When to Use
Trigger phrases:
- "analyze this browser extension"
- "is this extension malicious"
- "what does this extension do with my data"
- "unpack a crx and trace its logic"
- "extension supply-chain investigation"
- "recover an extension's signing or proxy logic"
Use this skill when:
- The target is a browser extension (crx/xpi/unpacked directory), not a
plain web page — plain page JS routes to
js-reverse.
- You must assess an extension's permission surface, extract its endpoints,
or determine whether it exfiltrates data.
Prerequisites
- Chrome/Edge (MV2/MV3) or Firefox.
- An archive tool (unzip/7z) or
jq for manifest parsing.
- Chrome DevTools for worker debugging; YARA for malicious-extension rules.
Workflow
Phase 1: Package
- Acquire the package: unpack the CRX/XPI archive, or copy the extension
directory out of the browser profile.
- Read
manifest.json: permissions, host_permissions,
background/service_worker, content_scripts.
- Assess overreach before reading a single script (risk signals table
below).
Phase 2: Logic
- Locate the
service_worker / background entry point and the
content_script injection points and their worlds (isolated vs main).
- Hunt for keys:
chrome.storage, IndexedDB, localStorage, and any
encrypted configuration blobs.
- Observe network and message-passing flows (
runtime.sendMessage /
chrome.runtime.onMessage) exactly as in js-reverse: watch what the
extension sends, when, and to where.
Phase 3: Dynamic
- Load the unpacked directory via developer mode; check
chrome://extensions for errors.
- Attach DevTools to the service worker.
- If the logic resists static reading, use Frida or a CDP-level hook to
instrument the worker at runtime.
Phase 4: Data Flow Reconstruction
- Trace each sensitive input (page DOM data, storage keys, webRequest
bodies) to its sink (network call, native messaging port, storage write).
- Reconstruct the full flow: trigger → handler → transform → exfiltration or
legitimate use.
Manifest Risk Signals
| Field |
Risk signal |
host_permissions <all_urls> |
Can read/write any site |
webRequestBlocking |
Man-in-the-middle style rewriting of traffic |
nativeMessaging |
Escapes the browser to the host machine |
externally_connectable |
Web pages can drive the extension |
MV3 specifics: audit the service_worker lifecycle and
declarativeNetRequest rules — static/dynamic rules are a common covert
traffic-modification surface.
Hands-On Example
Before reading the bundle, unpack a CRX and run Mozilla's linter over it —
npx web-ext lint (verified: resolves web-ext 10.6.0 from npm):
mkdir -p /tmp/ext && unzip -q sample.crx -d /tmp/ext
npx web-ext lint --source-dir /tmp/ext
The lint report surfaces permission misuse, remote-code hazards, and MV3
migration issues that map directly to the Manifest Risk Signals table — a
cheap first pass (Phase 1 — Package) that tells you where to look before the
static scan of the bundle.
Verification
Run this self-check before claiming completion:
When NOT to Use
- Plain web-page JavaScript — route to
js-reverse.
- Server-side logic — protocol analysis is the right tool.
- A full malware-family deep dive — hand the samples to malware analysis.
Anti-Rationalization Table
| Rationalization |
Reality |
| "The manifest looks minimal, so it's safe." |
Minimal permissions can still be abused; content scripts and DNR rules are invisible in the permission list. Read the code. |
| "I'll just read the background script." |
The interesting flow usually lives across content script → messages → worker → network. Trace the whole path. |
| "Dynamic analysis is unnecessary." |
Static reading misses runtime-injected URLs, dynamically constructed endpoints, and obfuscated handlers. Load it in developer mode. |
| "It's from the official store, so it's clean." |
Store review has been bypassed repeatedly; supply-chain attacks land in stores. Treat the package as untrusted input. |
1---2name: browser-extension-reverse3description: 'Use when reverse engineer browser extensions: unpack CRX/XPIs or load4 unpacked directories, audit manifest permissions for overreach, trace content and5 background script data flows, extract API endpoints and storage keys, and detect6 malicious or data-exfiltrating behavior. Use when analyzing extension security posture,7 suspicious extensions, or extension-based attack chains.'8domain: cybersecurity9subdomain: web-application-security10tags:11- browser-extension12- reverse-engineering13- malware-analysis14- manifest15- chrome16- firefox17- supply-chain18version: '1.0'19author: oyi7720license: Apache-2.021nist_csf:22- DE.AE-0223- RS.AN-0324- ID.RA-0125- DE.CM-0126category: cybersecurity27metadata:28 source: https://skillmd.com/skills/oyi77/browser-extension-reverse29---303132# Browser Extension Reverse Engineering3334## Overview3536Browser extensions (Chrome/Edge MV2/MV3, Firefox) run with privileges a web37page does not have: cross-origin requests, webRequest interception, storage38access, and native messaging. That elevated trust makes them a high-value39target for both attackers (malicious extensions, supply-chain poisoning of40popular extensions) and defenders (credential or traffic logic recovery).4142This skill covers the full extension analysis workflow: package acquisition,43manifest permission audit, content/background script tracing, dynamic44loading in developer mode, and the data-flow reconstruction that ties it45together. Complex obfuscated inner logic routes into the general JavaScript46workflow (`js-reverse`); poisoning investigations route into supply-chain47and malware analysis.4849Source: cherry-picked and translated from `zhaoxuya520/reverse-skill`50(`skills/browser-extension-reverse`, MIT license); reference notes51(`extension-analysis.md`) inlined.5253## When to Use5455**Trigger phrases:**56- "analyze this browser extension"57- "is this extension malicious"58- "what does this extension do with my data"59- "unpack a crx and trace its logic"60- "extension supply-chain investigation"61- "recover an extension's signing or proxy logic"6263Use this skill when:6465- The target is a browser extension (crx/xpi/unpacked directory), not a66 plain web page — plain page JS routes to `js-reverse`.67- You must assess an extension's permission surface, extract its endpoints,68 or determine whether it exfiltrates data.6970## Prerequisites7172- Chrome/Edge (MV2/MV3) or Firefox.73- An archive tool (unzip/7z) or `jq` for manifest parsing.74- Chrome DevTools for worker debugging; YARA for malicious-extension rules.7576## Workflow7778### Phase 1: Package7980- Acquire the package: unpack the CRX/XPI archive, or copy the extension81 directory out of the browser profile.82- Read `manifest.json`: `permissions`, `host_permissions`,83 `background`/`service_worker`, `content_scripts`.84- Assess overreach before reading a single script (risk signals table85 below).8687### Phase 2: Logic8889- Locate the `service_worker` / `background` entry point and the90 `content_script` injection points and their worlds (isolated vs main).91- Hunt for keys: `chrome.storage`, IndexedDB, `localStorage`, and any92 encrypted configuration blobs.93- Observe network and message-passing flows (`runtime.sendMessage` /94 `chrome.runtime.onMessage`) exactly as in `js-reverse`: watch what the95 extension sends, when, and to where.9697### Phase 3: Dynamic9899- Load the unpacked directory via developer mode; check100 `chrome://extensions` for errors.101- Attach DevTools to the service worker.102- If the logic resists static reading, use Frida or a CDP-level hook to103 instrument the worker at runtime.104105### Phase 4: Data Flow Reconstruction106107- Trace each sensitive input (page DOM data, storage keys, webRequest108 bodies) to its sink (network call, native messaging port, storage write).109- Reconstruct the full flow: trigger → handler → transform → exfiltration or110 legitimate use.111112## Manifest Risk Signals113114| Field | Risk signal |115|---|---|116| `host_permissions` `<all_urls>` | Can read/write any site |117| `webRequestBlocking` | Man-in-the-middle style rewriting of traffic |118| `nativeMessaging` | Escapes the browser to the host machine |119| `externally_connectable` | Web pages can drive the extension |120121MV3 specifics: audit the `service_worker` lifecycle and122`declarativeNetRequest` rules — static/dynamic rules are a common covert123traffic-modification surface.124125## Hands-On Example126127Before reading the bundle, unpack a CRX and run Mozilla's linter over it —128`npx web-ext lint` (verified: resolves web-ext 10.6.0 from npm):129130```bash131mkdir -p /tmp/ext && unzip -q sample.crx -d /tmp/ext132npx web-ext lint --source-dir /tmp/ext133```134135The lint report surfaces permission misuse, remote-code hazards, and MV3136migration issues that map directly to the Manifest Risk Signals table — a137cheap first pass (Phase 1 — Package) that tells you where to look before the138static scan of the bundle.139140## Verification141142Run this self-check before claiming completion:143144- [ ] The permission surface and entry scripts are listed in the report.145- [ ] The extension's data flow (input → transform → sink) is reconstructed146 with observed evidence for each hop.147- [ ] API endpoints and storage keys used by the extension are extracted.148- [ ] Every risk signal from the manifest table is either confirmed or149 explicitly ruled out with evidence.150- [ ] If a verdict (benign / malicious / suspicious) is given, it cites the151 artifacts that support it.152153## When NOT to Use154155- Plain web-page JavaScript — route to `js-reverse`.156- Server-side logic — protocol analysis is the right tool.157- A full malware-family deep dive — hand the samples to malware analysis.158159## Anti-Rationalization Table160161| Rationalization | Reality |162|---|---|163| "The manifest looks minimal, so it's safe." | Minimal permissions can still be abused; content scripts and DNR rules are invisible in the permission list. Read the code. |164| "I'll just read the background script." | The interesting flow usually lives across content script → messages → worker → network. Trace the whole path. |165| "Dynamic analysis is unnecessary." | Static reading misses runtime-injected URLs, dynamically constructed endpoints, and obfuscated handlers. Load it in developer mode. |166| "It's from the official store, so it's clean." | Store review has been bypassed repeatedly; supply-chain attacks land in stores. Treat the package as untrusted input. |