222. That's How Adversaries Abuse PowerShell to Take Screenshots Quietly

Hello everyone!

We haven't talked about abusing PowerShell for some time. But let's do it again today as I spotted an interesting example. And we'll look at the following technique - Screen Capture (T1113).

Let's look at Efimer Trojan described in this report. The malware uses the following PowerShell command to capture screenshots:

powershell.exe -NoProfile -WindowStyle Hidden -Command "$scale = 1.25; Add-Type -AssemblyName System.Drawing; Add-Type -AssemblyName System.Windows.Forms; $sw = [System.Windows.Forms.SystemInformation]::VirtualScreen.Width; $sh = [System.Windows.Forms.SystemInformation]::VirtualScreen.Height; $w = [int]($sw * $scale); $h = [int]($sh * $scale); $bmp = New-Object Drawing.Bitmap $w, $h; $g = [Drawing.Graphics]::FromImage($bmp); $g.ScaleTransform($scale, $scale); $g.CopyFromScreen(0, 0, 0, 0, $bmp.Size); $bmp.Save(\'' + path.replace(/\\/g, '\\\\') + '\', [Drawing.Imaging.ImageFormat]::Png); ' + '$g.Dispose(); $bmp.Dispose();"

For example, we can use CopyFromScreen method to build our hunting query:

event_type: "processcreatewin"

AND

proc_file_path: "powershell.exe"

AND

cmdline: "CopyFromScreen"

See you tomorrow!

Comments

Popular posts from this blog

343. Ransomware Gangs Abuse SystemSettingsAdminFlows to Evade Defenses

391. Hunting for TeamPCP's Stealer

388. Ransomware Gang Abuses FTK Imager for Defense Evasion