Skip to content
Write-up Intermediate

Hta Malware Analysis

An obfuscated HTA file hides a script that, when run, spawns PowerShell to download a remote .dat file, save it as an executable in the temp folder, and launch it. The attacker could thereby run arbitrary code on the victim's machine.

shamooo Follow

Published on infosecwriteups.com

In this writeup, we will be looking at an hta malware file, and see some of the deobfuscation techniques we can use to make sense of the obfuscated code. In other words, let’s do some good old-fashioned static malware analysis.

shamooo, on infosecwriteups.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 victim is tricked into opening an HTA file, which Windows executes with full script privileges, allowing the embedded script to launch PowerShell and download a payload.

Impact

The script could download and run an executable on the victim's machine, giving the attacker code execution.

What the attacker needed

Victim opens the HTA file; Windows with mshta.exe

How it was found

  1. Copy the obfuscated script into a file and beautify it.
  2. Rename the string variables and concatenate them.
  3. Rename the counter and increment variables in the while loop.
  4. Run the loop to print the deobfuscated payload.
  5. Read the payload to see it spawns PowerShell and downloads a file.

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.

An HTA file is a Windows file that runs script like a small program when opened. This one hides its real code by mixing in junk characters, and once cleaned up it tells Windows to download another file from the internet and run it, which lets the attacker control the computer.

More by shamooo

View all

6 more disclosed reports, best first.

Similar reports

Same bug class and techniques, clearest first.