Skip to content
Memory corruption Write-up Advanced

How I hacked my way to the top of DARPA’s hardware bug bounty

The researcher found flaws in secure hardware prototypes: in MIT's Sanctum, a thread from one enclave could run inside another, and an integer overflow in mailbox handling allowed memory overwrite; in CHERI, a realloc metadata leak exposed capability pointers, and a missing capability check in async I/O enabled buffer overflows. These allowed bypassing the hardware protections to execute arbitrary code or read enclave memory.

Malcolm Stagg Follow

Published on readme.security

When the Defense Advanced Research Projects Agency (DARPA) announced in the summer of 2020 that it was having its first-ever bug bounty to test the defenses of its System Security Integration Through Hardware and Firmware (SSITH) program, I knew I had to be part of it. Previously, I did some hardware research…

Malcolm Stagg (@malcolmst), on readme.security

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely missing validation and checks in firmware and kernel code, such as not verifying enclave thread ownership, integer overflow in mailbox count, not erasing metadata during realloc, and not checking buffer capabilities in AIO.

Impact

The attacks could bypass hardware protections to execute arbitrary code and obtain decrypted enclave contents, and in CHERI, leak capabilities and cause buffer overflows, though the researcher wrote intentionally vulnerable programs to demonstrate them.

What the attacker needed

Access to DARPA SSITH hardware; ability to load kernel modules; knowledge of hardware architecture

The fix

The vulnerabilities were fixed by the vendors, as the researcher notes they responded and sent patches.

How it was found

  1. Wrote a Loadable Kernel Module to interact with Sanctum's Security Monitor API.
  2. Reviewed MIT's open-source code for enclaves and Security Monitor.
  3. Created two enclaves: first normally for valid signature, second with exploit as thread entry point.
  4. Ran the attack thread from the second enclave inside the first enclave.
  5. For integer overflow: created an enclave with a huge number of mailboxes to trigger overflow.
  6. Sent a message to an out-of-bounds mailbox to overwrite memory, then brute-forced a byte to make attack thread persistent.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This is about testing new hardware designs that aim to stop common attacks like buffer overflows. The researcher wrote small programs to find mistakes in how the hardware enforces memory safety, and showed that some protections could be bypassed. Terms: enclave is a protected memory region; capability is a hardware-enforced pointer with bounds.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Malcolm Stagg

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.