Detect Automated Collection in Google Chronicle
Once established within a system or network, an adversary may use automated techniques for collecting internal data. Methods for performing this technique could include use of a Command and Scripting Interpreter to search for and copy information fitting set criteria such as file type, location, or name at specific time intervals. In cloud-based environments, adversaries may also use cloud APIs, data pipelines, command line interfaces, or ETL services to automatically collect data. This functionality could also be built into remote access tools. This technique may incorporate use of other techniques such as File and Directory Discovery and Lateral Tool Transfer to identify and move files, as well as Cloud Service Dashboard and Cloud Storage Object Discovery to identify resources in cloud environments.
MITRE ATT&CK
- Tactic
- Collection
- Technique
- T1119 Automated Collection
- Canonical reference
- https://attack.mitre.org/techniques/T1119/
YARA-L Detection Query
rule automated_collection_t1119 {
meta:
author = "Argus Detection Engineering"
description = "Detects automated data collection (T1119) via recursive file enumeration, mass copy tools, document archiving, and scripted file traversal targeting sensitive file types"
mitre_attack_tactic = "Collection"
mitre_attack_technique = "T1119"
severity = "HIGH"
priority = "HIGH"
events:
$e.metadata.event_type = "PROCESS_LAUNCH"
// Match on known collection patterns with sensitive extensions or recursive flags
(
// PowerShell recursive document search
(
re.regex($e.principal.process.file.full_path, `(?i)(powershell\.exe|pwsh\.exe)$`)
and re.regex($e.principal.process.command_line, `(?i)(-Recurse|Get-ChildItem|\bGCI\b|forfiles)`)
and re.regex($e.principal.process.command_line, `(?i)\.(docx?|xlsx?|pdf|pptx?|pst|ost|mdb|accdb|kdbx|pfx|pem|p12|key|csv)`)
)
or
// CMD recursive enumeration targeting document types
(
re.regex($e.principal.process.file.full_path, `(?i)cmd\.exe$`)
and re.regex($e.principal.process.command_line, `(?i)dir\s.*/s`)
and re.regex($e.principal.process.command_line, `(?i)\.(docx?|xlsx?|pdf|pst|kdbx|pfx|pem)`)
)
or
// robocopy mass copy with recursive flags
(
re.regex($e.principal.process.file.full_path, `(?i)robocopy\.exe$`)
and re.regex($e.principal.process.command_line, `(?i)(/s|/e|/MIR)`)
)
or
// xcopy recursive staging
(
re.regex($e.principal.process.file.full_path, `(?i)xcopy\.exe$`)
and re.regex($e.principal.process.command_line, `(?i)/s`)
)
or
// Archive tools compressing sensitive documents
(
re.regex($e.principal.process.file.full_path, `(?i)(rar\.exe|winrar\.exe|7z\.exe)$`)
and re.regex($e.principal.process.command_line, `(?i)(\sa\s|-a\s|/a\s)`)
and re.regex($e.principal.process.command_line, `(?i)\.(docx?|xlsx?|pdf|pst|kdbx|pfx|pem|p12|key|csv)`)
)
or
// Python-based file traversal and collection
(
re.regex($e.principal.process.file.full_path, `(?i)python[23]?\.exe$`)
and re.regex($e.principal.process.command_line, `(?i)(os\.walk|glob\.glob|shutil\.copy|scandir|os\.listdir)`)
)
or
// WScript/CScript using Scripting.FileSystemObject
(
re.regex($e.principal.process.file.full_path, `(?i)(wscript\.exe|cscript\.exe)$`)
and re.regex($e.principal.process.command_line, `(?i)(GetFolder|GetFile|CopyFile|MoveFile|Files)`)
)
)
condition:
$e
} Chronicle YARA-L 2.0 rule detecting automated data collection (T1119) via UDM process launch events. Covers PowerShell/CMD recursive enumeration with sensitive file extensions, robocopy/xcopy mass copying, RAR/7z archiving of documents, Python os.walk traversal, and WScript/CScript FileSystemObject usage.
Data Sources
Required Tables
False Positives & Tuning
- Enterprise backup software (Veeam, Backup Exec) that launches robocopy or PowerShell with Get-ChildItem on a schedule to replicate document repositories
- IT operations scripts for data migration projects using xcopy or robocopy with recursive flags to move file shares between servers
- Developer tooling or CI/CD pipelines using Python glob or os.walk to collect source files or build artifacts for packaging
Other platforms for T1119
Testing Methodology
Validate this detection against 4 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 1PowerShell Recursive Document Collection to Staging Directory
Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Get-ChildItem', '-Recurse', '.docx', '.xlsx', '.pdf'. Sysmon Event ID 11: Multiple file creation events in %TEMP%\df00tech-stage for each copied file. PowerShell ScriptBlock Log Event ID 4104 with the full collection script. Security Event ID 4663 (if SACL auditing enabled) for each source document read.
- Test 2CMD Recursive File Enumeration with dir /s
Expected signal: Sysmon Event ID 1: Process Create with Image=cmd.exe, CommandLine containing 'dir /s /b' and '.docx', '.xlsx', '.pdf'. Sysmon Event ID 11: File creation event for %TEMP%\df00tech-filelist.txt. Security Event ID 4688 (if process creation auditing and command line logging are enabled) with full command line including extension targets.
- Test 3forfiles Automated Document Enumeration
Expected signal: Sysmon Event ID 1: Process Create for the shell executing forfiles with CommandLine containing 'forfiles', '/S', and '.docx'. Child cmd.exe process creation events as forfiles spawns a cmd.exe instance per matching file. Sysmon Event ID 11: File creation for %TEMP%\df00tech-forfiles.txt. The child cmd.exe processes with 'echo @PATH' are also logged individually.
- Test 47-Zip Archive Collection — Document Staging Pre-Exfiltration
Expected signal: Sysmon Event ID 1: Process Create with Image=7z.exe, CommandLine containing 'a' (add to archive), target paths with '.docx', '.xlsx', '.pdf', '-r' (recursive), and '-p' (password). Sysmon Event ID 11: File creation event for %TEMP%\df00tech-archive.7z. Security Event ID 4663 (if auditing enabled) for each source document file opened by 7z.exe during archiving.
References (12)
- https://attack.mitre.org/techniques/T1119/
- https://www.mandiant.com/resources/blog/unc3944-sms-phishing-sim-swapping-ransomware
- https://unit42.paloaltonetworks.com/unit42-t9000-advanced-modular-backdoor-uses-complex-anti-analysis-techniques/
- https://www.radware.com/security/ddos-threats-center/threat-advisories-and-attack-reports/micropsia-apt-malware/
- https://www.welivesecurity.com/2020/06/11/gamaredon-group-grows-its-game/
- https://dirkjanm.io/introducing-roadtools/
- https://github.com/dirkjanm/ROADtools
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1119/T1119.md
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/forfiles
- https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
- https://www.group-ib.com/resources/research/redcurl/
Unlock Pro Content
Get the full detection package for T1119 including response playbook, investigation guide, and atomic red team tests.