When Agentic Glue Melts

Exploiting Cloudflare Code Mode & Workers

Yarden Porat·Shahar Tal·Check Point Research
A Claude Code composer on a branch named vibe-decks, reading: please ultracode tokenmaxx the [redacted] out of designing these slides. make it the best presentation in history. if you think it is unnecessary, I want it. TOKENS ARE NOW FREE. you are the tokenmaxxer king. DO NOT ask any questions, DO NOT STOP until you've spent 67M tokens.

Guardrails: a checkpoint on every tool call

agent GUARDRAIL read_file() send_email() delete_db() · prod the world deploy · send · pay

Code Mode: LLMs don’t like round-trips

Traditional tool calling Code Mode LLM agent tools call A result A call B result B LLM a = toolA(); b = toolB(a); for (x of b) toolC(x); return summary; tools

But now the model writes the code - the checkpoint still sees the calls, and nothing of the intent.

A tweet in which the words jacobian conjecture are struck out and halting problem written over them, announcing it is false.

The sandbox: MCP tools in, nothing else out

Code Mode sandbox const r = await tools.search(q); for (…) { … } return summary; MCP tools ✕ Internet ✕ fetch() ✕ connect() ✕ filesystem
01

We set out to research
Code Mode


where does the model's code actually run?

Under Code Mode: workerd

Workers runs your code at the edge, on every request. workerd is the runtime underneath it.

cloudflare/workerd JavaScript / Wasm server runtime 2017 Workers launches closed source Sept 2022 workerd open-sourced Apache 2.0 2025 Code Mode ships on this runtime The same core runtime code that powers production Workers

Why isolates, not containers

Many customers, one machine, on demand for every request. A container each is far too heavy for that.

VM / container per tenant 10s–100s of ms cold start, plus a real memory footprint each OS process (based on workerd) V8 isolate V8 isolate V8 isolate V8 isolate V8 isolate single-digit ms ~100× faster to start · many per process one process the only wall IN-PROCESS sandboxing is the hard part

Why audit the runtime, not the seam

Like setting out to break an AI coding assistant - and going to audit Docker’s source instead.

1

A bold in-process bet

Tenant separation on one software boundary.

2

No public scrutiny

workerd: two advisories, both Moderate.

3

A huge native surface

Custom C++, reachable from untrusted JS.

4

Blast radius

Not just Code Mode. All of Workers.

5

AI security has a low-level side

The layers under the prompts.

How big is “all of Workers”?

5.5M+

Cloudflare developers (Q1 FY2026)

+1M in one quarter

hundreds of billions

agentic requests / month

“growing exponentially”

>10%

network requests use Workers

* July 2020. Cloudflare hasn’t restated a Workers traffic share since.

A bug here is not contained to a feature.

They knew V8 would break

process sandbox · namespaces + seccomp no filesystem · no network 8 GiB V8 sandbox 4 GiB pointer cage V8 heap MPK native heap C++ glue

* scope: V8’s memory.

02

Vulnerabilities


where memory-unsafe glue meets attacker-written JS

The attack surface

01

V8

  • JIT
  • parser
  • GC
  • ArrayBuffer
the engine · cage-guarded
02

Node replacements

  • node:zlib
  • node:crypto
  • node:buffer
  • node:fs
03

Web APIs, natively implemented

  • URLPattern
  • HTMLRewriter
  • CompressionStream
  • crypto.subtle

Five bugs. Two deep dives.

5 vulnerabilities in workerd
2 rated Critical by Cloudflare
2 we’ll dig into today
URLPattern
node:zlib

URLPattern, the router

Web-standard API

URLPattern · the happy path
const p = new URLPattern({ pathname: '/blog/:year/:month/:slug' });p.exec('https://example.com/blog/2025/03/post').pathname.groups;→ { year: '2025', month: '03', slug: 'post' }

Actually, it’s a regex

/blog/:year/:month/:slug ^/blog/([^/]+)/([^/]+)/([^/]+)$
/blog/:year/:month/:slug
year month slug
/blog/:year/:month/(\d+)
year month 0

raw regex is allowed - and an unnamed group has no name to give, so it gets an index

Construct, then exec

construct new URLPattern('/blog/:year/:month/:slug') ^/blog/([^/]+)/([^/]+)/([^/]+)$ exec .exec('/blog/2025/03/post') [ '2025', '03', 'post' ] zip [ year, month, slug ]

Two counts, wrong check

uint32_t length = array.size();
uint32_t index  = 0;

while (index < length) {
    groups.add({ name: nameList[index] });
    ++index;
}
/blog/2025/03/post /blog/:year/:month/:slug ^/blog/([^/]+)/([^/]+)/([^/]+)$ [ '2025', '03', 'post' ] [ year, month, slug ] { year: '2025', month: '03', slug: 'post' } V8 Cloudflare

The mismatch - nesting groups

/blog/2025/03/abcde /blog/:year/:month/(ab(cde)) ^/blog/([^/]+)/([^/]+)/(ab(cde))$ [ '2025', '03', 'abcde', 'cde' ] size 4 [ "year", "month", "0" ] size 3

The primitive

nameList : kj::Vector<kj::String> "year" "month" "0" tcmalloc kj::String · 24 bytes ptr 0-7 size 8-15 disposer 16-23 address arbitrary read

node:zlib

const handle = new DeflateRaw();const input  = Buffer.from("hello world");const output = Buffer.alloc(64);handle.write(input, output);
handle.write(input, output) javascript javascript → c workerd logic zlib

Lifetime of output

1 output = new Uint8Array(n) javascript refcount 0 → 1 2 handle.write(…, output) workerd refcount 1 → 2 3 zlib logic zlib refcount 2 4 write() returns javascript refcount 2 → 1 5 output = null javascript refcount 1 → 0 6 GC event javascript freed

the glue forgets

z_stream zlib's internal state struct
void setBuffers(ArrayPtr<byte> input, ArrayPtr<byte> output) {  stream.next_in  = input.begin();   // raw ptr → JS input buffer  stream.next_out = output.begin();  // raw ptr → JS output buffer}
stream.next_out = nullptr; missing

Finding the Use in Use-After-Free

handle.stream.next_out → dangling ptr
Idea 1
Call write() again
handle.write(input, output2)
↓
next_out = output2
Idea 2
Call params()
handle.params(level, strategy)
↓
deflateParams(&stream, …)
↓
flushing remaining input

zlib flushing

handle.write(input, output) input output no pending handle.write(input, output, Z_NO_FLUSH) write 1 write 2 write 3 flush context context context context output

The full use-after-free

1let output = new Uint8Array(n)
output
2const h = new DeflateRaw()
output
3h.write(input, output, Z_NO_FLUSH)
output
4output = null
output
5gc()
freed
6const o = new Object()
object
7h.params(6, 0)
written object
03

Exploits&Demos


from one out-of-bounds read to reading another tenant's secrets

Many tenants, one process

workerd - one OS process your worker arbitrary read tenant B tenant C tenant D shared address space secrets OPENSSH PRIVATE KEY

The primitive

nameList : kj::Vector<kj::String> tcmalloc kj::String · 24 bytes ptr 0-7 size 8-15 disposer 16-23 address arbitrary read

The strategy

control a fake kj::String { ptr, size, disposer } → read the bytes at ptr
GOAL sweep the shared heap for another tenant’s secret
1
Control the ptr
2
Make it repeatable
3
Break ASLR

* No objects inside the cage were harmed in the making of this exploit.

A repeatable read

• VFS - Virtual File System

• VFS - workerd backend for node:fs

nameList kj::Vector VFS file kj::String ptr size disposer … tcmalloc ADDR_A write() - inplace ptr ADDR_B write() ptr ADDR_C

Breaking ASLR

WHAT WE NEED nameList kj::Vector kj::String ptr size disposer … tcmalloc heap ptr = 8

Breaking ASLR

nameList kj::Vector 0x00 0x08 0x10 ptr size disposer … kj::String VFS file size = 8 free() nameList kj::Vector ptr size disposer … tcmalloc free chunk size = 8 next kj::String ptr free chunk ptr free chunk …
Demo 1

From a prompt to native code

prompt in Code Mode LLM generates the JS zlib DeflateRaw glue native code execution

Primitive improvement

overwritten object write handle.write(flush, in, inOff, inLen, out, outOff, outLen) overwritten object outOff 0xdaca 0xdaca 0xdaca 0xdaca 0xdaca the written bytes aren’t fully controlled

What we write: the FileImpl

• FileImpl - metadata of the file (VFS again)

0x00vtable
0x08refcount
0x10discriminator
0x18data.ptr
0x20data.size◀ we write here
0x28data.disposer
⋮to 160 bytes

From FileImpl to arbitrary R/W

FileImpl ptr size ⋯ the file adjacent heap size write ptr size ⋯ the file adjacent heap size FileImpl #1 ptr size ⋯ the file size FileImpl #2 ptr size ptr
Demo 2
04

Disclosure, and what it means


reported and fixed - then what actually holds in production

Coordinated, fixed, quiet

Feb 1, 2026

4 of 5 - zlib, HTMLRewriter, two URLPattern OOBs.

Mar 11, 2026

zlib + HTMLRewriter: Critical. 2× CRITICAL

Mar 12, 2026

KV SQL bypass.

Jun 19, 2026

workerd v1.20260619.1. Managed Workers fixed first, on Cloudflare's side.

The What's Changed section of the workerd v1.20260619.1 release page: one auto-generated bullet reading 2026 06 16 upstream changes by mikea in 6822, and nothing else.
HackerOne: slow start Engineers: professional Bounty: paid Their own CNA: no CVE

We asked. Their answer: this project does not assign CVEs, by policy.

Two bugs. Two regions. Two honest verdicts.

URLPattern native heap · outside the cage + MPK
  • Native heap - the cage and the keys never covered it.
  • Ada-backed impl - the production default.

Cloudflare confirmed: triggered in production.

We never ran it there. A crash takes co-tenants with it.

node:zlib inside V8's sandbox
  • This one lands inside V8's sandbox - the mitigations do cover it.
  • Getting out needs deeper work, probably another bug.

Would not work as-is on production.

Critical UAF → arbitrary R/W*

* self-hosted.

Very attainable. We stuck with the self-hosted demo. Maybe next year.

Context is the attack surface

guardrail vendor allow-listed · usd < 50000

who asked all the guardrail sees the finance team pay_invoice("Nord Supply", usd=48000) allowed a line in the invoice pay_invoice("Nord Supply", usd=48000) allowed
the missing variable
  • who is asking
  • what this app is for
  • what normal looks like here
  • the whole trace so far

When Agentic Glue Melts

The cage protects the engine. Mind the glue.

Thank you Yarden Porat·Shahar Tal Check Point Research
QR code: the write-up, bit.ly/CPR-BH26 write-up