Skip to content
RCE Write-up Advanced

First Look

A malicious Word document used an external OLE relationship with the MHTML protocol to load attacker-controlled HTML, which executed JavaScript inside Word and abused ActiveX and CAB extraction to run code. The write-up also documents a separate relative-path escape in CAB/INF handling and a hardcoded 4096-byte read size in Microsoft's HTML engine that broke small payloads.

billdemirkapi.me

Published on billdemirkapi.me

In the middle of August 2021, a special Word document was uploaded to VirusTotal by a user from Argentina. Although it was only detected by a single antivirus engine at the time, this sample turned out to be exploiting a zero day vulnerability in Microsoft Office to gain remote code execution.

The author, on billdemirkapi.me

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 a chain of flaws: the MHTML protocol handler let document-embedded content execute script, CAB extraction allowed relative path escapes when verifying an INF signature, and a hardcoded 4096-byte read size in the HTML engine terminated smaller responses.

Impact

Opening the document could lead to remote code execution, though the write-up notes the original payload was only detected by one antivirus engine and the domain was already down.

What the attacker needed

Victim opens a malicious document; attacker hosts HTML and CAB files; document placed in Downloads folder

The fix

Microsoft published a patch for the vulnerability after being notified by researchers.

How it was found

  1. Open the malicious Word document while monitoring network traffic
  2. Observe the request to the remote side.html page
  3. Extract the document as a ZIP and locate the URL in the relationships file
  4. Replace the relationship target with a self-hosted page
  5. Open the modified document and watch for the CAB file request
  6. Place the document in the Downloads folder so the relative path escapes reach the payload

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.

A Word file can quietly pull in a web page and run its script, and that script can then ask Windows to load a signed-looking package. The package was unpacked carelessly, letting a file escape its temporary folder, and a second trick launched that file as a program. The result is that simply opening the document could run the attacker's code.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.