Skip to content
RCE Write-up Advanced

LethalHTA - A new lateral movement technique using DCOM and HTA

A new lateral movement technique abuses the 'htafile' COM object to load and execute an HTA file on a remote machine. An attacker can run arbitrary script code in the context of mshta.exe, bypassing a marshalling validation check.

Unknown Follow

Published on codewhitesec.blogspot.com

The following blog post introduces a new lateral movement technique that combines the power of DCOM and HTA. The research on this technique is partly an outcome of our recent research efforts on COM Marshalling: Marshalling to SYSTEM - An analysis of CVE-2018-0824.

Unknown, on codewhitesec.blogspot.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 COM object's IPersistMoniker interface allows loading a remote HTA file, and the URLMoniker marshalling validation can be bypassed by a fake object that changes the destination context parameter.

What the attacker needed

Access to a remote COM object; ability to host an HTA file; target runs mshta.exe

How it was found

  1. Create a fake object that implements IMarshal and IMoniker and forwards calls to a URLMoniker.
  2. Modify the dwDestContext parameter to MSHCTX_NOSHAREDMEM in the marshalling methods to bypass validation.
  3. Call IPersistMoniker->Load() on the remote COM object with the URLMoniker pointing to an HTA file.
  4. The COM object in mshta.exe loads and evaluates the HTA file, executing script code.

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 a way to run code on another computer in a network. The attacker uses a built-in Windows feature that normally opens web pages to instead run a malicious script file, and they trick a security check to make it work remotely.

What is RCE?

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

More by Unknown

View all

32 more disclosed reports, best first.

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.