T1119

Automated Collection

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.

Microsoft Sentinel / Defender
kusto
let SensitiveExtensions = dynamic([
  ".doc", ".docx", ".xls", ".xlsx", ".pdf", ".ppt", ".pptx",
  ".mdb", ".accdb", ".csv", ".pst", ".ost", ".kdbx", ".pfx",
  ".pem", ".p12", ".key", ".rtf", ".txt"
]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where (
    // PowerShell recursive document search and collection
    (FileName in~ ("powershell.exe", "pwsh.exe") and
     ProcessCommandLine has_any ("-Recurse", "Get-ChildItem", "GCI ", "gci ") and
     ProcessCommandLine has_any (SensitiveExtensions))
    or
    // CMD recursive file enumeration targeting document types
    (FileName =~ "cmd.exe" and
     ProcessCommandLine has "dir" and ProcessCommandLine has "/s" and
     ProcessCommandLine has_any (SensitiveExtensions))
    or
    // forfiles automated file processing
    (ProcessCommandLine has "forfiles" and
     ProcessCommandLine has_any (SensitiveExtensions))
    or
    // Mass file copy with recursive flags (bulk staging)
    (FileName =~ "robocopy.exe" and
     ProcessCommandLine has_any ("/s", "/e", "/S", "/E", "/MIR", "/mir"))
    or
    (FileName =~ "xcopy.exe" and ProcessCommandLine has_any ("/s", "/S"))
    or
    // Archive tools ingesting document collections (pre-exfiltration staging)
    (FileName in~ ("rar.exe", "winrar.exe") and
     ProcessCommandLine has_any (" a ", "-a", "/a") and
     ProcessCommandLine has_any (SensitiveExtensions))
    or
    (FileName =~ "7z.exe" and
     ProcessCommandLine has_any (" a ", "a ") and
     ProcessCommandLine has_any (SensitiveExtensions))
    or
    // Python file traversal and collection scripts
    (FileName in~ ("python.exe", "python3.exe") and
     ProcessCommandLine has_any ("os.walk", "glob.glob", "shutil.copy", "os.listdir", "scandir"))
    or
    // VBScript/JScript file collection via Scripting.FileSystemObject
    (FileName in~ ("wscript.exe", "cscript.exe") and
     ProcessCommandLine has_any ("GetFolder", "GetFile", "CopyFile", "MoveFile", "Files"))
)
| extend AutoColl_RecursiveSearch = ProcessCommandLine has_any ("-Recurse", "/s", "/S", "os.walk", "forfiles", "Get-ChildItem")
| extend AutoColl_SensitiveExt = ProcessCommandLine has_any (SensitiveExtensions)
| extend AutoColl_ArchiveTool = FileName in~ ("rar.exe", "winrar.exe", "7z.exe")
| extend AutoColl_MassCopy = FileName in~ ("robocopy.exe", "xcopy.exe")
| extend AutoColl_CredentialFiles = ProcessCommandLine has_any (".pfx", ".pem", ".p12", ".key", ".kdbx")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         AutoColl_RecursiveSearch, AutoColl_SensitiveExt, AutoColl_ArchiveTool,
         AutoColl_MassCopy, AutoColl_CredentialFiles
| sort by Timestamp desc
high severity medium confidence

Data Sources

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

Required Tables

DeviceProcessEvents

False Positives

  • Backup software agents (Veeam, Acronis, Windows Backup) performing scheduled recursive file enumeration and copy operations using robocopy or xcopy with standard recursive flags
  • Enterprise file sync and DLP agents (OneDrive sync client, SharePoint sync, Varonis, Symantec DLP) scanning for specific document types as part of classification and policy enforcement
  • IT administrators running robocopy or PowerShell Get-ChildItem for bulk file migrations, server decommissions, or departmental data reorganization projects
  • Software developers using Python scripts with os.walk or glob.glob for build processes, automated test data preparation, or log parsing pipelines
  • Anti-virus and endpoint security products performing scheduled content-inspection scans that enumerate files by extension type across user directories

Unlock Pro Content

Get the full detection package for T1119 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections