Remote Spectre Attack Leaks JWT From Cloudflare Workers at 12 Bits Per Second

Cybersecurity researchers have demonstrated a remote Spectre attack against Cloudflare Workers that was able to leak a JSON Web Token from a co located Worker at speeds of up to 12 bits per second.

The research was conducted using an attacker controlled Worker and a victim Worker controlled by the researchers. The JWT was intentionally placed in the victim Worker's memory to demonstrate the potential impact.

The researchers said the experiment did not access customer data.

Cloudflare has already deployed mitigations in its production environment. The company said it found no evidence of active exploitation during the past three years.

How the Attack Works

Cloudflare Workers allows code from multiple customers to run in separate V8 isolates within the same operating system process.

This architecture helps reduce startup latency, but it means multiple isolated Workers can share the underlying process and hardware resources.

The researchers demonstrated that speculative execution side channels can potentially be used to leak information from another Worker when the attacker and victim are placed in separate V8 isolates within the same process.

The attack does not require native code execution, a V8 vulnerability, or a sandbox escape.

WebSockets Helped Create a Remote Timing Channel

One of the main challenges with remote Spectre attacks is obtaining a sufficiently precise timing source.

Cloudflare restricts local timing sources by freezing or reducing timer precision during CPU execution. Worker scripts also do not have access to shared memory or traditional multithreading.

Researchers discovered that WebSocket communications could provide a remote timing signal.

They also used Durable Objects to keep a Worker isolate alive for extended periods, with individual isolates remaining active for approximately five to more than 20 hours.

This allowed the researchers to perform long running measurements required for the side channel attack.

Weaknesses in Dynamic Process Isolation

Cloudflare uses Dynamic Process Isolation, known as DyPrIs, to detect suspicious activity and move potentially malicious Workers into separate processes.

Researchers found that long running Durable Object executions could continue before the isolation mechanism was triggered.

They also discovered that WebSocket intensive input and output activity increased instruction translation lookaside buffer activity.

This reduced the branch misprediction signal monitored by DyPrIs and could prevent the system from reaching its detection threshold.

The researchers described these issues as fundamental limitations of the detection approach, while Cloudflare characterized the problem as a limitation in its DyPrIs implementation.

Attack Rate Increased Significantly

The researchers reported that the attack could leak information at speeds of up to 12 bits per second with 99.16% accuracy.

That represents a major improvement over the earlier remote Spectre attack demonstrated in 2021, which achieved approximately 2 bits per minute.

The researchers said system load affects the leakage rate. Higher CPU utilization reduced the speed of the attack, although slower leakage remained possible.

Testing was performed on Linux servers using AMD EPYC Zen 2 and Zen 3 processors. Researchers conducted measurements during periods of relatively low CPU utilization to observe the strongest possible results.

Cloudflare Deploys Additional Protections

Cloudflare said it has already improved its isolation architecture and deployed multiple additional protections.

These include:

Improved Dynamic Process Isolation

Cloudflare enhanced DyPrIs to improve its ability to detect suspicious speculative execution behavior.

V8 Sandbox

The V8 Sandbox limits transient access to 64 bit pointers and provides an additional layer of isolation between Worker environments.

Memory Protection Keys

Cloudflare also deployed Memory Protection Keys, or MPK, based in process isolation.

Worker heaps are placed behind hardware enforced protection keys. Cloudflare combines this mechanism with the V8 Sandbox and rotating memory layouts to reduce the possibility of cross isolate memory access.

No Evidence of Active Exploitation

Cloudflare said the issue has been mitigated in production and that it has found no indicators of active exploitation over the last three years.

The researchers also stated that their experiment was conducted in a controlled environment and did not involve accessing customer information.

The disclosure demonstrates that even when applications use language level isolation such as V8 isolates, hardware side channel attacks can potentially create paths for cross tenant information leakage.

Cloudflare's additional isolation mechanisms are designed to provide multiple layers of protection against these types of attacks.