Skip to content
Memory corruption Write-up Advanced

Escaping Adobe Sandbox: Exploiting an Integer Overflow in Microsoft Windows Crypto Provider

An integer overflow in the Windows RSA cryptographic provider library allowed a crafted opaque key blob to cause an out-of-bounds write when imported. An attacker with code execution inside the Adobe sandbox could use this to corrupt function pointers in the broker process and escape the sandbox to run arbitrary commands.

Michele Campa Follow

Published on blog.exodusintel.com

APRIL 6, 2023 Vulnerability Analysis, Exploit Techniques, General Research

Exodus Intel VRT, on blog.exodusintel.com

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 the length fields read from the key blob at offsets 0x10 and 0x14 are added together without overflow checks, so a huge value wraps around and the size check passes while the later copy still uses the large length.

Impact

An attacker who already has code execution in the Adobe sandbox could escape it and execute arbitrary commands with the broker's privileges, though ASLR and Control Flow Guard prevent a direct ROP chain and the described method bypasses CFG by abusing the provider dispatch design.

What the attacker needed

Code execution inside the Adobe sandbox; Adobe Reader in Protected Mode; crafted opaque key blob

How it was found

  1. Send a crafted opaque key blob longer than 0x70 bytes to the broker's CryptImportKey cross-call.
  2. Set the length fields in the blob so their sum overflows and the size check is bypassed.
  3. The broker allocates a small buffer but copies the large length into it, overwriting adjacent memory.
  4. Overwrite function pointers in neighbouring HCRYPTPROV objects in shared memory.
  5. Use the CryptGenRandom cross-call to confirm which object was corrupted.
  6. Overwrite CPReleaseContext with WinExec and trigger CryptReleaseContext to run commands.

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.

Programs like Adobe Reader open untrusted PDFs inside a restricted 'sandbox' so that a malicious file cannot harm the rest of the computer. A separate helper process, the broker, does limited tasks for the sandbox, including some cryptography. A maths mistake in the Windows crypto library meant a specially shaped key could make the broker write past the end of a memory buffer, letting an attacker who already broke into the sandbox take over the broker and run commands.

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 from Microsoft (Windows)

View all

The newest disclosed reports for this program.

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.