A revisit of remote Spectre attacks on Cloudflare Workers
Cloudflare reassessed remote Spectre attacks against Workers and found a limitation in their Dynamic Process Isolation defence. Using a remote WebSocket timer, PLRU cache amplification and a Durable Object keep-alive, they demonstrated a cross-tenant leak of up to 12 bit/s with over 99% accuracy in production.
Published on blog.cloudflare.com
In 2021, we assessed remote Spectre attacks against Cloudflare Workers. Based on the results, we shipped a production defense called Dynamic Process Isolation (DyPrIs), which identifies maliciously looking scripts and isolates them into separate processes.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the V8 isolate model shares one process and one address space between tenants, and the speculative type-confusion gadget could follow a raw 64-bit typed-array pointer out of bounds because the V8 Sandbox and per-isolate memory protection were not yet in place.
Impact
An attacker could read memory across tenant boundaries in the production environment, but the attack only worked against Workers the researchers controlled, was mitigated by the time of publication, and showed no signs of active exploitation.
What the attacker needed
Ability to deploy Workers on the platform; attacker and victim co-located in one process; a remote high-resolution timer; a Durable Object for a long-lived channel
How it was found
- Establish co-location of the attacker Worker, the victim Worker and a remote timer, using the trace endpoint to confirm machine placement.
- Open a persistent WebSocket to a Durable Object and send keep-alive messages so one isolate stays alive past the CPU and subrequest limits.
- Mistrain the branch predictor on the type check and use the first gadget to leak compressed heap pointers such as the isolate root.
- Use the speculative type-confusion gadget with 64-bit pointers to read arbitrary addresses, confirmed against the vDSO region.
- Amplify each cache event with tree-based PLRU access patterns and classify bits from repeated remote-timer measurements.
- Leak a JWT token placed in the victim Worker bit by bit and reconstruct it.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Spectre abuses the way a processor guesses which way a branch will go and briefly runs ahead. Those guessed instructions are thrown away, but they leave traces in the CPU cache that an attacker can time. Here the attacker ran JavaScript on Cloudflare's shared edge platform and used a remote clock to measure those traces, eventually reading a secret from another customer's Worker.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.