Chrome DevTools Protocol instrumentation toolkit for authorized WebCrypto observation, network analysis, and browser security research.
WebCrypto Interceptor combines native Chrome DevTools Protocol (CDP) debugging capabilities with scope-agnostic in-page hooks to inspect browser cryptographic operations, network traffic, worker communications, WebAssembly binaries, and embedded secrets in real time.
Overview β’ Documentation Site β’ Features β’ Requirements β’ Installation β’ Quick Start β’ Usage β’ Offline Analysis β’ Architecture β’ Testing β’ Responsible Use
Web applications frequently rely on the W3C Web Cryptography API (window.crypto.subtle) to encrypt media streams, sign authentication tokens, and obscure client-server communication. Analyzing these routines using traditional proxy tools is often insufficient because payloads are encrypted before transmission and decrypted after receipt.
webcrypto-interceptor attaches directly to the Chromium browser engine via the Chrome DevTools Protocol. It operates over standard input/output pipes (pipe: true) rather than exposed WebSocket ports, avoiding open network listeners on the host.
The toolkit uses non-intrusive V8 debugger breakpoints (Debugger.setBreakpointOnFunctionCall) alongside page hooks communicating through a dedicated CDP binding channel (Runtime.addBinding). This architecture observes inputs, outputs, and call stacks across browser tabs, iframes, and Web Workers without modifying native function source strings.
This tool is designed specifically for authorized security research, protocol debugging, interoperability testing, and reverse engineering of software you own or have explicit permission to audit.
- Project Overview
- Features
- Requirements and Compatibility
- Installation
- Quick Start
- CLI Options and Usage
- Output Files and Workflows
- Architecture
- Offline Analysis
- Log Tags
- Development and Testing
- Limitations
- Troubleshooting
- Responsible Use
- Contributing and Support
- License
- Monitors
crypto.subtleoperations includingencrypt,decrypt,sign,verify,digest,importKey,exportKey,deriveKey, andderiveBits. - Captures cleartext inputs, algorithm configurations, key attributes, and resulting ciphertext or plaintext.
- Records initiating JavaScript call stacks up to five frames deep for caller attribution.
- Samples
crypto.getRandomValuesinvocations with rate-limiting to inspect initialization vectors and nonces.
- Observes outbound requests made via
fetch,XMLHttpRequest,sendBeacon, and WebSocket connections. - Automatically flags media manifest and segment URLs matching HLS and DASH formats (
.m3u8,.mpd,.ts,.m4s). - Extracts AES key patterns from response bodies, including JSON fields (
ck,key,contentKey,aesKey), binaryapplication/octet-streampayloads, and HLS#EXT-X-KEYdeclarations. - Provides optional noise filtering to suppress third-party analytics and tracker requests.
- Automatically attaches to child targets, including iframes, Out-of-Process Iframes (OOPIFs), Dedicated Workers, Shared Workers, and Service Workers.
- Injects global scope hooks into workers via
Runtime.evaluateto monitor background cryptographic operations. - Intercepts
postMessagetraffic passing throughWorkerinstances andMessagePortchannels.
- Sets non-invasive breakpoints on arbitrary site functions using the
--hookoption without modifyingFunction.prototype.toString. - Captures paired
(input, output)execution tuples using the--hook-returnoption to support clean-room verification.
- Logs WebAssembly module compilation via
WebAssembly.instantiate,WebAssembly.compile, and streaming APIs (WebAssembly.instantiateStreaming,WebAssembly.compileStreaming). - Dumps compiled WebAssembly bytecode under 5 MB directly to disk with active stream cancellation, strict chunk sequence validation, SHA-256 collision disambiguation, and TypedArray view offset preservation.
- Automatically unpacks Dean Edwards packed JavaScript code and extracts embedded secrets.
- Full extraction mode (
--full) mirrors downloaded HTML, scripts, sourcemaps, images, rendered DOM, and executable curl replay scripts to an organized local folder. - Opportunistically recovers original source files from both inline sourcemaps and HTTP header sourcemap declarations via CDP script metadata, backed by SSRF safeguards (connection-time IP pinning, RFC 1918/cloud metadata blocking, and 10MB memory limits).
- Correlates WebCrypto hash digests, HMAC/ECDSA signatures, initialization vectors, and
crypto.randomUUID()nonces with outbound HTTP headers (X-Signature,Authorization,X-Request-Id) and JSON request bodies ([π CRYPTO LINK]). - Auto-generates shell-escaped
curlcommands for all API requests and saves executable replay scripts to_replays/under--fullmode.
- Decodes RFC 7519 JSON Web Tokens (standard compact
eyJ...and whitespace-formatted headers) across network responses, headers, Blobs, cookies, andlocalStorage/sessionStoragestate ([π« TOKEN CLAIMS]). - Calculates remaining token lifetime and flags expired credentials.
- Scans
localStorage,sessionStorage, and client-sidedocument.cookieassignments without token truncation. - Scans HTTP response headers (
Set-Cookie,Authorization) even on empty redirect responses. - Compares V8 heap snapshots over a configurable interval (
--heap-diff) to identify newly retained objects, strings, and typed arrays. - Scans script sources via
Debugger.scriptParsedfor PEM certificates, DER keys, and hardcoded cryptographic constants.
- Node.js: Minimum declared version is
node: ">=22.12.0"inpackage.json(aligned withpuppeteerruntime requirements). - Browser Executable: Requires a locally installed build of Google Chrome, Chromium, or Brave Browser. Alternatively, specify an explicit executable path using the
PUPPETEER_EXECUTABLE_PATHenvironment variable. - Operating System: Supported and tested on Windows, Linux, and macOS.
| Node.js Version | Official Lifecycle Status (nodejs/Release) | Project Validation Status | Recommendation |
|---|---|---|---|
| Node.js 22 | Maintenance LTS (Maintenance until April 30, 2027) | Declared minimum baseline (>=22.12.0). Configured in CI matrix. |
Supported baseline for existing LTS deployments. |
| Node.js 24 | Active LTS (Maintenance transition scheduled for October 20, 2026; EOL April 30, 2028) | Verified locally with passing unit and live browser E2E test suite. Configured in CI. | Recommended production LTS release. |
| Node.js 26 | Current (Active LTS transition scheduled for October 28, 2026; EOL April 30, 2029) | Configured in CI test matrix. Forward compatibility target. | Supported for upcoming and forward-looking environments. |
Note: Release schedule dates reflect the official Node.js release calendar (https://github.com/nodejs/Release). Scheduled maintenance and LTS transitions take effect according to upstream release availability.
git clone https://github.com/cipherwire/webcrypto-interceptor.git
cd webcrypto-interceptorInstall the required production dependencies:
npm installTo skip the automated Chromium download when you plan to use an existing system Chrome or Brave installation:
Windows (PowerShell):
$env:PUPPETEER_SKIP_DOWNLOAD = "true"
npm installLinux / macOS (Bash):
PUPPETEER_SKIP_DOWNLOAD=true npm installThe toolkit automatically checks standard system install directories for Google Chrome and Brave. If your browser executable is stored in a non-standard location, set the environment variable:
Windows (PowerShell):
$env:PUPPETEER_EXECUTABLE_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe"Linux / macOS (Bash):
export PUPPETEER_EXECUTABLE_PATH="/usr/bin/google-chrome"Launch the interceptor against an authorized local or remote target:
node capture_server.js "https://webcryptotest.hainahola.store" --guiAn authentic production target sandbox is hosted 24/7 at https://webcryptotest.hainahola.store to test and verify every interception capability against real browser cryptography:
- WebCrypto Subtle AES-GCM-256: Key derivation, 96-bit CSPRNG IVs, authenticated encryption.
- Asymmetric Envelope RSA-OAEP-2048: Real SPKI and PKCS#8 PEM key exports, encrypted symmetric key envelopes.
- Identity Provider RFC 7519 JWT: Valid JSON Web Tokens signed with HMAC-SHA256 (
HS256). - WebAssembly Kernel Acceleration: Dynamic
.wasmbinary module instantiation and execution. - Rotated String Tables: In-memory shuffled array with live decoder
_0x4b12(idx). - HLS DRM ClearKey Streams: Valid
#EXT-X-KEY:METHOD=AES-128playlists and encrypted MPEG-TS chunks. - Bytecode Virtual Machine: Real opcode interpreter loop with stack pointers and register states.
# Intercept live WebCrypto, JWT tokens, and HLS DRM streams
node capture_server.js "https://webcryptotest.hainahola.store" --gui
# Dump in-memory rotated string tables
node capture_server.js "https://webcryptotest.hainahola.store" --dump-strings "_0x4b12"
# Trace forward consumer dataflow from producer to consumer
node capture_server.js "https://webcryptotest.hainahola.store" --trace-flow "generateSessionSignature"- Puppeteer launches the browser using stdio pipe transport (
pipe: true). - Page-side stealth hooks (
src/page/stealth.js) are registered to evaluate before document scripts. - Native breakpoints are attached to
window.crypto.subtlemethods. - An event channel binding (
__wci) is established for structured event streaming. - All observed events are printed to the terminal and appended to
session_capture_<timestamp>.jsonlin the current working directory. - Pressing
Ctrl+Cflushes pending disk writes, outputs a markdown summary report, and closes the browser session cleanly.
Notice: Always ensure you have permission to monitor and intercept traffic on the target URL.
node capture_server.js <URL> [options]| Option | Type | Default | Description |
|---|---|---|---|
<URL> |
Positional | (Required) | Target URL starting with http:// or https://. |
--gui |
Boolean | false |
Launch browser in visible headful mode instead of headless. |
--brave |
Boolean | false |
Select Brave Browser instead of Chrome or Chromium. |
--full |
Boolean | false |
Enable full extraction mode (mirrors all responses to disk). |
--out <dir> |
String | . |
Output directory for logs, summaries, and extracted assets. |
--timeout <sec> |
Integer | 60 |
Page navigation timeout in seconds. |
--ua <string> |
String | null |
Custom User-Agent string applied to all attached targets. |
--proxy <addr> |
String | null |
Upstream proxy server (e.g. http://127.0.0.1:8080 or socks5://127.0.0.1:9050). |
--all-traffic |
Boolean | false |
Disable analytics and tracker noise filtering to capture all requests. |
--hook <expr> |
String | [] |
Arm function call breakpoint. Repeatable option. |
--hook-return <expr> |
String | [] |
Arm function call and return breakpoints for input/output logging. Repeatable. |
--trace-flow <expr> |
String | [] |
Arm return breakpoint and trace downstream consumer variable and frame. Repeatable. |
--dump-strings <expr> |
String | null |
Drive page's runtime string decoder via high-speed batched CDP evaluation across index ranges. |
--trace-vm <loc> |
String | [] |
Trace a bytecode VM dispatch loop at script location <urlRegex:line[:column]>. |
--watch <exprs> |
String | null |
Comma-separated expressions to evaluate on VM loop hit (pc,op,stack[sp]). |
--heap-diff <sec> |
Integer | 0 |
Capture two heap snapshots separated by N seconds to report retained allocations. |
--help |
Boolean | false |
Display command help and exit. |
node capture_server.js "https://webcryptotest.hainahola.store" --brave --guinode capture_server.js "https://webcryptotest.hainahola.store" --full --out ./captures --timeout 90node capture_server.js "https://webcryptotest.hainahola.store" --proxy "http://127.0.0.1:8080" --guinode capture_server.js "https://webcryptotest.hainahola.store" --hook-return "window.runJwtSign"node capture_server.js "https://webcryptotest.hainahola.store" --trace-flow "generateSessionSignature"node capture_server.js "https://webcryptotest.hainahola.store" --dump-strings "_0x4b12"node capture_server.js "https://webcryptotest.hainahola.store" --trace-vm "lab.js:vmInterpreter" --watch "pc,op,stack[sp]"node capture_server.js "https://webcryptotest.hainahola.store" --heap-diff 15Running webcrypto-interceptor generates structured artifacts designed for both manual review and automated analysis:
<output-directory>/
βββ session_capture_1730000000.jsonl # Stream of all captured events
βββ session_capture_1730000000_summary.md # Markdown session metrics report
βββ <hostname>_1730000000/ # Created when using --full
βββ terminal_output.txt # Plaintext terminal transcript
βββ _rendered.html # Post-render snapshot of the DOM
βββ extracted_summary.json # JSON catalog of keys, secrets, and files
βββ _sources/ # Unpacked sourcemap files
βββ wasm/ # Dumped WebAssembly binaries (< 5 MB)
βββ <path>/<file> # Mirrored network responses
Captured files frequently contain sensitive information, including cryptographic keys, plaintext payloads, authorization tokens, session cookies, and private request parameters. Store capture files securely, exclude them from public repositories, and sanitize data before sharing bug reports.
The diagram below illustrates how webcrypto-interceptor coordinates browser control, event interception, and output logging:
flowchart TD
CLI["CLI: capture_server.js"] --> Launch["Puppeteer Launch (pipe: true)"]
Launch --> Stealth["Inject stealth.js (evaluateOnNewDocument)"]
Launch --> MainCDP["Main CDP Session"]
Launch -. Auto Attach .-> WorkerCDP["Worker & Iframe Targets"]
MainCDP --> Binding["CDP Binding: Runtime.addBinding ('__wci')"]
MainCDP --> Breakpoints["Native Breakpoints: SubtleCrypto.prototype.*"]
MainCDP --> NetDomain["Network Domain: Requests & Responses"]
MainCDP --> ScriptDomain["Debugger Domain: scriptParsed"]
WorkerCDP --> WorkerEval["Runtime.evaluate (stealth.js)"]
WorkerEval --> Binding
Binding --> EventDispatch["events.js: Envelope Reassembly & Dedup"]
Breakpoints --> CryptoLogger["crypto.js: Boundary & Stack Inspection"]
NetDomain --> DecoderModule["decoders.js: Key Extraction & Unpacking"]
ScriptDomain --> SecretScanner["secrets.js: Token & Key Regex Scanner"]
EventDispatch --> LogStream["log.js: JSONL & Terminal Capture"]
CryptoLogger --> LogStream
DecoderModule --> DiskExtractor["extract.js: Mirrored Path Storage"]
SecretScanner --> SummaryReport["summary.js: Markdown Session Summary"]
- Structured Binding Channel (
Runtime.addBinding): The page-side script emits JSON envelopes directly to the host viawindow.__wci(). This transport bypasses console filtering, prevents string truncation, and operates inside Web Workers whereconsole.logis not relayed by default. Large payloads such as WebAssembly bytecode are chunked into 200 KB segments and reassembled byevents.js. - Legacy Console Fallback: If the binding fails to register or a context attaches mid-flight, hooks emit formatted
[Reversed-Event]lines toconsole.log. Events are deduplicated by UID to ensure each event is recorded exactly once.
The offline key extractor parses a session log, correlates crypto.subtle.importKey and decrypt calls with preceding media requests, and prints OpenSSL command templates:
node scripts/extract-keys.js session_capture_1730000000.jsonlurl: https://webcryptotest.hainahola.store/stream/segment_0.ts
algo: AES-CBC
key: 0123456789abcdef0123456789abcdef
iv: fedcba9876543210fedcba9876543210
# openssl enc -d -aes-128-cbc -K 0123456789abcdef0123456789abcdef -iv fedcba9876543210fedcba9876543210 -in seg.enc -out seg.dec
1 key/iv pair(s) extracted from session_capture_1730000000.jsonl
crypto-recipe.js replays a session's CDP-boundary crypto calls (crypto_call records, with serialized arguments since 0.4.2) in order, collapses proof-of-work digest bursts, and prints the per-target protocol checklist:
node scripts/crypto-recipe.js session_capture_1730000000.jsonl=== other:embed.example/t8p/abc123 - 13 crypto call(s), 10 step(s) ===
1. generateKey Wn
2. exportKey x2 Wn
3. sign ar
4. digest x3 qe <-- proof-of-work style burst
5. importKey La
args [{"format":"raw"},{"__t":"Uint8Array","len":32,"hex":"47e82b..."}]
6. decrypt La
When reverse engineering custom cryptographic routines or payload packers, capture ground-truth executions using --hook-return:
node capture_server.js "https://target.local" --hook-return "window.signPayload"Then test your clean-room JavaScript reimplementation against the recorded dataset:
node scripts/verify-reimpl.js --session session_capture_1730000000.jsonl --candidate ./my_signer.js --label "window.signPayload"The verifier executes your candidate function in an isolated headless browser page (about:blank) without network access, comparing return values against recorded ground truth using strict deep equality:
Tested 25 recorded calls:
matched: 25/25 (VERIFIED)
mismatched: 0
Terminal output uses structured tags to categorize observed events:
| Tag | Category | Description |
|---|---|---|
[π CRYPTO BOUNDARY] |
WebCrypto | crypto.subtle operation invoked with caller stack trace. |
[π CRYPTO ARGS] |
WebCrypto | Arguments passed to a subtle cryptographic method. |
[π CRYPTO RESULT] |
WebCrypto | Value returned by an operation (key metadata, ciphertext, plaintext). |
[π² RANDOM] |
WebCrypto | crypto.getRandomValues invocation and returned buffer. |
[π NET] |
Network | Outbound HTTP request initiated via fetch, XHR, or sendBeacon. |
[π NET RESP] |
Network | Response body containing an authorization token or cryptographic key. |
[π WS] |
Network | WebSocket frame sent or received. |
[π¬ VIDEO] |
Media | Media manifest or segment request (.m3u8, .mpd, .ts, .m4s). |
[π CONTENT KEY] |
Keys | AES key extracted from a JSON field or HTTP header. |
[π RAW AES KEY] |
Keys | Binary key detected in an octet-stream response. |
[π HLS AES KEY URI] |
Keys | URI and IV extracted from an HLS #EXT-X-KEY directive. |
[π SECRET] |
Scanner | Pattern match for PEM certificates, private keys, or JWT tokens. |
[π¨ MSG] |
Workers | Message passed via Worker.postMessage or MessagePort. |
[ποΈ BLOB URL] |
Storage | Blob URL created via URL.createObjectURL. |
[π BLOB CONTENT] |
Storage | Text or script source code loaded into a Blob. |
[πΎ STORAGE STATE] |
Storage | Sensitive item written to localStorage or sessionStorage. |
[𧬠WASM INJECT] |
WebAssembly | WebAssembly module compiled or instantiated. |
[𧬠WASM DUMPED] |
WebAssembly | WebAssembly binary bytecode saved to disk. |
[π·οΈ CRYPTO HOOK] |
Debugger | Native V8 breakpoints armed on a target context. |
[πͺ HOOK] |
Hooks | Function hooked via --hook executed (arguments and stack logged). |
[πͺ HOOK PAIR] |
Hooks | Function hooked via --hook-return finished (input and output recorded). |
[π DATAFLOW] |
Dataflow | Hooked function returned and linked downstream to caller and variable. |
[πͺ’ STRING UNPACKER] |
Deob | Runtime string decoder executed across index ranges to extract tables. |
[𧬠VM WATCH] |
VM | Bytecode interpreter dispatch loop hit with evaluated register states. |
[π§ HEAP DIFF] |
Memory | Summary of heap allocations between snapshots. |
The repository uses Node's native test runner (node:test) and ESLint for code quality.
npm testThe test runner executes all unit tests and automatically detects whether a local browser binary is available:
- Unit Tests (115 tests): Exercise pure logic modules (decoders, secret scanner, URL sanitization, CLI parsing, event deserialization, string table extraction, dataflow resolution, VM state tracking, SSRF destination protection, and WebAssembly chunk validation) in approximately 250 milliseconds with zero external dependencies.
- Browser E2E Test (
tests/e2e.test.js): When Chrome or Brave is detected, launches headless Chrome, initializes a secure context, and confirms WebCrypto AES-GCM interception.
To run only unit tests without launching a browser:
Windows (PowerShell):
$env:SKIP_E2E = "1"
npm testLinux / macOS (Bash):
SKIP_E2E=1 npm testVerify code style and formatting:
npm run lint- Secure Context Requirement: The W3C Web Cryptography API (
window.crypto.subtle) is restricted by modern browsers to Secure Contexts (HTTPS,http://localhost, orhttp://127.0.0.1). Pages loaded over plain HTTP cannot execute WebCrypto operations. - WebSocket Caller Stacks: Native CDP WebSocket events capture frame payloads out-of-process, but do not provide the initiating JavaScript call stack. Page-side hooks provide call stacks but carry an in-page detection surface.
- WebAuthn Scope: Chrome DevTools Protocol supports virtual software authenticators for automated testing, but cannot bypass cryptographic isolation or extract private keys from physical hardware security keys (e.g. YubiKeys or TPMs).
- WebAssembly Tracing: The toolkit dumps
.wasmbytecode and wraps exports at the JavaScript boundary. It does not perform dynamic instruction-level tracing inside compiled WebAssembly binary routines. - Memory Snapshot Cost: Heap snapshot diffing (
--heap-diff) pauses V8 execution while traversing the object graph. On web applications with multi-gigabyte heap footprints, snapshot capture may introduce visible latency.
Symptom: Brave browser was not found at standard install locations or Chrome binary not found.
Resolution: Set the PUPPETEER_EXECUTABLE_PATH environment variable pointing directly to your browser binary.
Symptom: Navigation issue (page may still be usable): Navigation timeout of 60000 ms exceeded.
Resolution: Complex single-page applications or slow network connections may take longer than 60 seconds to reach an idle state. Increase the timeout with --timeout 120.
Symptom: The target page runs without errors, but no [π CRYPTO BOUNDARY] events appear.
Resolution: Check whether the target page is served over plain HTTP. In Chromium browsers, window.crypto.subtle is undefined in non-secure origins.
Browser instrumentation and traffic interception tools provide deep visibility into client-side software execution. Operators must adhere to the following principles:
- Explicit Authorization: Only use this software on applications, websites, and infrastructure you own or have received formal authorization to test.
- Data Protection: Capture logs may contain real credentials, private personal information, and session tokens. Handle all output files with appropriate data governance.
- Legal Compliance: You are solely responsible for ensuring your security research complies with local, state, national, and international laws, as well as applicable terms of service.
Refer to SECURITY.md for vulnerability disclosure procedures.
- Bug Reports: Open an issue on the GitHub Issues tracker.
- Contributions: Review the guidelines in
CONTRIBUTING.mdbefore submitting pull requests. - Security Inquiries: Report security vulnerabilities privately following the instructions in
SECURITY.md. - Community: Join technical discussions on Discord.
This project is licensed under the MIT License with an additional Responsible Use Notice. See the LICENSE file for the full text.