Malware Hides PowerShell and mshta Behind Legitimate-Looking Windows Files

· Original article ↗

Summary

Huntress analyzed a malware foothold that mimicked a legitimate Windows task, used renamed mshta and PowerShell executables, and concealed commands in a fake log file. The payload could bypass AMSI and collect host information.

Key points

  • A malicious scheduled task closely imitated a legitimate Base Filtering Engine task, including its name and description.
  • The task used renamed copies of mshta.exe and powershell.exe, making the processes less likely to be noticed by name.
  • A file made to resemble an application log stored numeric values that the command converted into an executable PowerShell command.
  • The payload patched AMSI in memory when it detected CLR version 3 or later, then ran a downloader chain.
  • The final payload collected host details, including installed applications, IP addresses, and administrative privileges.

Article Details

Attack Vectors
  • A scheduled task named BfeOnServiceStartTypenChange launches renamed copies of mshta.exe and powershell.exe to execute an obfuscated PowerShell payload stored in C:\Windows\a.chk.
  • The payload checks for CLR version 3 or greater and patches AMSI in memory to bypass scanning.
  • Encoded commands and a secondary downloader retrieve further PowerShell commands and payloads.
  • The final payload collects information about installed applications, IP addresses, and administrative privileges on the compromised host.
Defensive Notes
  • Compare scheduled tasks with legitimate tasks on the host; the malicious task copied the name and description of BfeOnServiceStartTypeChange but used a different command.
  • Inspect task commands and executable paths for renamed copies of legitimate binaries, including mshta.exe and powershell.exe.
  • Review suspicious files presented as logs for encoded content and monitor for PowerShell decoding and execution.
  • Monitor for in-memory AMSI patching and unexpected PowerShell downloader activity.

MITRE ATT&CK