Detectionlowtest

File And SubFolder Enumeration Via Dir Command

Detects usage of the "dir" command part of Windows CMD with the "/S" command line flag in order to enumerate files in a specified directory and all subdirectories.

Open in Detection LabConvert ruleBuild Package
François HubautCreated 2021-12-13Updated 2026-05-187c9340a9-e2ee-4e43-94c5-c54ebbea1006windows
Log Source
WindowsProcess Creation
ProductWindows← raw: windows
CategoryProcess Creation← raw: process_creation

Events generated when a new process is spawned on the system. Covers command-line arguments, parent/child relationships, and process metadata.

Detection Logic
Detection Logic3 selectors
detection:
    selection_cmd:
        - Image|endswith: '\cmd.exe'
        - OriginalFileName: Cmd.Exe
    selection_cli:
        CommandLine|contains|windash: '-s'
        CommandLine|contains: 'dir '
    filter_main_rmdir:
        CommandLine|contains: 'rmdir'
    condition: all of selection_* and not 1 of filter_main_*
False Positives

Likely

Testing & Validation

Simulations

atomic-red-teamT1217
View on ART

List Internet Explorer Bookmarks using the command prompt

GUID: 727dbcdb-e495-4ab1-a6c4-80c7f77aef85

Regression Tests

by SigmaHQ Team
Positive Detection Test1 matchevtx

Microsoft-Windows-Sysmon

Rule Metadata
Rule ID
7c9340a9-e2ee-4e43-94c5-c54ebbea1006
Status
test
Level
low
Type
Detection
Created
2021-12-13
Modified
2026-05-18
Path
rules/windows/process_creation/proc_creation_win_cmd_dir_execution.yml
Raw Tags
attack.discoveryattack.t1217
View on GitHub