A remote Spectre attack leaked a secret from Cloudflare Workers

In short

12 bit/s peak leak rate, over 99% accurate; 120 bit/h rate of the previous attack on Workers; 5 to 20+ hours how long one isolate was kept alive; 64 MB memory allocated to dodge cache eviction (for a 256 KB L2 cache)

What is a Spectre attack?

Modern processors guess which way a branch in a program will go and start working before they know. If the guess is wrong, the results are discarded. Cloudflare's post compares it to hiking: you take a wrong turn, go back, and the trail looks untouched, but your footsteps remain in the mud. The "footsteps" are changes in the CPU cache, the small fast memory next to the processor. An attacker makes the processor transiently read memory it should not, encodes one bit into the cache, then times how fast the data comes back: faster means the bit was 1, slower means 0.

Why Workers are a target

Workers runs untrusted JavaScript from many customers. Instead of giving each its own process, it uses V8 isolates, so tens of thousands of tenants can share one operating-system process, each with its own JavaScript heap. That is cheap and fast to start, but it means a Spectre leak inside a process can cross from one customer to another. Cloudflare's defences include freezing local timers (during CPU-only work, Date.now() and performance.now() do not advance), banning multithreading and shared memory, shuffling memory, and DyPrIs, which watches hardware performance counters and moves scripts that look like Spectre attacks into their own processes.

How did the attack get around the defences?

The researchers solved four problems.

Two Spectre gadgets did the leaking: one reveals compressed heap pointers, including the isolate's heap base address; the second uses a speculative type confusion to read from an attacker-chosen 64-bit address. They also ran the attack in an off-peak data centre, such as one in Australia during European business hours, because load on the server hurts stability.

To keep a single isolate running, they opened a persistent WebSocket to a Durable Object (a Workers feature for real-time coordination) and sent keep-alive messages, each of which counts as a new invocation and resets the CPU-time and request limits. By yielding between bursts they kept an isolate alive from five to more than 20 hours.

What did they actually leak?

Everything below was against Workers the researchers controlled. They first leaked memory from their own attacker Worker, then confirmed 64-bit reads by reading the vDSO region (a kernel-provided memory area containing readable strings such as gettimeofday). Finally they placed a JWT token (a signed login token) in a co-located victim Worker and leaked it bit by bit; the first byte came out as the character e, 0b01100101. They report up to 12 bit/s with more than 99% accuracy, and that higher rates are possible at the cost of accuracy. By our arithmetic, 12 bit/s is 43,200 bits an hour, about 360 times the earlier 120 bit/h.

Why did Cloudflare's own detection miss it?

Two reasons, per the post. DyPrIs isolates a script only after its invocation ends, and the keep-alive trick can hold one invocation open for hours, so the leak finishes first. And DyPrIs divides branch mispredictions by the number of instruction-TLB accesses; the attack's timer is one big I/O loop whose WebSocket traffic inflates that count, pushing the ratio under the detection threshold, so it looked like an ordinary I/O-heavy Worker.

What Cloudflare changed

Cloudflare says the attack is mitigated, but also says none of the three changes fully solves Spectre. The 2024-25 tests used the pre-sandbox platform and Workers the researchers controlled.

What is not stated or checked

Sources

Sources

Related stories

More from Vulnerability Research

All stories from Vulnerability Research