Cloudflare Workers Spectre Attack Leaks JWT From Co-Located Worker
Security researchers have demonstrated a remote Spectre-based side-channel attack against Cloudflare Workers that successfully leaked a JSON Web Token from a co-located Worker at speeds of up to 12 bits per second. Cloudflare says the issue has been mitigated and has added further isolation and scheduling defenses to its Workers platform.
Cybersecurity researchers have disclosed a new Spectre-based attack against Cloudflare Workers, demonstrating that a malicious Worker could extract sensitive information from another Worker running on the same physical infrastructure.
During the experiment, researchers were able to recover a JSON Web Token (JWT) from a co-located victim Worker in Cloudflare's production environment.
The demonstrated leakage rate reached approximately 12 bits per second, representing a major improvement over an earlier 2021 attack and showing that speculative-execution side channels remain relevant even in highly optimized cloud isolation environments.
What Is Spectre?
Spectre refers to a class of CPU vulnerabilities involving speculative execution.
Modern processors attempt to improve performance by predicting which instructions will be needed next and executing them before knowing whether those operations are actually required.
When a prediction is incorrect, the processor discards the speculative result.
However, certain side effects — particularly changes to CPU caches — may remain observable.
An attacker can analyze these timing differences to infer data that should otherwise be inaccessible.
Cloudflare itself describes Spectre as a class of attacks in which malicious code can cause a CPU to speculatively process protected data and later infer that information through microarchitectural side effects such as cache behavior.
Why Cloudflare Workers Are an Interesting Target
Cloudflare Workers is a serverless edge-computing platform that allows customers to execute JavaScript and other workloads close to users around the world.
To achieve extremely high density and low latency, Cloudflare uses the V8 JavaScript engine's isolate model.
Multiple Workers belonging to different customers can therefore execute inside the same process while remaining logically separated by V8 isolates.
This architecture provides substantial performance advantages.
However, shared physical processors create a potential problem for microarchitectural attacks.
While software isolation can prevent one Worker from directly accessing another Worker's memory, both workloads may still interact indirectly with shared CPU components such as caches.
Spectre attacks attempt to exploit precisely this type of shared hardware behavior.
Researchers Successfully Extracted a JWT
According to the disclosed research, the attack was able to leak a JWT belonging to another Worker running on the same underlying infrastructure.
JWTs are frequently used for:
- User authentication
- API authorization
- Session management
- Identity claims
- Service-to-service authentication
If an attacker obtains a valid token, the impact depends on the token's permissions and expiration time.
In some environments, a stolen JWT could potentially allow an attacker to impersonate a user or service until the token is revoked or expires.
The important part of the demonstration is therefore not only the specific JWT recovered during testing.
It shows that cross-tenant data extraction through speculative execution remained technically possible under certain conditions.
12 Bits Per Second
The researchers reportedly achieved data leakage rates of up to 12 bits per second.
Although that may initially sound slow, side-channel attacks do not necessarily require high bandwidth.
Credentials, tokens, cryptographic material, and other sensitive secrets can be comparatively small.
A short authentication token may therefore be more valuable to an attacker than large amounts of ordinary application data.
The demonstrated rate was reportedly around 360 times faster than an earlier 2021 attack, illustrating continuing advances in speculative-execution exploitation techniques.
Cloudflare's Existing Spectre Defences
Cloudflare Workers was designed with Spectre-style threats in mind.
One of its most important defensive choices is preventing Workers from obtaining sufficiently precise local timing measurements.
For example, Cloudflare documents that Date.now() does not continuously advance while Worker code executes.
Workers also do not receive unrestricted concurrency features that could easily be converted into high-resolution timers.
This is important because many cache-based side-channel attacks depend on accurately measuring extremely small differences in execution time.
Removing reliable high-resolution timers makes exploitation significantly more difficult.
Cloudflare Adds More Defense-in-Depth
Cloudflare says it has mitigated the demonstrated attack and continues to strengthen the Workers runtime.
Its updated security approach includes additional defence-in-depth mechanisms, including rescheduling Workers in ways intended to increase isolation between potentially suspicious workloads and higher-value workloads.
Cloudflare is also collaborating with researchers from Graz University of Technology (TU Graz), including researchers associated with the original discovery of Spectre, to further evaluate the Workers architecture and its protections against speculative-execution attacks.
Why Secrets Matter in Serverless Environments
Cloudflare Workers can store sensitive values such as API keys and authentication tokens through encrypted Secrets bindings.
Cloudflare recommends using Secrets rather than plaintext variables for sensitive information.
Secrets can be made available to Worker code through the Worker environment while remaining hidden from the dashboard and Wrangler tooling after configuration.
Cloudflare also offers a centralised Secrets Store for account-level secrets, encrypted and distributed across its infrastructure.
However, secret-management systems mainly protect credentials at rest and during normal application access.
A successful microarchitectural attack presents a different challenge because it targets information while it is being processed by a CPU.
The Broader Cloud Security Problem
Spectre-style vulnerabilities are particularly important for cloud platforms because cloud computing depends heavily on sharing physical hardware among multiple customers.
A modern cloud server may simultaneously execute workloads belonging to many unrelated organisations.
Traditional isolation relies on mechanisms such as:
- Virtual machines
- Containers
- Sandboxes
- Processes
- Language runtimes
- V8 isolates
These technologies can provide strong logical separation.
But speculative-execution attacks operate below much of this software stack.
They exploit shared CPU behaviour.
This means cloud providers must defend against attacks not only at the operating-system and application layers but also at the microarchitectural level.
Analysis and context
This research demonstrates why Spectre remains one of the most important architectural security problems introduced by modern processor design.
The vulnerability is unusual because it does not fit neatly into traditional software-security categories.
There may be:
- No buffer overflow
- No SQL injection
- No stolen password
- No directly readable memory
- No obvious privilege escalation
Instead, sensitive information can potentially be reconstructed from extremely small physical side effects produced by CPU execution.
That makes Spectre particularly difficult to eliminate completely.
Isolation Does Not Always Mean Physical Separation
One of the key lessons from this research is the distinction between logical isolation and physical isolation.
Two applications can be completely separated at the software level while still sharing:
- CPU cores
- Cache hierarchy
- Branch prediction resources
- Memory subsystems
- Other microarchitectural components
Serverless platforms amplify this challenge because their economics depend heavily on efficiently running large numbers of workloads on shared infrastructure.
Cloudflare's V8 isolate architecture is an excellent example.
It offers extremely fast startup times and high workload density compared with deploying an individual virtual machine for every Worker.
But greater density also means security engineers must consider increasingly subtle cross-tenant side channels.
Removing Timers Is a Clever Defense
Cloudflare's decision to restrict timing information inside Workers is particularly interesting.
Many side-channel attacks require the attacker to answer one basic question:
How long did this operation take?
If the attacker can measure differences at nanosecond or microsecond resolution, CPU cache state may leak useful information.
Removing accurate timers makes that measurement substantially harder.
This represents an important security principle:
Sometimes the safest API is the API you do not expose.
Cloudflare was able to make these architectural choices because Workers was designed as a new runtime rather than being forced to maintain compatibility with every browser or operating-system API.
Defense in Depth Is More Realistic Than a Single Fix
Spectre is unlikely to disappear through one software patch.
The more realistic approach is combining multiple controls:
Timer restrictions
Reduce the attacker's ability to measure cache effects.
Workload scheduling
Avoid repeatedly placing suspicious and sensitive workloads together.
Process and runtime isolation
Limit direct memory access between tenants.
Hardware mitigations
Use processor-level protections where available.
Secret rotation
Reduce the useful lifetime of stolen credentials.
Short-lived authentication tokens
Limit the damage if a token is exposed.
Monitoring
Detect workloads exhibiting behavior associated with side-channel research or exploitation.
This is a classic defense-in-depth strategy.
JWT Design Matters Too
The fact that researchers demonstrated the attack using a JWT also reinforces another security principle.
Authentication tokens should not be considered permanently trustworthy simply because they were issued securely.
Organizations should reduce the consequences of token theft through:
- Short expiration times
- Narrow scopes
- Audience restrictions
- Key rotation
- Token revocation where possible
- Minimal privileges
A stolen token containing broad privileges and a long lifetime is significantly more dangerous than a narrowly scoped token valid for only a few minutes.
Cloud Security Is Increasingly Hardware Security
For many years, cloud security discussions focused primarily on:
- IAM
- Network configuration
- API security
- Containers
- Kubernetes
- Misconfigured storage
- Credentials
Spectre demonstrates that cloud security increasingly extends all the way down to processor architecture.
As cloud platforms become more multi-tenant and infrastructure density increases, hardware-level isolation becomes just as important as application-level isolation.
The Cloudflare Workers research therefore should not be interpreted simply as a vulnerability in one serverless product.
It illustrates a broader reality:
In multi-tenant cloud computing, the CPU itself is part of the security boundary.