Skip to main content
Home/Case Studies/The 'SOC 2 Compliant' Breach
INCIDENT POST-MORTEM & ZERO-TRUST RESCUE

The 'SOC 2 Compliant' Breach: How an SSRF-to-IMDS Pivot Bypassed the WAF and Stole the JWT Signing Key in 4 Minutes

They had a clean SOC 2 Type II audit report, a $150k/yr Cloudflare Enterprise WAF, and green lights on Datadog. An attacker slipped past the WAF with an IPv6-mapped address, reached a forgotten IMDSv1 endpoint, pivoted through over-permissive IAM into an unauthenticated Redis cache, and extracted the JWT signing key in 252 seconds. Here is how we contained it before any customer data left, deployed eBPF kernel enforcement, and rebuilt their zero-trust architecture.

HawkInspect Pro Incident Response & Kernel Security Core
•16 min technical teardown•ZERO-TRUST REVOLUTION & KERNEL INCIDENT RESPONSE
Compromise Time4m 12sFirst Request to Signing Key
Enterprise WAF Alerts0 FiredLooked like legitimate traffic
Customer Records Exfiltrated0 RecordsVerified in flow & query logs
eBPF Syscall Latency< 0.18msZero customer degradation
THE 4-MINUTE CASCADE

1. The Incident: A Green Audit, Zero Alerts, and a Complete VPC Breach

Twenty-four days before our red-team emergency engagement, a high-growth Series B FinTech platform handling $120M in annualized transactions received their official SOC 2 Type II attestation report from an accredited auditor. All 68 controls were marked as green. Their enterprise web application firewall (WAF) was configured to block known OWASP injection vectors. Their Datadog SIEM ingested over 1.2 terabytes of application logs daily.

At 02:14:18 UTC on a Thursday morning, an adversary initiated an exploit sequence through an innocuous public endpoint: an automated PDF invoice generator accepting a customer brand logo via `POST /api/v1/invoices/generate`.

By 02:18:30 UTC — exactly 4 minutes and 12 seconds later — the attacker held the application's RSA private signing key, a shell inside the VPC, and a forged superadmin token, and was positioned to start exfiltrating data on 420,000 corporate bank accounts.

Not a single threshold alert was triggered on their Datadog dashboard. The SIEM showed green. The WAF showed green. The compliance officer slept soundly.

Anatomy of the 252-Second Intrusion:

T+00:00
Ingress Probe:Attacker sends invoice generation payload with a custom `logo_url` parameter pointing to an external DNS canary token.
T+00:45
WAF Bypassed via Dual-Stack IPv6:The WAF regex blocked `169.254.169.254`. The attacker provided an IPv6-mapped IPv4 literal (`http://[::ffff:a9fe:a9fe]`). Neither the WAF nor the app's string check matched it, but Chromium connected to it as the same metadata address.
T+01:20
IMDSv1 Credential Theft:The PDF worker ran from an older launch template with `http-tokens: optional`, so IMDSv1 still answered plain GET requests. Chromium fetched the instance role's temporary credentials and printed them into the invoice PDF returned to the attacker.
T+02:15
VPC Lateral Movement:The stolen role still carried leftover SSM and ElastiCache permissions. The attacker ran a shell command on the PDF worker through SSM and, from inside the VPC, read the password-less Redis cluster (`10.0.14.22`), where the application cached the JWT RSA private key in plaintext for microservice performance.
T+04:12
Universal SuperAdmin Forgery:The attacker minted a valid JWT with `role: "superadmin"`, `tenant_id: "*"`, and `sub: "internal_system_audit"`. Because the signature was valid, every downstream microservice accepted it; none checked whether a superadmin with tenant `*` could legitimately exist.
THE BRUTAL REALITY

2. The Illusion of Compliance: Why Your $150,000 WAF and SOC 2 Report Failed

Corporate security departments operate under a fatal delusion: they mistake compliance for security.

A SOC 2 report is an attestation from a CPA firm that tells your customers your security controls exist and, for Type II, operated over a review period. It verifies that you have a password policy, that employees complete annual phishing modules, and that you have a documented change-management Jira workflow. It does not verify whether your Linux kernel permits arbitrary `connect()` syscalls to `169.254.169.254`. It does not test whether an unsegmented VPC allows a frontend rendering container to query your private Redis cache.

Let us be unmistakably clear about the three systemic architectural lies that modern security teams purchase every year:

Lie #1: "Our Cloud WAF Protects Our APIs from Injection"

WAFs operate in userspace at Layer 7 by matching regex strings against inbound HTTP bodies. They understand basic SQL injection strings like `' OR '1'='1`. They are completely blind to protocol translation anomalies. When an attacker encodes an IP as a decimal (`2852039166`), an octal (`0251.0376.0251.0376`), or an IPv6-mapped bracket, the string never matches the WAF's pattern. The backend then normalizes it back into the link-local metadata address 169.254.169.254 (Chromium and the WHATWG URL parser behind Node's fetch both do this), making the WAF rule useless.

Lie #2: "Our Private Subnet (VPC) Isolates Our Backend"

Traditional network engineers believe putting Redis, PostgreSQL, and microservices inside a "private subnet" constitutes security. In reality, once an attacker achieves a single blind SSRF or remote code execution (RCE) on a single edge service, they are already inside the perimeter. Inside the VPC, microservices communicate over unencrypted HTTP, trust IP addresses implicitly, and leave caching tiers unauthenticated. Perimeter security without Zero-Trust is a hard eggshell with a liquid center.

Lie #3: "AWS RDS Encryption at Rest Protects Our Data"

RDS "encryption at rest" protects against a single threat: someone walking into an AWS data center in Virginia, unscrewing a physical NVMe hard drive, and running away with it. If an attacker extracts database credentials or uses an IAM role with RDS connect permissions, AWS transparently decrypts every single record on the fly. Without client-side KMS Envelope Encryption, encryption-at-rest is marketing theater.

THE EXPLOIT MECHANICS

3. The Exploit Chain: Dual-Stack SSRF to a Forgotten IMDSv1 Endpoint

AWS IMDSv2 does stop this kind of SSRF: a session token requires a `PUT` request with the `X-aws-ec2-metadata-token-ttl-seconds` header, which a URL-fetching browser cannot send, and a hop limit of 1 keeps containers from reaching it at all. The client believed IMDSv2 was enforced everywhere. It was enforced everywhere except one place.

The invoice generator ran on a separate worker fleet built from an older launch template with `http-tokens: optional`, so IMDSv1 still answered plain `GET` requests. It used headless Chromium (Puppeteer) to render PDFs and loaded the customer's `logo_url` directly as a page. Given `http://[::ffff:a9fe:a9fe]/latest/meta-data/iam/security-credentials/`, Chromium fetched the role's temporary credentials and rendered them into the PDF it sent back.

VULNERABLE CODE
vulnerable_invoice_service.ts

// FLAW: Trusting user-supplied URL and letting backend fetch it blindly

export async function renderInvoicePdf(req, res) {

const { logoUrl, companyName } = req.body;

// Flawed regex: only checks for literal "169.254.169.254" string

if (logoUrl.includes('169.254.169.254')) {

throw new Error("Security block!"); // BYPASSED BY IPv6 DUAL-STACK

}

// Headless Chromium loads whatever URL it is given

const browser = await puppeteer.launch();

const page = await browser.newPage();

await page.goto(logoUrl); // IMDS CREDENTIALS RENDERED INTO THE PDF

}

THE LATERAL TRAVERSAL

4. Lateral Movement: How Implicit VPC Trust Handed Over the Signing Keys

Once the IAM role credentials (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`) were exfiltrated from the IMDS endpoint, the adversary inspected the role's attached IAM policies.

The policy violated the principle of least privilege: someone had attached `AmazonSSMFullAccess` and `AmazonElastiCacheReadOnlyAccess` during a debugging sprint 8 months prior.

Using the AWS CLI, the attacker listed the internal ElastiCache endpoint (`cache-cluster.internal.vpc:6379`), then used `aws ssm send-command` to run a shell command on the PDF worker itself, which put them inside the VPC. From there, `redis-cli` connected without a password: Redis AUTH had never been enabled because the engineers believed "it is only accessible from inside the private VPC."

Inside Redis key `auth:jwt:signing_key:v2`, the attacker found the unencrypted RSA-2048 private key. In under 30 seconds, they generated an asymmetric signature for an admin JWT that granted universal access across all API gateways.

THE EMERGENCY INTERVENTION

5. The Containment: Revoke, Rotate, and Enforce at the Kernel with eBPF Tetragon

When HawkInspect Pro received the triage distress call at 02:29 UTC, our primary directive was: Achieve immediate blast-radius containment without taking the application offline or disrupting paying users.

First we cut the attacker off: revoke the stolen credentials, rotate the signing key, close the egress path. Then, instead of waiting for a 45-minute CI/CD build to patch the PDF worker, we enforced the fix at the Linux kernel layer using eBPF and Tetragon, which sees the real destination address after any URL parsing.

LIVE KERNEL PROBE
tetragon_kernel_security_policy.yaml

# Tetragon policy: kill any worker process that connects to instance metadata

apiVersion: cilium.io/v1alpha1

kind: TracingPolicy

metadata:

name: "block-imds-from-workers"

spec:

kprobes:

- call: "tcp_connect"

syscall: false

args:

- index: 0

type: "sock"

selectors:

- matchArgs:

- index: 0

operator: "DAddr"

values:

- "169.254.169.254" # IPv4 IMDS (decimal/octal spellings resolve here)

- "::ffff:169.254.169.254" # IPv6-mapped form used in this attack

- "fd00:ec2::254" # IPv6 IMDS endpoint

matchActions:

- action: Sigkill # process killed before the connection completes

Containment Achieved in 38 Minutes:

At 02:33 UTC, four minutes after the call, the client's on-call engineer (on our instruction) revoked the instance role's active sessions, removed the leftover SSM and ElastiCache permissions, and cut the PDF worker's outbound internet route. We then rotated the JWT signing key, which invalidated the forged superadmin token. By 03:07 UTC, 38 minutes after the call, the Tetragon policy was running on every worker node and every instance required IMDSv2 with a hop limit of 1. When the attacker came back through the same PDF endpoint at 03:11, the kernel killed the Chromium process before its connection completed. VPC Flow Logs and database query logs confirmed the attacker never started a bulk export: no customer records left the VPC.

THE ARCHITECTURAL OVERHAUL

6. Architectural Rebuild: KMS-Held Keys, Envelope Encryption & SPIFFE Workload Identity

Emergency containment stops the hemorrhage. Rebuilding the architecture means that the next time one worker is compromised, it no longer opens the rest of the network.

Over the next 72 hours, we deployed the complete HawkInspect Pro Zero-Trust Cloud Blueprint:

PILLAR 01

Client-Side KMS Envelope Encryption

Eliminated reliance on RDS disk encryption. Sensitive database fields (account numbers, routing data, PII) are encrypted at the client level using per-record AES-256-GCM Data Encryption Keys (DEKs) generated by AWS KMS, whose HSMs are FIPS 140-3 validated. Only the KMS-encrypted copy of each DEK is stored. An attacker dumping the PostgreSQL database only obtains cryptographically random ciphertext.

PILLAR 02

Cryptographic SPIFFE/SPIRE Workload Identity

Destroyed implicit VPC IP trust. Every microservice gets a SPIFFE ID with short-lived X.509 SVIDs rotated hourly, and service-to-service calls require mutual TLS (TLS 1.3) through Envoy sidecars. ElastiCache does not support client-certificate auth, so Redis now requires in-transit TLS plus per-service AUTH credentials, and the JWT signing key moved out of Redis into AWS KMS, where it can sign tokens but can never be exported.

PILLAR 03

Strict Envoy Egress SNI Allowlisting

Blocked unrestricted outbound internet connectivity across all subnets. All external requests must traverse an egress proxy enforcing a strict domain allowlist (`api.stripe.com`, `api.sendgrid.com`). Reverse shells and C2 exfiltration attempts are dropped instantly.

PILLAR 04

Read-Only Root Filesystems & Seccomp-BPF

Hardened container runtimes with `readOnlyRootFilesystem: true`, non-root execution (UID 10001), and a customized Seccomp-BPF syscall filter. The PDF worker image contains Chromium and nothing else: no shell, no package manager. Even with code execution inside the container, an attacker cannot write binaries to disk or gain new privileges.

07 // FINAL POSTMORTEM

07. The Unvarnished Post-Mortem & The Question Every CTO Must Ask

Not Cloudflare's fault. Not Datadog's fault. Not AWS's fault.

The vulnerability was an Architectural Perimeter Fallacy that assumed private VPC subnets are secure and treated compliance certifications (SOC 2) as actual defense.

BEFORE: The Corporate Compliance Checklist Architecture

// FLAW: Implicit internal trust const redis = new Redis("cache-cluster.internal.vpc:6379"); // Anyone inside the VPC reads raw JWT private keys const jwtPrivateKey = await redis.get("jwt_private_key");

Implicit VPC trust, plaintext microservice communication, unauthenticated Redis caches, and reliance on userspace WAF regex filters.

AFTER: HawkInspect Pro Zero-Trust & eBPF Kernel Architecture

// HARDENED: envelope encryption with AWS KMS (FIPS 140-3 HSMs) const { Plaintext: dataKey, CiphertextBlob: encryptedKey } = await kms.generateDataKey({ KeyId: process.env.KMS_KEY_ARN, KeySpec: 'AES_256' }); const ciphertext = aesGcmEncrypt(dataKey, rawDataBuffer); // encrypt locally dataKey.fill(0); // plaintext key is never stored // Store ciphertext + encryptedKey. Reading it back requires kms:Decrypt.

mTLS (TLS 1.3) workload identity, signing keys held in KMS, client-side envelope encryption, and kernel-level eBPF enforcement.

01

A Compliance Report Is Not a Penetration Test

Never confuse passing a SOC 2 audit with being secure. SOC 2 shows your controls exist and operate; it does not test whether an SSRF-prone endpoint can reach your instance metadata.
02

Assume the Edge Is Already Compromised

If an adversary gaining access to a single frontend worker allows them to talk to your database or cache in plaintext, your architecture is already broken.
03

Enforce Below the Application Where You Can

String filters in WAFs and app code can be evaded with encoding tricks. Kernel-level policies see the real destination after parsing, which makes them a much harder layer to talk your way past.
THE $120M QUESTION FOR FOUNDERS & ENGINEERING LEADS:

"If an attacker achieved an arbitrary SSRF in your PDF generator tonight, what stops them from reading your internal Redis cache within 4 minutes?"

If the answer is "our security group rules" or "we have a Cloudflare WAF," you are running on borrowed time. Talk to engineers who understand kernel-level reality.
FORWARD THIS INCIDENT TEARDOWN TO YOUR CTOURGENT AUDIT CHECK

Have your engineering leadership review this exploit path against your current AWS/GCP infrastructure before your next funding round or customer compliance review:

DO NOT WAIT FOR AN UNANNOUNCED ZERO-DAY BREACH

Schedule an Adversarial Zero-Trust Architecture Audit

Have senior red-team architects audit your cloud infrastructure, eliminate SSRF/BOLA vectors, and deploy eBPF kernel defenses under strict mutual NDA.