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 load unpacked directories, audit manifest permissions for overreach, trace content and background script data flows, extract API endpoints and storage keys, and detect malicious or data-exfiltrating behavior. Use when analyzing extension security posture, suspicious extensions, or extension-based attack chains.4license: Apache-2.05---678# Browser Extension Reverse Engineering910## Overview1112Browser extensions (Chrome/Edge MV2/MV3, Firefox) run with privileges a web13page does not have: cross-origin requests, webRequest interception, storage14access, and native messaging. That elevated trust makes them a high-value15target for both attackers (malicious extensions, supply-chain poisoning of16popular extensions) and defenders (credential or traffic logic recovery).1718This skill covers the full extension analysis workflow: package acquisition,19manifest permission audit, content/background script tracing, dynamic20loading in developer mode, and the data-flow reconstruction that ties it21together. Complex obfuscated inner logic routes into the general JavaScript22workflow (`js-reverse`); poisoning investigations route into supply-chain23and malware analysis.2425Source: cherry-picked and translated from `zhaoxuya520/reverse-skill`26(`skills/browser-extension-reverse`, MIT license); reference notes27(`extension-analysis.md`) inlined.2829## When to Use3031**Trigger phrases:**32- "analyze this browser extension"33- "is this extension malicious"34- "what does this extension do with my data"35- "unpack a crx and trace its logic"36- "extension supply-chain investigation"37- "recover an extension's signing or proxy logic"3839Use this skill when:4041- The target is a browser extension (crx/xpi/unpacked directory), not a42 plain web page — plain page JS routes to `js-reverse`.43- You must assess an extension's permission surface, extract its endpoints,44 or determine whether it exfiltrates data.4546## Prerequisites4748- Chrome/Edge (MV2/MV3) or Firefox.49- An archive tool (unzip/7z) or `jq` for manifest parsing.50- Chrome DevTools for worker debugging; YARA for malicious-extension rules.5152## Workflow5354### Phase 1: Package5556- Acquire the package: unpack the CRX/XPI archive, or copy the extension57 directory out of the browser profile.58- Read `manifest.json`: `permissions`, `host_permissions`,59 `background`/`service_worker`, `content_scripts`.60- Assess overreach before reading a single script (risk signals table61 below).6263### Phase 2: Logic6465- Locate the `service_worker` / `background` entry point and the66 `content_script` injection points and their worlds (isolated vs main).67- Hunt for keys: `chrome.storage`, IndexedDB, `localStorage`, and any68 encrypted configuration blobs.69- Observe network and message-passing flows (`runtime.sendMessage` /70 `chrome.runtime.onMessage`) exactly as in `js-reverse`: watch what the71 extension sends, when, and to where.7273### Phase 3: Dynamic7475- Load the unpacked directory via developer mode; check76 `chrome://extensions` for errors.77- Attach DevTools to the service worker.78- If the logic resists static reading, use Frida or a CDP-level hook to79 instrument the worker at runtime.8081### Phase 4: Data Flow Reconstruction8283- Trace each sensitive input (page DOM data, storage keys, webRequest84 bodies) to its sink (network call, native messaging port, storage write).85- Reconstruct the full flow: trigger → handler → transform → exfiltration or86 legitimate use.8788## Manifest Risk Signals8990| Field | Risk signal |91|---|---|92| `host_permissions` `<all_urls>` | Can read/write any site |93| `webRequestBlocking` | Man-in-the-middle style rewriting of traffic |94| `nativeMessaging` | Escapes the browser to the host machine |95| `externally_connectable` | Web pages can drive the extension |9697MV3 specifics: audit the `service_worker` lifecycle and98`declarativeNetRequest` rules — static/dynamic rules are a common covert99traffic-modification surface.100101## Hands-On Example102103Before reading the bundle, unpack a CRX and run Mozilla's linter over it —104`npx web-ext lint` (verified: resolves web-ext 10.6.0 from npm):105106```bash107mkdir -p /tmp/ext && unzip -q sample.crx -d /tmp/ext108npx web-ext lint --source-dir /tmp/ext109```110111The lint report surfaces permission misuse, remote-code hazards, and MV3112migration issues that map directly to the Manifest Risk Signals table — a113cheap first pass (Phase 1 — Package) that tells you where to look before the114static scan of the bundle.115116## Verification117118Run this self-check before claiming completion:119120- [ ] The permission surface and entry scripts are listed in the report.121- [ ] The extension's data flow (input → transform → sink) is reconstructed122 with observed evidence for each hop.123- [ ] API endpoints and storage keys used by the extension are extracted.124- [ ] Every risk signal from the manifest table is either confirmed or125 explicitly ruled out with evidence.126- [ ] If a verdict (benign / malicious / suspicious) is given, it cites the127 artifacts that support it.128129## When NOT to Use130131- Plain web-page JavaScript — route to `js-reverse`.132- Server-side logic — protocol analysis is the right tool.133- A full malware-family deep dive — hand the samples to malware analysis.134135## Anti-Rationalization Table136137| Rationalization | Reality |138|---|---|139| "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. |140| "I'll just read the background script." | The interesting flow usually lives across content script → messages → worker → network. Trace the whole path. |141| "Dynamic analysis is unnecessary." | Static reading misses runtime-injected URLs, dynamically constructed endpoints, and obfuscated handlers. Load it in developer mode. |142| "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. |