Researchers Show Spectre Can Still Bite in Cloudflare Workers
Cybersecurity researchers have disclosed details of a remote Spectre attack against Cloudflare Workers that leaked a JSON Web Token (JWT) from a co-located Worker in the production environment at up to 12 bits per second. That’s 360 times the rate of an earlier attack demonstrated in 2021.
The end-to-end experiment used an attacker Worker and a victim Worker controlled by the researchers, both running on the same physical machine. The attack exploited speculative execution to leak the JWT — a credential used for authentication — in real time.
The findings, presented at a recent security conference, underscore that Spectre-class vulnerabilities remain a practical threat even in managed serverless platforms. The researchers achieved a leak rate of 12 bits per second, which might sound slow, but it’s enough to exfiltrate a typical JWT in under a minute.
How the Attack Works
The attack relies on the same fundamental flaw as the original Spectre: speculative execution. By tricking the CPU into executing instructions out of order, the attacker can access memory that should be off-limits.
In this case, the attacker Worker uses a timing side channel to read sensitive data from the victim Worker’s memory. The researchers demonstrated that the technique works reliably in Cloudflare’s production environment, not just in a lab.
The 2021 Baseline
Back in 2021, a similar attack was shown to leak data at just 0.033 bits per second. That was largely theoretical — too slow to be practical. The new attack’s 12 bits per second changes the calculus.
“At this rate, stealing a full JWT is not just possible but feasible within a short window,” the researchers noted in their paper.
Why This Matters for Cloudflare Users
Cloudflare Workers is a popular serverless platform used by millions of developers. If you’re running Workers that handle sensitive data — like JWTs, API keys, or user PII — this attack is a wake-up call.
The researchers emphasized that the attack requires co-location, meaning the attacker must land on the same physical server as the victim. Cloudflare’s isolation measures make this harder, but not impossible.
For developers, the practical takeaway is to avoid storing long-lived secrets in Worker memory. Rotate JWTs frequently and use short expiry times to limit the damage if a leak occurs.
Cloudflare’s Response and Mitigations
Cloudflare has acknowledged the research and implemented additional mitigations. The company has a history of hardening its platform against Spectre, but this new attack shows that the arms race is ongoing.
Mitigations include:
- Enhanced isolation between Workers on the same machine
- Randomized memory layouts to make timing attacks harder
- Ongoing monitoring for speculative execution anomalies
Cloudflare also advises users to follow best practices for secret management, such as using environment variables and avoiding hardcoded credentials.
Broader Implications for Serverless Security
This research isn’t just about Cloudflare. It highlights a broader issue: serverless platforms are not immune to CPU-level attacks. Any platform that runs untrusted code on shared hardware is potentially vulnerable.
Other providers like AWS Lambda and Google Cloud Functions face similar challenges, though they haven’t yet seen public demonstrations at this speed.
The researchers suggest that hardware-level fixes, like those in newer CPUs, are the long-term solution. Until then, software mitigations and vigilant secret management are the best defense.
What Developers Should Do Now
If you’re a Cloudflare Workers user, don’t panic — but do take action. Start by auditing your Workers for sensitive data in memory. Use short-lived JWTs and rotate them frequently.
Consider using Cloudflare’s built-in secrets management and avoid storing tokens in global variables. Also, keep an eye on Cloudflare’s security advisories for updates.
The 12 bits per second leak rate is a proof of concept, but it’s a serious one. As the researchers put it, “The era of dismissing Spectre as theoretical is over.”
For more on related topics, check out our coverage of Spectre mitigation strategies and serverless security best practices.