DEV Community

qanzhi111
qanzhi111

Posted on Edited on

Taiko lost $1.7M to two mistakes that were each harmless alone

A $1.7M exploit usually has an obvious culprit: a reentrancy bug, a price oracle, a bridged token with an unbounded mint.

The Taiko bridge loss in July 2026 had none of those. No smart contract bug, no flash loan, no logic error in the bridge itself.

What it had was a signing key sitting in a public GitHub repository, and one attribute check missing from a contract that verified hardware attestations.

Either mistake alone was survivable. Together they cost $1.7M.

Cartoon: an SGX chip with a leaked signing key, a verifier form with DEBUG unticked, and a cheese wedge with holes

How the system was supposed to work

Taiko is an Ethereum L2 rollup that uses Intel SGX enclaves to verify state. The trust chain runs like this:

  1. Off-chain, an SGX enclave runs a registered program and produces a proof of L2 state.
  2. On-chain, a verification contract checks the SGX quote through Intel DCAP attestation.
  3. If the quote verifies, the L2 state is accepted and bridge funds can be released.

The assumption underneath all of it: if the SGX quote verifies, the enclave that produced it is the enclave we registered.

Intel's documentation is explicit that this assumption does not hold by itself. Attestation proves what the enclave is, not that it is running in a protected state. That gap between "verified" and "safe" is where the money went.

Hole one: the key was in a repository

The enclave signing key was committed to a public GitHub repository.

An SGX signing key is what makes a program's MRSIGNER value match a whitelist. Anyone holding that key can sign a SIGSTRUCT that makes their enclave look like Taiko's enclave. It is the master key to the trust root.

On its own, this is bad but not fatal. A signed enclave still has to pass attestation, and attestation, done correctly, would still catch the next problem.

Attestation was not done correctly.

Hole two: the DEBUG flag was never checked

The attestation contract, AutomataDcapV3Attestation, verified the quote but never inspected the enclave's ATTRIBUTES field.

Specifically, it did not check bit 0x02, the DEBUG flag.

When an enclave runs in debug mode, its memory is not protected. The host machine can read everything inside it, including any private keys the enclave generates or holds.

Intel's own guidance says verifiers must check enclave attributes to avoid issuing secrets to DEBUG enclaves. The contract skipped that check.

The attack chain

  1. Use the leaked signing key to sign a SIGSTRUCT. MRSIGNER now matches the Taiko whitelist.
  2. Run the enclave in debug mode. MRENCLAVE is unchanged, because the code is the same.
  3. Call registerInstance(). The quote passes verification because the contract never looks at the attributes.
  4. Read the instance private key directly out of the debug enclave's memory. This is not a break; it is the documented behaviour of debug mode.
  5. Sign a proof for L2 state that does not exist.
  6. L1 accepts it, and the bridge releases funds.

Result: approximately $1.7M drained.

Why this is the interesting kind of failure

Neither vulnerability is exploitable alone, and that is what makes the case worth studying.

  • Leak the key, but keep the attribute check: the attacker's enclave runs in debug mode, the check rejects it, and the forged MRSIGNER buys nothing.
  • Skip the attribute check, but keep the key secret: the attacker cannot make their enclave's MRSIGNER match the whitelist, so registration fails.

The two holes had to line up. One was a process failure, a secret in a repository. The other was an implementation failure, a verifier that did the cryptographic half of its job and not the semantic half.

Security people call this the Swiss cheese model: every layer has holes, and misfortune is the day the holes line up. In software, the layers are written by the same team on the same schedule, which makes alignment much easier than the model suggests.

A pattern, not an accident

This was not an isolated oddity. June and July 2026 produced a run of losses where the cryptographic primitive worked exactly as designed and the system around it did not:

  • JaredFromSubway: $15M. "The signature looks valid."
  • Aztec Connect: $4.3M. "The ZK proof verifies."
  • SecondFi: $2.4M. "The Ed25519 signature is correct."
  • Taiko: $1.7M. "The SGX quote attests."

Four systems, four valid cryptographic results, four broken assumptions about what those results meant.

The common thread is that verification was treated as a binary: either the check passes or it does not. But these checks answer narrow questions. Is this signature mathematically valid is not is this the right signer. Does the quote attest is not is the attested environment safe to give secrets to.

Every one of those four losses came from the gap between the question the check answers and the question the system assumed it answered.

If you run anything TEE-based, this is the checklist

  • Verify MRENCLAVE, so the code identity matches.
  • Verify MRSIGNER, so the signer matches.
  • Verify ISVPRODID and ISVSVN, so version rollback is caught.
  • Reject the DEBUG attribute in production, unconditionally.
  • Never keep signing keys in a code repository. Any repository. Ever.
  • Treat a passing attestation as one input, not as a conclusion.

Valid remote attestation does not mean secure runtime. It means the enclave told the truth about what it is. Whether that truth is good enough for your threat model is a decision the contract has to make explicitly, in code, by checking the fields nobody enjoys writing tests for.

The full chain of events, transaction hashes included, is in the case file. If you are building on SGX, read the attribute-checking section twice, then go look at your own verifier.


This is one of 61 on-chain case investigations, indexed at qanzhi111.github.io/intel.

Top comments (0)