CmdID

CmdID / Rules / Windows

File or Folder Permissions Modifications

A Sigma rule for process creation on Windows, from SigmaHQ’s threat hunting rules, by Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems).

medium 1 ATT&CK technique 11 programs it names 9 everyday examples trip it

What it looks for

its detection, as SigmaHQ writes it
detection:
  filter_optional_avira:
    CommandLine|contains:
      - ':\Program Files (x86)\Avira'
      - ':\Program Files\Avira'
  filter_optional_dynatrace_1:
    CommandLine|endswith: 'ICACLS C:\ProgramData\dynatrace\gateway\config\connectivity.history /reset'
  filter_optional_dynatrace_2:
    CommandLine|contains|all:
      - 'ICACLS C:\ProgramData\dynatrace\gateway\config\config.properties /grant :r '
      - 'S-1-5-19:F'
  filter_optional_vscode:
    CommandLine|contains:
      - '\AppData\Local\Programs\Microsoft VS Code'
      - ':\Program Files\Microsoft VS Code'
  selection_1:
    CommandLine|contains:
      - '/grant'
      - '/setowner'
      - '/inheritance:r'
    Image|endswith:
      - '\cacls.exe'
      - '\icacls.exe'
      - '\net.exe'
      - '\net1.exe'
  selection_2:
    CommandLine|contains: '-r'
    Image|endswith: '\attrib.exe'
  selection_3:
    Image|endswith: '\takeown.exe'
  condition: 1 of selection_* and not 1 of filter_optional_*

The rule’s detection, its selections and fields in order of name. The whole rule, with its references and false positives, is on SigmaHQ, by Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems), under the Detection Rule License 1.1. CmdID evaluates it on a command line alone: a test on what a command line cannot show, such as the parent process or the user, is not met.

Command lines that trip it

everyday examples from tldr-pages, CC BY 4.0, each read by CmdID

To remove the Read-only attribute from files in the public directory and its subdirectories on a disk in drive b:, type on the page for attrib

attrib -r b:\public\*.* /sIdentify

Remove a specific attribute of files or directories on the page for attrib

attrib -r path\to\file_or_directory1 path\to\file_or_directory2 ...Identify

To grant the user User1 Delete and Write DAC permissions to a file named Test1, type on the page for icacls

icacls test1 /grant User1:(d,wdac)Identify

To grant the user defined by SID S-1-1-0 Delete and Write DAC permissions to a file named TestFile, type on the page for icacls

icacls TestFile /grant *S-1-1-0:(d,wdac)Identify

To take ownership of a file named Lostfile, type on the page for takeown

takeown /f lostfileIdentify

Take ownership of the specified file on the page for takeown

takeown /f path\to\fileIdentify

Take ownership of the specified directory on the page for takeown

takeown /d path\to\directoryIdentify

Take ownership of the specified directory and all subdirectories on the page for takeown

takeown /r /d path\to\directoryIdentify

Change ownership to the Administrator group instead of the current user on the page for takeown

takeown /a /f path\to\fileIdentify

Programs and files it names

their pages here

ATT&CK

the techniques it is tagged with
T1222.001File and Directory Permissions Modification: Windows Permissions