T1083 Elastic Security · Elastic

Detect File and Directory Discovery in Elastic Security

Adversaries may enumerate files and directories or search specific filesystem locations to gather information about a host or network share. This discovery technique helps adversaries identify sensitive files, understand the environment, and shape follow-on behavior such as targeted exfiltration or lateral movement. Common tools include dir, tree, ls, find, locate, and forfiles. Adversaries may also search for credential files, configuration files, or documents with specific extensions using recursive enumeration patterns.

MITRE ATT&CK

Tactic
Discovery
Technique
T1083 File and Directory Discovery
Canonical reference
https://attack.mitre.org/techniques/T1083/

Elastic Detection Query

Elastic Security (Elastic)
eql
sequence by host.id, process.entity_id with maxspan=5s
  [process where event.type == "start" and
    (
      (process.name : ("cmd.exe", "powershell.exe", "pwsh.exe") and
       process.args : ("dir", "tree", "forfiles", "Get-ChildItem", "gci", "Get-Item") and
       process.args : ("/s", "/S", "-Recurse", "-recurse", "-r", "--recursive", "-R"))
      or
      (process.name : ("find.exe", "where.exe") and
       process.command_line : ("?:\\*", "*[A-Z]:\\\\*"))
    ) and
    (
      process.command_line : ("*.key", "*.pem", "*.pfx", "*.p12", "*.kdbx", "*id_rsa*", "*authorized_keys*", "*.ppk", "*password*", "*passwd*", "*credential*", "*secret*", "*.aws*", "*web.config*", "*appsettings*") or
      process.command_line : ("*\\Users\\*", "*\\AppData\\*", "*\\Documents\\*", "*\\Desktop\\*", "*\\temp\\*", "*\\ssh\\*", "*\.aws\\*", "*inetpub*", "*wwwroot*")
    )
  ]
| eval IsRecursive = process.args : ("/s", "/S", "-Recurse", "-recurse", "-r", "--recursive", "-R")
| eval HuntsCredentials = process.command_line : ("*.key", "*.pem", "*.pfx", "*.p12", "*.kdbx", "*id_rsa*", "*authorized_keys*", "*.ppk", "*password*", "*passwd*", "*credential*", "*secret*")
| eval IsSuspiciousParent = process.parent.name : ("winword.exe", "excel.exe", "powerpnt.exe", "outlook.exe", "mshta.exe", "wscript.exe", "cscript.exe", "regsvr32.exe", "rundll32.exe", "msiexec.exe", "msedge.exe", "chrome.exe", "firefox.exe")
| eval TargetsSensitivePath = process.command_line : ("*\\Users\\*", "*\\AppData\\*", "*\\Documents\\*", "*\\Desktop\\*", "*\\temp\\*", "*\\ssh\\*", "*inetpub*", "*wwwroot*")
| eval SuspicionScore = (IsRecursive ? 1 : 0) + (IsSuspiciousParent ? 2 : 0) + (TargetsSensitivePath ? 1 : 0) + (HuntsCredentials ? 2 : 0)
| where SuspicionScore >= 2
medium severity high confidence

Detects recursive file and directory enumeration consistent with T1083, focusing on Windows CMD, PowerShell, find.exe, and where.exe processes performing recursive discovery against sensitive paths or credential-related file extensions. Scores events by suspicion weight — recursive flag, suspicious parent, sensitive path, credential hunting.

Data Sources

Elastic Endpoint SecurityWinlogbeat with SysmonElastic Agent (endpoint integration)

Required Tables

logs-endpoint.events.process-*winlogbeat-*

False Positives & Tuning

  • IT administrators running scheduled inventory or compliance scripts that recursively enumerate file systems
  • Backup agents (e.g., Veeam, Acronis) that traverse directory trees as part of backup preparation
  • Software deployment tools (SCCM, Ansible) scanning for config files or installed software inventory
Download portable Sigma rule (.yml)

Other platforms for T1083


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 1Recursive Directory Listing via CMD

    Expected signal: Sysmon Event ID 1: Process Create with Image=cmd.exe, CommandLine containing 'dir /s /b C:\Users'. Security Event ID 4688 (if command line auditing enabled). Sysmon Event ID 11: File Create for %TEMP%\df00tech-dir-test.txt. Parent process will be the shell or test runner invoking the command.

  2. Test 2Credential File Search via PowerShell

    Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Get-ChildItem', '-Recurse', '-Force', and credential extensions (.key, .pem, .pfx, id_rsa, .kdbx). Sysmon Event ID 11: File Create for the output file. PowerShell ScriptBlock Log Event ID 4104 with full script.

  3. Test 3File Search via Windows where.exe for Executable Targets

    Expected signal: Sysmon Event ID 1: Process Create with Image=where.exe, CommandLine containing '/r C:\Program Files *.exe'. Security Event ID 4688 with same details if command line auditing is enabled. Sysmon Event ID 11 for the output file creation.

  4. Test 4Tree Command for Full Filesystem Enumeration

    Expected signal: Sysmon Event ID 1: Process Create with Image=cmd.exe, CommandLine containing 'tree /f /a C:\Users'. Security Event ID 4688 if command line auditing is enabled. Sysmon Event ID 11 for the output file creation in TEMP.

  5. Test 5Linux Credential File Discovery via find

    Expected signal: Linux auditd EXECVE records showing find command with -name patterns for credential files. Syslog entries if process accounting is enabled. On systems with Sysmon for Linux: Event ID 1 (Process Create) with CommandLine showing find with credential extension patterns.

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections