Skip to main content
Spectre Attack Leaked Cloudflare JWT at 12 Bits/SecondIncident
4 min readFor Security Engineers

Spectre Attack Leaked Cloudflare JWT at 12 Bits/Second

What Happened

Researchers executed a Spectre attack against Cloudflare Workers, extracting a JSON Web Token (JWT) from a co-located worker process at 12 bits per second. The attack exploited speculative execution vulnerabilities in AMD EPYC Zen 2 and Zen 3 processors, bypassing software-based isolation controls. Cloudflare's DyPrIs (Dynamic Process Isolation) system detected unusual behavior but didn't prevent the leak. The company has since enhanced memory protection using Memory Protection Keys (MPK) and improved V8 Sandbox controls. No customer data was compromised during the research disclosure.

Timeline

The attack sequence followed this pattern:

  1. Attacker deployed a malicious worker on Cloudflare's shared infrastructure.
  2. Victim worker (containing the target JWT) ran on the same physical hardware.
  3. Attacker worker used Spectre techniques to read across process boundaries during speculative execution.
  4. Data exfiltration occurred at 12 bits per second.
  5. DyPrIs flagged anomalous behavior but couldn't block the attack in real-time.
  6. Researchers disclosed findings to Cloudflare.
  7. Cloudflare deployed MPK-based isolation and V8 Sandbox improvements.

Which Controls Failed or Were Missing

Software-based process isolation proved insufficient. DyPrIs relies on monitoring system calls and process behavior to detect isolation violations. It caught the attack's signature but couldn't prevent the initial leak because Spectre operates below the software layer, in the CPU's speculative execution pipeline.

Memory protection boundaries weren't hardware-enforced. Before MPK deployment, Cloudflare depended on software-level memory isolation between worker processes. Spectre attacks bypass these boundaries by tricking the CPU into speculatively executing code paths that access unauthorized memory, then extracting data through timing side channels.

V8 Sandbox hardening was incomplete. The JavaScript engine's sandbox is designed to prevent untrusted code from accessing host memory. The researchers found a path through V8's speculative execution behavior that allowed cross-process memory reads.

The 12 bits per second leak rate matters because it's fast enough to extract a typical JWT (roughly 1,000-2,000 bits) in 2-3 minutes. That's well within the lifespan of most session tokens.

What the Relevant Standards Require

ISO/IEC 27001:2022 Annex A.8.31 requires organizations to segregate information processing facilities. In multi-tenant environments, you must implement "sufficient isolation between tenants." Software-only isolation doesn't meet this bar when hardware vulnerabilities exist.

PCI DSS v4.0.1 mandates that cryptographic keys used to protect cardholder data are secured against unauthorized access. If you're storing JWTs that authorize access to payment data, a Spectre-based exfiltration represents a control failure. The requirement doesn't specify how to prevent unauthorized access, but "we have process isolation" isn't enough when researchers can demonstrate a bypass.

NIST 800-53 Rev 5 SC-3 states: "The information system isolates security functions from nonsecurity functions." The control enhancement SC-3(5) adds: "The information system implements underlying hardware separation mechanisms." This is the gap Cloudflare closed with MPK.

SOC 2 Type II CC6.6 requires logical access controls that restrict access to information assets. If your control description says "worker processes are isolated," but a Spectre attack can cross that boundary, your auditor should flag it as a design deficiency.

Lessons and Action Items for Your Team

1. Inventory Your Multi-Tenant Isolation Architecture

Map every point where untrusted code runs alongside sensitive data. This includes:

  • Serverless function platforms (Lambda, Cloud Functions, Workers)
  • Container orchestration with shared kernel namespaces
  • Database instances with multiple tenant schemas
  • Build pipelines where customer code executes

For each boundary, document whether isolation is hardware-enforced or software-only.

2. Implement Hardware-Based Memory Protection

If you run multi-tenant workloads on Intel or AMD processors, evaluate Memory Protection Keys. MPK lets you define memory domains and restrict access at the CPU level. This stops Spectre attacks because the hardware blocks unauthorized reads before speculative execution can leak data.

Check your processor support with cat /proc/cpuinfo | grep pku. If you see the flag, you can use MPK through Linux kernel 4.6+.

3. Tune Your Anomaly Detection for Spectre Signatures

DyPrIs detected the attack but couldn't prevent it. Your monitoring should flag:

  • Processes with unusual memory access patterns
  • JavaScript workers making repeated failed memory reads
  • Timing anomalies in code execution

Set alerts, but don't rely on detection alone. You need prevention.

4. Review JWT Lifetime and Scope

Even with perfect isolation, reduce your blast radius. Cloudflare's attacker extracted a JWT at 12 bits per second. Your action items:

  • Set JWT expiration to 5-15 minutes for high-value operations
  • Use refresh tokens stored in httpOnly cookies, not in worker memory
  • Scope tokens narrowly (one API endpoint, not your entire platform)
  • Rotate signing keys weekly

If an attacker needs 3 minutes to extract a token that expires in 5 minutes, they have a 2-minute window. That's better than a 24-hour window.

5. Update Your SOC 2 and ISO 27001 Control Descriptions

If your audit documentation claims "strong process isolation" without mentioning hardware protections, you're setting yourself up for a finding. Update your control narratives to:

  • Specify hardware-based isolation mechanisms (MPK, SGX, virtualization boundaries)
  • Acknowledge Spectre-class vulnerabilities as a known risk
  • Document compensating controls (short-lived tokens, anomaly detection)
  • Show evidence of patch management for CPU microcode updates

Your auditor will ask how you prevent side-channel attacks. "We haven't thought about it" is a worse answer than "We use MPK and 5-minute token lifetimes."

6. Test Your Isolation Under Adversarial Conditions

Cloudflare learned about this vulnerability through researcher disclosure. Don't wait for that. Run your own tests:

  • Deploy a malicious worker that attempts Spectre-style memory reads
  • Measure whether your monitoring catches it
  • Verify that hardware protections block the access
  • Document the results for your next audit

If you can't run this test yourself, hire a firm that specializes in side-channel attacks. Budget $15,000-$30,000 for a focused engagement.

The 12 bits per second number should worry you because it's not theoretical. Researchers proved they could extract real credentials from a production system. Your job is to make sure they can't do the same to yours.

Topics:Incident

You Might Also Like