AI Explainers Security

Spectre Attacks on Workers: Cloudflare’s 2024-2025 Revisit Explained

Cloudflare's research shows Spectre attacks against Workers can still leak data, and how new isolation defenses respond.

Abstract illustration of speculative execution pathways and isolation layers representing Spectre attacks on Workers infrastructure

Cloudflare has published new research revisiting Spectre attacks Workers infrastructure faces, five years after the company first assessed the risk and shipped a defense called Dynamic Process Isolation (DyPrIs). The follow-up study, covering work done in 2024 and early 2025, found a gap in that original defense and used it to build a working proof-of-concept that leaked data from the production Workers environment at up to 12 bits per second with 99% accuracy.

The paper, co-authored by Albert Pedersen, Haocheng Xiao, Sam Ainsworth, Nigel Topham, and Martin Schwarzl, describes an internal red-team exercise rather than a disclosure of active exploitation in the wild. Cloudflare states it found no evidence the technique was used against real customers over the past three years, and says the specific attack path is already mitigated in production. The value of the research for outside observers is less about a live threat and more about what it reveals about the practical difficulty, and eventual feasibility, of running microarchitectural side-channel attacks against a large multi-tenant JavaScript platform.

Why Spectre Still Matters on a Shared Runtime

Cloudflare Workers runs untrusted JavaScript from tens of thousands of tenants inside shared operating-system processes, using V8 isolates for language-level separation instead of one full OS process per tenant. That design keeps cold-start latency low and lets the platform pack many customers onto the same hardware efficiently. The tradeoff is that a single memory-disclosure bug inside a Worker process can, in principle, expose data belonging to a different tenant sharing that process.

Spectre exploits a mismatch between how modern CPUs execute code and how they are supposed to behave. Processors predict the outcome of branches and speculatively execute instructions ahead of resolving that branch, discarding the results if the guess was wrong. Cloudflare’s writeup uses a hiking analogy: a wrong turn leaves footprints in the mud even after you turn back. In CPU terms, those footprints are traces left in shared caches, and an attacker who can coax a victim process into speculatively touching out-of-bounds memory can turn those cache traces into a readable signal, one bit at a time.

To blunt this class of attack, Cloudflare’s Workers runtime already freezes local timers, disallows multithreading and shared memory, and applies periodic memory shuffling alongside DyPrIs, which watches for scripts that look malicious and moves them into dedicated processes. The 2024-2025 research set out to test whether newer stabilization techniques for Spectre, developed elsewhere in the security research community, could get around those specific protections.

The Attack Primitives Cloudflare Demonstrated

Mounting a remote Spectre attack against a production edge platform is harder than doing it on a local test machine, and Cloudflare’s paper is candid about the obstacles. An external attacker needs to be co-located with a victim Worker on the same physical hardware, needs a timer precise enough to distinguish a cache hit from a cache miss, and needs the whole chain to survive the noise of a real data center: interrupts, context switches, other tenants’ activity, and coarse-grained timers that don’t behave like a clean lab clock.

Cloudflare’s Date.now() and performance.now() do not offer a continuously advancing high-resolution clock during CPU-only execution, and the absence of SharedArrayBuffer-based counter threads rules out the classic timing trick used in earlier Spectre demonstrations against browsers. The research team had to find an alternative remote timing source stable enough to work despite network jitter and system noise, then pair it with signal amplification to make a few-nanosecond cache timing difference visible above microsecond-to-millisecond levels of noise.

The core exploit relies on what Cloudflare describes as a Spectre gadget: a snippet of code containing a type check written as a branch, which the attacker mistrains by repeatedly calling it with a legitimate object type before switching to a different, attacker-crafted object. Under speculative execution, the CPU follows the previously trained branch path and reads a pointer field from the wrong object type, a bug class known as speculative type confusion. The gadget then encodes a single leaked bit into an array’s cache state, and the attacker measures access latency afterward to tell a cached line (bit value 1) from an uncached line (bit value 0).

Cloudflare’s team used two variants of this gadget. One leaks compressed heap pointers, including the isolate’s heap base address, useful for mapping the memory layout around a target object. The other exploits the fact that, at the time of the research, V8’s TypedArray objects still stored a raw 64-bit pointer to their backing store rather than a compressed 32-bit pointer like most other objects. By confusing two large objects so that a type-check field and a target field land on different cache lines, the attacker can evict the type field, open a speculation window, and have the transient read follow an attacker-controlled 64-bit address, turning a single-bit leak into what Cloudflare characterizes as an arbitrary-address read primitive.

Where This Sits Among Speculative-Execution Defenses

Spectre-class vulnerabilities have been studied since 2018 across browsers, cloud VMs, and JavaScript engines generally, and the mitigations that emerged, site isolation in browsers, retpolines and microcode patches at the OS and hardware level, and process-per-tenant isolation in some cloud platforms, all trade some combination of performance and complexity for safety. Cloudflare Workers took a different starting point than a full-VM-per-tenant cloud model: it leans on V8 isolates precisely because process-per-tenant isolation would erase the low-latency, high-density advantage that makes the platform useful at edge scale. DyPrIs was Cloudflare’s answer to that tension, treating full isolation as a targeted response for suspicious scripts rather than a default for every tenant.

Judged against that backdrop, this research is less a story about a novel Spectre variant and more about the operational reality that defenses calibrated against known attack patterns need periodic pressure-testing as academic side-channel research matures. Cloudflare frames the newer stabilization techniques it evaluated as ones discovered after 2021, which is exactly the gap an internal red-team exercise like this is meant to close: verifying whether real-world production conditions, not idealized lab conditions, still hold up.

A Worked Example of the Attack Chain

To see how the pieces fit together, consider how a researcher would actually execute this end to end. First, they deploy a Worker script and rely on Cloudflare’s scheduling behavior to land on the same process as a targeted victim Worker, satisfying the co-location requirement. Next, they run the speculative type-confusion gadget repeatedly against a legitimate object to mistrain the CPU’s branch predictor, then swap in a crafted object with a fake typed-array header so the transient read follows an attacker-chosen 64-bit pointer instead of the expected field. Each transient read encodes one bit into a probe array by touching one of two cache lines; the attacker then measures access latency on both lines, using a co-located, sufficiently precise remote timer and repeated sampling to filter out network and system noise. Repeating this bit-by-bit extraction is why the resulting channel is slow, Cloudflare’s paper reports up to 12 bits per second, but the 99% reported accuracy indicates the signal, once amplified, is highly reliable rather than a marginal statistical artifact.

The Defenses Cloudflare Added

In response to the limitation it found in DyPrIs, Cloudflare says it strengthened that mechanism and added two further layers: integration of the V8 Sandbox, which constrains what a compromised or speculatively-confused object can reach in memory even when a bug like the TypedArray raw-pointer issue exists, and an additional in-process isolation mechanism aimed at reducing the blast radius of memory-disclosure bugs generally. Cloudflare states the demonstrated attack chain is already mitigated in the current production system as a result of these Workers Runtime team countermeasures.

That layered response mirrors the broader industry pattern for Spectre mitigation: no single fix closes the class of vulnerability permanently, so platforms stack timer restrictions, memory layout randomization, sandboxing, and anomaly-based isolation together, accepting that each layer raises the bar rather than eliminating risk outright.

Questions the Research Leaves Open

Cloudflare’s account gives a clear before-and-after for this specific gadget chain, but a few things are worth keeping in view. The 12 bit/s leak rate was measured under the research team’s own controlled conditions; how that figure would hold up against a live victim process handling real traffic and competing for the same cache resources is not detailed. The paper also does not indicate whether the underlying speculative type-confusion pattern generalizes to other V8 object types beyond TypedArray now that the V8 Sandbox has been integrated, so teams evaluating multi-tenant JavaScript isolation elsewhere should treat this as one documented instance of a broader technique class rather than a closed case.

For teams running or evaluating multi-tenant code execution platforms, the practical signal here is that isolation strategies built around behavioral detection, like DyPrIs’s approach of isolating malicious-looking scripts, benefit from being paired with structural memory-safety layers such as sandboxing, since detection-based defenses can have blind spots that only surface under adversarial, production-grade testing rather than idealized benchmarks.

Sources