Detect Screen Capture in Elastic Security
Adversaries may attempt to take screen captures of the desktop to gather information over the course of an operation. Screen capturing functionality may be included as a feature of a remote access tool used in post-compromise operations. Taking a screenshot is also typically possible through native utilities or API calls, such as CopyFromScreen (.NET), xwd (Linux), or screencapture (macOS). Threat actors including Dragonfly, Gamaredon (Pteranodon), APT33 (TURNEDUP), Agent Tesla, and BlackEnergy have all used screen capture as part of post-compromise collection operations.
MITRE ATT&CK
- Tactic
- Collection
- Technique
- T1113 Screen Capture
- Canonical reference
- https://attack.mitre.org/techniques/T1113/
Elastic Detection Query
any where
(
/* Branch 1: Known screenshot utility executed from suspicious parent */
(
event.category == "process" and event.type == "start" and
(
process.name in~ ("scrot", "xwd", "import", "gnome-screenshot", "ksnapshot", "spectacle",
"screencapture", "psr.exe", "snippingtool.exe", "snipingtool.exe", "screenshot.exe", "xrandr") or
process.command_line : ("*CopyFromScreen*", "*GetDC*", "*BitBlt*", "*PrintWindow*",
"*xwd -root*", "*scrot *", "*screencapture *", "*xrandr --screenshot*")
) and
(
process.parent.name in~ ("cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe",
"mshta.exe", "regsvr32.exe", "rundll32.exe", "svchost.exe") or
not process.parent.name in~ ("explorer.exe", "userinit.exe", "svchost.exe", "winlogon.exe",
"taskmgr.exe", "dllhost.exe")
)
) or
/* Branch 2: Scripting engine invoking screenshot-related .NET or Win32 APIs */
(
event.category == "process" and event.type == "start" and
process.name in~ ("powershell.exe", "pwsh.exe", "cscript.exe", "wscript.exe", "mshta.exe") and
process.command_line : ("*CopyFromScreen*", "*System.Drawing.Graphics*",
"*System.Windows.Forms.Screen*", "*Graphics.CopyFromScreen*", "*PrintWindow*",
"*VK_SNAPSHOT*", "*keybd_event*", "*0x2C*")
) or
/* Branch 3: Image file created in staging/temp paths by non-UI processes */
(
event.category == "file" and event.type == "creation" and
file.path : ("*/tmp/*", "*/var/tmp/*", "*\\Temp\\*", "*\\AppData\\Local\\Temp\\*",
"*\\ProgramData\\*", "*\\Users\\Public\\*") and
(
file.name : "*.png" or file.name : "*.jpg" or file.name : "*.jpeg" or
file.name : "*.bmp" or file.name : "*.gif"
) and
not process.name in~ ("explorer.exe", "chrome.exe", "firefox.exe", "msedge.exe",
"iexplore.exe", "outlook.exe", "teams.exe", "slack.exe", "zoom.exe",
"mspaint.exe", "photoshop.exe", "gimp.exe") and
not process.name : "OneDrive*"
)
) Detects screen capture activity (T1113) across three behavioral branches using Elastic ECS process and file events: (1) known screenshot utilities such as scrot, xwd, psr.exe, screencapture launched from suspicious scripting parents; (2) scripting engines (PowerShell, cscript, wscript, mshta) invoking screenshot-related .NET or Win32 APIs including CopyFromScreen, PrintWindow, and VK_SNAPSHOT; (3) image files created in temp or staging directories by processes that are not expected UI or browser applications. Covers Windows, Linux, and macOS tooling.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate screen capture or recording software (Snagit, ShareX, Greenshot, OBS) spawned from automation scripts, scheduled tasks, or CI/CD pipelines that invoke screenshot APIs or write image files to temp paths
- IT remote support and RMM tools (TeamViewer, AnyDesk, ConnectWise) that capture screens for session recording and frequently launch from service or svchost parent processes
- PowerShell-based UI automation or test frameworks (Pester UI tests, Selenium PowerShell wrappers) used by QA or sysadmin teams that legitimately call System.Drawing.Graphics.CopyFromScreen
Other platforms for T1113
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Windows Screen Capture via PowerShell CopyFromScreen
Expected signal: Sysmon Event ID 1: Process Create — Image=powershell.exe, CommandLine containing 'CopyFromScreen', 'System.Drawing.Graphics', 'System.Windows.Forms.Screen'. Sysmon Event ID 11: File Create — TargetFilename=C:\Users\<user>\AppData\Local\Temp\df00tech-capture.png, Image=powershell.exe. PowerShell ScriptBlock Log Event ID 4104 with full script content. Sysmon Event ID 7: Image Load — gdi32.dll loaded by powershell.exe.
- Test 2Windows Screen Capture via PSR.exe (Problem Steps Recorder)
Expected signal: Sysmon Event ID 1: Process Create — Image=C:\Windows\System32\psr.exe, CommandLine containing '/start /output ... /sc 1 /maxsc 5'. Second Event ID 1 for the /stop invocation. Sysmon Event ID 11: File Create — TargetFilename ending in .zip in TEMP path, created by psr.exe. Security Event ID 4688 (if command line auditing enabled) for psr.exe execution.
- Test 3Linux Screen Capture via xwd (X Window Dump)
Expected signal: Linux auditd syscall log: execve syscall for xwd with arguments '-root -silent -out /tmp/df00tech-capture.xwd'. File creation event in /tmp/. Syslog entry if auditd is configured with -a always,exit -F arch=b64 -S execve rule. Process accounting record for xwd execution. /var/log/auth.log may show the user context.
- Test 4macOS Screen Capture via screencapture Utility
Expected signal: macOS Unified Log: log show --predicate 'process == "screencapture"' will show the invocation. Endpoint security framework (ESF) event for ES_EVENT_TYPE_NOTIFY_EXEC for screencapture. File creation event in /tmp/ for the PNG file. If Defender for Endpoint macOS agent is deployed: DeviceProcessEvents with FileName=screencapture and DeviceFileEvents for the output file.
- Test 5Windows VK_SNAPSHOT Keyboard Simulation Screenshot
Expected signal: Sysmon Event ID 1: Process Create — Image=powershell.exe, CommandLine containing 'keybd_event', '0x2C', 'VK_SNAPSHOT'. PowerShell ScriptBlock Log Event ID 4104 with full P/Invoke code. Sysmon Event ID 7: Image Load — user32.dll loaded by powershell.exe. Sysmon Event ID 11: File Create for .png in TEMP if clipboard contained image data.
References (13)
- https://attack.mitre.org/techniques/T1113/
- https://docs.microsoft.com/en-us/dotnet/api/system.drawing.graphics.copyfromscreen?view=netframework-4.8
- https://blog.malwarebytes.com/threat-analysis/2017/01/new-mac-backdoor-using-antiquated-code/
- https://researchcenter.paloaltonetworks.com/2017/02/unit-42-title-gamaredon-group-toolset-evolution/
- https://unit42.paloaltonetworks.com/gamaredon-february-2022/
- https://securelist.com/griffon-the-javascript-backdoor-used-by-fin7/90515/
- https://www.talos-sec.com/blogs/agent-tesla
- https://www.us-cert.gov/ncas/alerts/TA18-074A
- https://www.symantec.com/connect/blogs/dragonfly-western-energy-sector-targeted-sophisticated-attack-group
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1113/T1113.md
- https://github.com/SigmaHQ/sigma/tree/master/rules/windows/process_creation
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceimageloadevents-table
Unlock Pro Content
Get the full detection package for T1113 including response playbook, investigation guide, and atomic red team tests.