T1115

Clipboard Data

Collection Last updated:

Adversaries may collect data stored in the clipboard from users copying information within or between applications. On Windows, adversaries can read clipboard contents using PowerShell's Get-Clipboard cmdlet, the Win32 API functions OpenClipboard() and GetClipboardData(), or by invoking clip.exe in combination with scripting. macOS and Linux provide pbpaste and xclip/xsel utilities respectively. Clipboard content frequently contains high-value data including passwords copied from password managers, authentication tokens, cryptocurrency wallet addresses, PII, and internal URLs. Advanced malware such as Agent Tesla, RTM, Astaroth, CHIMNEYSWEEP, and DarkComet implement persistent clipboard monitoring loops that exfiltrate captured content, while crypto-clippers (a subclass) additionally replace clipboard content with attacker-controlled values to hijack cryptocurrency transactions.

What is T1115 Clipboard Data?

Clipboard Data (T1115) maps to the Collection tactic — the adversary is trying to gather data of interest to their goal in MITRE ATT&CK.

This page provides production-ready detection logic for Clipboard Data, covering the data sources and telemetry it touches: Process: Process Creation, Command: Command Execution, Microsoft Defender for Endpoint. The queries below are rated medium severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.

MITRE ATT&CK

Tactic
Collection
Technique
T1115 Clipboard Data
Canonical reference
https://attack.mitre.org/techniques/T1115/
Microsoft Sentinel / Defender
kusto
let ClipboardUtilities = dynamic(["clip.exe", "pbpaste", "xclip", "xsel", "xdotool"]);
let SuspiciousClipboardPatterns = dynamic([
  "Get-Clipboard", "GetClipboard", "get-clipboard",
  "OpenClipboard", "GetClipboardData", "EmptyClipboard",
  "win32clipboard", "pyperclip", "clipboard.paste",
  "xclip -o", "xclip -out", "xsel --output", "xsel -o",
  "pbpaste", "System.Windows.Forms.Clipboard",
  "[Windows.Forms.Clipboard]", "Clipboard.GetText",
  "Clipboard::GetText", "GetOpenClipboardWindow"
]);
let SuspiciousParents = dynamic([
  "winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe",
  "mshta.exe", "wscript.exe", "cscript.exe", "regsvr32.exe",
  "rundll32.exe", "msiexec.exe", "cmd.exe", "wmic.exe",
  "schtasks.exe", "at.exe"
]);
// Branch 1: Script engines and known tools accessing clipboard
let ClipboardViaScript = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe", "python.exe", "python3.exe", "wscript.exe", "cscript.exe", "mshta.exe")
| where ProcessCommandLine has_any (SuspiciousClipboardPatterns)
| extend DetectionBranch = "ScriptClipboardAccess"
| extend ClipboardMethod = case(
    ProcessCommandLine has "Get-Clipboard", "PowerShell Get-Clipboard",
    ProcessCommandLine has "win32clipboard" or ProcessCommandLine has "pyperclip", "Python Clipboard Module",
    ProcessCommandLine has "System.Windows.Forms.Clipboard", ".NET Forms Clipboard API",
    ProcessCommandLine has "OpenClipboard" or ProcessCommandLine has "GetClipboardData", "Win32 API Direct Call",
    ProcessCommandLine has "xclip" or ProcessCommandLine has "xsel", "Linux Clipboard Utility",
    "Unknown");
// Branch 2: Clipboard utilities spawned from suspicious parent processes
let ClipboardUtilityFromSuspiciousParent = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ (ClipboardUtilities)
| where InitiatingProcessFileName in~ (SuspiciousParents)
    or InitiatingProcessFileName has_any ("python", "perl", "ruby", "node")
| extend DetectionBranch = "ClipboardUtilitySuspiciousParent"
| extend ClipboardMethod = strcat("Native Utility: ", FileName);
// Branch 3: PowerShell clipboard loop pattern (persistent monitoring)
let ClipboardMonitoringLoop = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has "Get-Clipboard" and
        (ProcessCommandLine has "while" or ProcessCommandLine has "Start-Sleep" or ProcessCommandLine has "loop")
| extend DetectionBranch = "ClipboardMonitoringLoop"
| extend ClipboardMethod = "Persistent Clipboard Monitor";
union ClipboardViaScript, ClipboardUtilityFromSuspiciousParent, ClipboardMonitoringLoop
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         DetectionBranch, ClipboardMethod, ProcessId, InitiatingProcessId
| sort by Timestamp desc

Detects clipboard data collection attempts across three detection branches using Microsoft Defender for Endpoint DeviceProcessEvents. Branch 1 identifies scripting engines (PowerShell, Python, WScript) invoking clipboard APIs or cmdlets including Get-Clipboard, System.Windows.Forms.Clipboard, win32clipboard, and pyperclip modules. Branch 2 detects native clipboard utilities (clip.exe, xclip, xsel) spawned from suspicious parent processes such as Office applications, LOLBins, or scripting engines. Branch 3 identifies persistent clipboard monitoring loops where PowerShell continuously polls the clipboard using Get-Clipboard combined with sleep/loop constructs — a pattern common in RAT implants like Agent Tesla. The ClipboardMethod field categorizes the access vector for analyst triage.

medium severity medium confidence

Data Sources

Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents

False Positives

  • Password managers (KeePass, Bitwarden, 1Password) auto-clearing clipboard after paste using scripts or scheduled tasks
  • Remote Desktop Protocol (RDP) and virtual desktop infrastructure (VDI) clipboard synchronization agents running as background services
  • Legitimate clipboard manager utilities (Ditto, ClipX, CopyQ, Paste) that monitor and log clipboard history for productivity
  • Accessibility software and screen readers (NVDA, JAWS, Windows Narrator) that access clipboard content for reading aloud
  • Development and testing automation frameworks (Selenium, AutoHotkey, PyAutoGUI) using clipboard for UI automation workflows
  • Help desk and IT tools that read clipboard content for ticketing or remote assistance purposes

Sigma rule & cross-platform mapping

The detection logic for Clipboard Data (T1115) above is provided in a vendor-neutral form so you can deploy it on any SIEM. The same logic is shipped here as native KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the following logsource:

logsource:
  category: process_creation
  product: windows

Browse the community-maintained Sigma rules for this technique:


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.

  1. Test 1PowerShell Clipboard Harvest via Get-Clipboard

    Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Get-Clipboard'. Sysmon Event ID 11: File Create for %TEMP%\df00tech-clip-test.txt. PowerShell ScriptBlock Log Event ID 4104 showing the full Get-Clipboard invocation. Security Event ID 4688 if command line auditing is enabled.

  2. Test 2PowerShell Persistent Clipboard Monitoring Loop

    Expected signal: Sysmon Event ID 1: Process Create with CommandLine containing 'Get-Clipboard', 'while', 'Start-Sleep', and '-WindowStyle Hidden'. PowerShell ScriptBlock Log Event ID 4104 showing the full loop. Sysmon Event ID 11: File Create and multiple File Modify events for the staging file. Multiple writes to the staging file visible in DeviceFileEvents.

  3. Test 3Python Clipboard Theft via win32clipboard

    Expected signal: Sysmon Event ID 1: Process Create with Image=python.exe, CommandLine containing 'win32clipboard', 'OpenClipboard', and 'GetClipboardData'. Security Event ID 4688 if command line auditing is enabled. Note: requires pywin32 package installed (pip install pywin32).

  4. Test 4Linux Clipboard Exfiltration via xclip

    Expected signal: Auditd syscall log with EXECVE for xclip with arguments '-selection clipboard -o'. Syslog process creation event for xclip. File creation event for /tmp/df00tech-clipboard-capture.txt. If Sysmon for Linux is deployed: EventCode=1 with Image=/usr/bin/xclip.

  5. Test 5macOS Clipboard Collection via pbpaste

    Expected signal: macOS Unified Log (ULS): process creation for pbpaste with arguments. File creation for /tmp/df00tech-clipboard-macos.txt. If Jamf or similar MDM telemetry is deployed, process execution event with parent shell context. ESF (Endpoint Security Framework) events if EDR is deployed.


Response Playbook

Triage

  1. Identify the accessing process — is it a known legitimate application (password manager, clipboard manager, RDP agent) or an unexpected process such as a scripting engine, LOLBin, or untrusted executable? Check the binary's hash against threat intelligence.
  2. Examine the parent process chain — was the clipboard-accessing process spawned by an Office document, a downloaded file, a browser download, or an email attachment? Parent-child relationships through Office applications or mshta.exe are high-confidence indicators of phishing-delivered malware.
  3. Assess timing context — did the clipboard access occur immediately after the user performed a copy action (expected) or at regular intervals suggesting automated monitoring? Persistent loops polling the clipboard every few seconds are a strong RAT indicator.
  4. Review process execution path — is the binary running from a suspicious location such as %TEMP%, %APPDATA%, ProgramData, or a user-writable directory? Legitimate clipboard utilities reside in System32 or Program Files.
  5. Check for outbound network connections from the same process within the investigation window — clipboard-stealing malware typically exfiltrates captured data immediately via HTTP/HTTPS, SMTP, or FTP to C2 infrastructure. Correlate with DeviceNetworkEvents or Sysmon Event ID 3.
  6. Determine what was likely in the clipboard at the time — review the user's recent activity (open applications, browser history, recent file access) to assess whether high-value data such as credentials, financial information, or cryptographic keys may have been exposed.
  7. Check for cryptocurrency-related activity on the host — crypto-clippers actively monitor for wallet address patterns in the clipboard and replace them. Look for browser extensions, recent downloads, or crypto wallet applications that may indicate the user's clipboard was targeted for transaction hijacking.

Containment

  1. If active C2 communication is detected from the clipboard-accessing process: isolate the endpoint immediately using EDR network isolation or emergency VLAN change to prevent further data exfiltration.
  2. If the user copied credentials, tokens, or sensitive data before the theft was detected: immediately rotate all potentially compromised credentials, revoke active sessions and tokens, and notify the affected user and data owner.
  3. If cryptocurrency wallet addresses were in the clipboard (potential crypto-clipper): alert the user immediately — any pending transactions may have had destination addresses replaced, and funds cannot be recovered once sent.
  4. Terminate the malicious process and quarantine the associated binary. Collect a memory dump before termination if possible to recover exfiltrated clipboard contents and C2 configuration from process memory.
  5. If the infection vector was a phishing email or malicious document: block the sender domain, quarantine similar emails from the past 30 days across the mail gateway, and notify security awareness training programs.
  6. If persistence mechanisms are identified (scheduled task, registry run key, startup folder): remove the persistence entry before reimaging to prevent reinfection from surviving artifacts.

Evidence Collection

  1. Process creation logs — Sysmon Event ID 1 or Security Event ID 4688 (with command line auditing enabled) for the clipboard-accessing process and its full parent chain, including timestamps and command line arguments.
  2. Network connection logs — Sysmon Event ID 3 for any outbound connections initiated by the process, particularly to external IPs on ports 25 (SMTP), 443 (HTTPS), 21 (FTP), or non-standard ports. Correlate connection timestamps with clipboard access events.
  3. File creation logs — Sysmon Event ID 11 for any files written by the process, including staging files in %TEMP%, %APPDATA%, or ProgramData that may contain harvested clipboard contents before exfiltration.
  4. PowerShell ScriptBlock Logging — Event ID 4104 from Microsoft-Windows-PowerShell/Operational, which captures the deobfuscated script content including any Get-Clipboard invocations and what was done with the result.
  5. Process memory dump — If the malicious process is still running, capture a full memory dump using ProcDump or EDR capabilities. Memory analysis may reveal the clipboard history buffer, C2 configuration, and exfiltrated data.
  6. Prefetch files — C:\Windows\Prefetch\ for the malicious binary's prefetch file, providing execution timestamps, run count, and referenced DLLs (look for user32.dll usage which contains clipboard APIs).
  7. Scheduled task XML files — C:\Windows\System32\Tasks\ and C:\Windows\SysWOW64\Tasks\ for persistence entries created by the malware.
  8. Registry run keys — HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run and HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run for persistence entries pointing to the malicious binary.
  9. Browser clipboard access logs — Modern browsers log extension clipboard access in their debug logs; if a malicious browser extension is suspected, collect the browser profile directory and extension manifests.

Escalation Criteria

  • ! Clipboard monitoring loop detected (persistent polling with sleep intervals) — this is a definitive indicator of RAT-style clipboard harvesting and warrants immediate escalation to incident response.
  • ! Outbound network connection from clipboard-accessing process to external IP, especially over non-standard ports or shortly after clipboard API calls — indicates active exfiltration in progress.
  • ! User reports a cryptocurrency transaction was redirected to an unexpected wallet address — indicates a crypto-clipper is actively operating and financial loss may have already occurred.
  • ! Clipboard access from a process in a staging directory (%TEMP%, %APPDATA%, ProgramData) with no corresponding legitimate application — strong indicator of dropped malware payload.
  • ! Multiple users on different endpoints showing the same clipboard access pattern within a short timeframe — potential widespread infection or automated lateral movement.
  • ! Clipboard access immediately following execution of a macro-enabled Office document, script file, or downloaded executable — high confidence phishing-delivered initial access.
  • ! Process chain shows clipboard access from a child of a browser, email client, or document viewer without a corresponding legitimate browser extension or plugin — indicates exploitation or malicious code injection.

Investigation Guide

Forensic Artifacts

  • > Registry: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run — persistence entries pointing to clipboard-stealing malware often registered here for user-level persistence
  • > Registry: HKLM\SYSTEM\CurrentControlSet\Services — service-based persistence for elevated clipboard stealers; examine ImagePath and Description fields
  • > File System: %TEMP%\*.dat, %APPDATA%\*.log — common staging locations where clipboard-harvesting malware writes captured content before exfiltration
  • > File System: C:\Windows\Prefetch\POWERSHELL.EXE-*.pf — execution timestamps and DLL references for PowerShell-based clipboard access
  • > File System: C:\Windows\Prefetch\[MALWARE].EXE-*.pf — prefetch file for the malicious binary with execution count and timestamp history
  • > Windows Clipboard History: Registry HKCU\SOFTWARE\Microsoft\Clipboard — Windows 10 1809+ clipboard history entries (if clipboard history feature enabled by user)
  • > Event Log: Microsoft-Windows-PowerShell/Operational (Event ID 4104) — ScriptBlock logging captures Get-Clipboard invocations with full script context
  • > Event Log: Microsoft-Windows-Sysmon/Operational (Event ID 3) — network connections from the clipboard-stealing process to C2 infrastructure
  • > Memory: Process memory of the malicious binary — may contain in-memory clipboard buffer with captured data awaiting exfiltration, C2 configuration, and encryption keys
  • > Network: Proxy/firewall logs — HTTP POST requests containing Base64-encoded or encrypted clipboard data sent to C2 server, often with distinctive User-Agent strings associated with specific RAT families

Tuning Guidance

Begin by establishing a baseline of legitimate clipboard-accessing applications in your environment. Common high-volume false positive sources include: (1) password managers running auto-clear scripts — these should be allowlisted by their specific binary path and parent process; (2) VDI/RDP clipboard agents running as system services — identify by their service name and allowlist the specific binary path; (3) productivity tools like clipboard managers (Ditto, CopyQ) — allowlist by their executable location under Program Files. For the persistent monitoring loop detection branch, tune the threshold based on your environment's automation footprint. In environments running extensive PowerShell automation, add exclusions for specific service accounts used by configuration management tools (SCCM, Ansible). The crypto-clipper use case (replacing clipboard contents with attacker wallet addresses) is better detected by monitoring for high-frequency clipboard write operations alongside reads — consider adding DeviceProcessEvents monitoring for Set-Clipboard and Win32 API calls to SetClipboardData in environments where cryptocurrency use is relevant. For organizations with heavy Python automation, allowlist specific virtual environment paths where pyperclip usage is expected (e.g., E:\automation_venvs\). The medium confidence rating reflects that API-level clipboard access by compiled malware (OpenClipboard/GetClipboardData directly) without a corresponding subprocess creation event will not be caught by process-level detection alone — consider deploying Sysmon with DLL load monitoring (Event ID 7) for user32.dll in high-risk scenarios.


Hunting Queries

Hunt for accounts or parent processes that invoke PowerShell Get-Clipboard at high frequency, which indicates a persistent monitoring loop typical of RAT implants. More than 5 accesses per hour or sustained access over 10 minutes without user-initiated copy actions strongly suggests automated clipboard harvesting.

Hunting — KQL
kql
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has "Get-Clipboard"
| summarize ClipboardAccessCount=count(), Devices=dcount(DeviceName), Earliest=min(Timestamp), Latest=max(Timestamp), Commands=make_set(ProcessCommandLine, 5) by AccountName, InitiatingProcessFileName
| extend DurationMinutes=datetime_diff('minute', Latest, Earliest)
| where ClipboardAccessCount > 5 or DurationMinutes > 10
| sort by ClipboardAccessCount desc
Hunting — SPL
spl
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 (Image="*\\powershell.exe" OR Image="*\\pwsh.exe") CommandLine="*Get-Clipboard*"
| bin _time span=1h
| stats count as ClipboardAccessCount, dc(host) as Devices, values(CommandLine) as Commands by User, ParentImage, _time
| where ClipboardAccessCount > 5
| sort - ClipboardAccessCount

Hunt for processes that both access the clipboard AND make outbound network connections to public IPs within the same process lifetime. This correlation is a high-fidelity indicator of active clipboard data exfiltration — the process reads clipboard content then immediately transmits it to a C2 server.

Hunting — KQL
kql
let ClipboardAccess = DeviceProcessEvents
| where Timestamp > ago(7d)
| where (FileName in~ ("powershell.exe", "pwsh.exe") and ProcessCommandLine has_any ("Get-Clipboard", "Clipboard.GetText", "GetClipboardData"))
    or (FileName in~ ("python.exe", "python3.exe") and ProcessCommandLine has_any ("win32clipboard", "pyperclip", "clipboard.paste"))
| project ClipboardTime=Timestamp, DeviceName, AccountName, ProcessId, ClipboardProcess=FileName, ClipboardCmd=ProcessCommandLine;
let NetworkConns = DeviceNetworkEvents
| where Timestamp > ago(7d)
| where RemoteIPType == "Public"
| project NetTime=Timestamp, DeviceName, AccountName, InitiatingProcessId, RemoteIP, RemotePort, RemoteUrl;
ClipboardAccess
| join kind=inner NetworkConns on DeviceName, AccountName, $left.ProcessId == $right.InitiatingProcessId
| where NetTime between (ClipboardTime .. (ClipboardTime + 5min))
| project ClipboardTime, NetTime, DeviceName, AccountName, ClipboardProcess, ClipboardCmd, RemoteIP, RemotePort, RemoteUrl
| sort by ClipboardTime desc
Hunting — SPL
spl
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
| eval EventCode=tonumber(EventCode)
| where EventCode=1 OR EventCode=3
| eval isClipboard=if(EventCode=1 AND (match(lower(CommandLine), "(get-clipboard|win32clipboard|pyperclip|getclipboarddata)") AND match(lower(Image), "(powershell|python|pwsh)")), 1, 0)
| eval isNetwork=if(EventCode=3 AND NOT match(DestinationIp, "^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.|127\.)"), 1, 0)
| eval processKey=coalesce(ProcessId, ProcessGuid)
| stats sum(isClipboard) as ClipboardEvents, sum(isNetwork) as NetworkEvents, values(CommandLine) as Commands, values(DestinationIp) as ExternalIPs by host, User, processKey
| where ClipboardEvents > 0 AND NetworkEvents > 0
| sort - ClipboardEvents

Hunt for clipboard-accessing processes executing from suspicious user-writable directories (%TEMP%, %APPDATA%, ProgramData, Users\Public). Legitimate clipboard utilities reside in system directories; malware dropped by phishing or exploits typically runs from these staging locations. This query finds dropped malware that has been given clipboard harvesting capability.

Hunting — KQL
kql
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe", "python.exe", "python3.exe", "wscript.exe", "cscript.exe")
| where ProcessCommandLine has_any ("Get-Clipboard", "win32clipboard", "pyperclip", "GetClipboardData", "OpenClipboard")
| where FolderPath has_any ("\\Temp\\", "\\AppData\\Local\\Temp\\", "\\AppData\\Roaming\\", "\\ProgramData\\", "\\Users\\Public\\")
    or InitiatingProcessFolderPath has_any ("\\Temp\\", "\\AppData\\Local\\Temp\\", "\\AppData\\Roaming\\", "\\ProgramData\\", "\\Users\\Public\\")
| project Timestamp, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessFolderPath, InitiatingProcessCommandLine
| sort by Timestamp desc
Hunting — SPL
spl
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| eval CommandLine=lower(CommandLine), Image=lower(Image), CurrentDirectory=lower(CurrentDirectory)
| where (match(Image, "(powershell\.exe|pwsh\.exe|python[0-9]*\.exe|wscript\.exe|cscript\.exe)"))
    AND (match(CommandLine, "(get-clipboard|win32clipboard|pyperclip|getclipboarddata|openclipboard)"))
    AND (match(CurrentDirectory, "(\\temp\\|\\appdata\\|\\programdata\\|\\users\\public\\)") OR match(Image, "(\\temp\\|\\appdata\\|\\programdata\\|\\users\\public\\)"))
| table _time, host, User, Image, CommandLine, ParentImage, CurrentDirectory
| sort - _time

Atomic Red Team Tests

Test 1 PowerShell Clipboard Harvest via Get-Clipboard
windows

Reads and outputs current clipboard contents using PowerShell's Get-Clipboard cmdlet — the most common Windows-native method used by post-exploitation frameworks, RAT implants, and InfoStealer malware. This simulates a single clipboard capture event as performed by Agent Tesla, Empire, and SILENTTRINITY.

Command

powershell
powershell.exe -NoProfile -Command "$clipData = Get-Clipboard; Write-Output \"[Clipboard Captured]: $clipData\"; $clipData | Out-File $env:TEMP\df00tech-clip-test.txt"

Cleanup

powershell
Remove-Item $env:TEMP\df00tech-clip-test.txt -ErrorAction SilentlyContinue

Expected Telemetry

Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Get-Clipboard'. Sysmon Event ID 11: File Create for %TEMP%\df00tech-clip-test.txt. PowerShell ScriptBlock Log Event ID 4104 showing the full Get-Clipboard invocation. Security Event ID 4688 if command line auditing is enabled.

Expected Detection

KQL: ClipboardViaScript branch fires, ClipboardMethod='PowerShell Get-Clipboard'. SPL: ClipboardAPI=1, SuspicionScore>=1, DetectionBranch='ScriptClipboardAccess'.

Test 2 PowerShell Persistent Clipboard Monitoring Loop
windows

Implements a clipboard polling loop that captures clipboard content every 2 seconds for 30 seconds — matching the behavior of RAT implants such as Agent Tesla and DarkComet that continuously monitor the clipboard for high-value data. The loop writes captures to a staging file before simulated exfiltration.

Command

powershell
powershell.exe -NoProfile -WindowStyle Hidden -Command "$endTime = (Get-Date).AddSeconds(30); $lastClip = ''; while ((Get-Date) -lt $endTime) { $clip = Get-Clipboard; if ($clip -ne $lastClip -and $clip -ne $null) { $lastClip = $clip; Add-Content $env:TEMP\df00tech-clip-harvest.txt \"[$(Get-Date -Format 'HH:mm:ss')] $clip\" }; Start-Sleep -Seconds 2 }"

Cleanup

powershell
Remove-Item $env:TEMP\df00tech-clip-harvest.txt -ErrorAction SilentlyContinue

Expected Telemetry

Sysmon Event ID 1: Process Create with CommandLine containing 'Get-Clipboard', 'while', 'Start-Sleep', and '-WindowStyle Hidden'. PowerShell ScriptBlock Log Event ID 4104 showing the full loop. Sysmon Event ID 11: File Create and multiple File Modify events for the staging file. Multiple writes to the staging file visible in DeviceFileEvents.

Expected Detection

KQL: ClipboardMonitoringLoop branch fires due to 'Get-Clipboard' + 'while' + 'Start-Sleep' pattern. SPL: ClipboardLoop=1, SuspicionScore>=3, DetectionBranch='ClipboardMonitoringLoop'. The -WindowStyle Hidden flag may additionally trigger PowerShell detection rules.

Test 3 Python Clipboard Theft via win32clipboard
windows

Uses Python's win32clipboard module (part of pywin32) to directly call the Win32 OpenClipboard and GetClipboardData APIs — matching the method used by Astaroth malware. This simulates malware that uses Python or embeds Python runtime for credential harvesting operations.

Command

powershell
python.exe -c "import win32clipboard; win32clipboard.OpenClipboard(); data = win32clipboard.GetClipboardData(); win32clipboard.CloseClipboard(); print('[Clipboard]:', data)"

Expected Telemetry

Sysmon Event ID 1: Process Create with Image=python.exe, CommandLine containing 'win32clipboard', 'OpenClipboard', and 'GetClipboardData'. Security Event ID 4688 if command line auditing is enabled. Note: requires pywin32 package installed (pip install pywin32).

Expected Detection

KQL: ScriptClipboardAccess branch fires, ClipboardMethod='Python Clipboard Module'. SPL: ClipboardAPI=1, SuspicionScore>=1. If Python executable is in an unusual path (AppData, Temp), the staging directory hunting query also fires.

Test 4 Linux Clipboard Exfiltration via xclip
linux

Reads X11 clipboard contents using xclip and redirects output to a file — simulating the collection phase of clipboard theft on Linux systems as referenced in the ATT&CK procedure examples (Empire's EmPyre framework using pbpaste-equivalent on Linux). Requires an X11 display environment.

Command

bash
xclip -selection clipboard -o > /tmp/df00tech-clipboard-capture.txt && echo "[Captured]" && cat /tmp/df00tech-clipboard-capture.txt

Cleanup

bash
rm -f /tmp/df00tech-clipboard-capture.txt

Expected Telemetry

Auditd syscall log with EXECVE for xclip with arguments '-selection clipboard -o'. Syslog process creation event for xclip. File creation event for /tmp/df00tech-clipboard-capture.txt. If Sysmon for Linux is deployed: EventCode=1 with Image=/usr/bin/xclip.

Expected Detection

Linux-specific detection triggers on xclip/xsel process creation with output redirection. KQL: NativeClipUtil branch for xclip. SPL: NativeClipUtil=1. If parent is a script interpreter or unusual process, SuspiciousParent=1 raises score.

Test 5 macOS Clipboard Collection via pbpaste
macos

Reads clipboard contents using macOS's native pbpaste utility and writes to a staging file — the macOS equivalent of clipboard theft as documented in the MacSpy malware and Empire framework operation with EmPyre. This simulates the data collection phase before exfiltration.

Command

bash
pbpaste > /tmp/df00tech-clipboard-macos.txt && echo "Clipboard captured to /tmp/df00tech-clipboard-macos.txt" && cat /tmp/df00tech-clipboard-macos.txt

Cleanup

bash
rm -f /tmp/df00tech-clipboard-macos.txt

Expected Telemetry

macOS Unified Log (ULS): process creation for pbpaste with arguments. File creation for /tmp/df00tech-clipboard-macos.txt. If Jamf or similar MDM telemetry is deployed, process execution event with parent shell context. ESF (Endpoint Security Framework) events if EDR is deployed.

Expected Detection

macOS-specific rule triggers on pbpaste process creation, particularly when spawned from non-interactive shells, scripts, or suspicious parent processes. The file creation in /tmp further correlates with staging behavior.

Related Detections

Tactic Hub