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.
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.
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
- Create a fake object that implements IMarshal and IMoniker and forwards calls to a URLMoniker.
- Modify the dwDestContext parameter to MSHCTX_NOSHAREDMEM in the marshalling methods to bypass validation.
- Call IPersistMoniker->Load() on the remote COM object with the URLMoniker pointing to an HTA file.
- 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.