Detection rules › Sigma

File or Folder Permissions Modifications

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects a file or folder's permissions being modified or tampered with.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: File or Folder Permissions Modifications
id: 37ae075c-271b-459b-8d7b-55ad5f993dd8
status: test
description: Detects a file or folder's permissions being modified or tampered with.
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1222.001/T1222.001.md
    - https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/hh750728(v=ws.11)
    - https://github.com/swagkarna/Defeat-Defender-V1.2.0/tree/ae4059c4276da6f6303b8f53cdff085ecae88a91
author: Jakob Weinzettl, oscd.community, Nasreddine Bencherchali (Nextron Systems)
date: 2019-10-23
modified: 2023-11-21
tags:
    - attack.defense-impairment
    - attack.t1222.001
    - detection.threat-hunting
logsource:
    category: process_creation
    product: windows
detection:
    selection_1:
        Image|endswith:
            - '\cacls.exe'
            - '\icacls.exe'
            - '\net.exe' # "grant" Option available when used with "net share"
            - '\net1.exe' # "grant" Option available when used with "net share"
        CommandLine|contains:
            - '/grant'
            - '/setowner'
            - '/inheritance:r' # Remove all inherited ACEs
    selection_2:
        Image|endswith: '\attrib.exe'
        CommandLine|contains: '-r'
    selection_3:
        Image|endswith: '\takeown.exe' # If this generates FP in your environment. Comment it out or add more suspicious flags and locations
    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'
    filter_optional_avira:
        CommandLine|contains:
            - ':\Program Files (x86)\Avira'
            - ':\Program Files\Avira'
    condition: 1 of selection_* and not 1 of filter_optional_*
falsepositives:
    - Users interacting with the files on their own (unlikely unless privileged users).
    - Dynatrace app
level: medium

Stages and Predicates

Stage 0: condition

1 of selection_* and not 1 of filter_optional_*

Stage 1: selection_1

selection_1:
    Image|endswith:
        - '\cacls.exe'
        - '\icacls.exe'
        - '\net.exe'
        - '\net1.exe'
    CommandLine|contains:
        - '/grant'
        - '/setowner'
        - '/inheritance:r'

Stage 2: selection_2

selection_2:
    Image|endswith: '\attrib.exe'
    CommandLine|contains: '-r'

Stage 3: selection_3

selection_3:
    Image|endswith: '\takeown.exe'

Stage 4: not filter_optional_*

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'
filter_optional_avira:
    CommandLine|contains:
        - ':\Program Files (x86)\Avira'
        - ':\Program Files\Avira'

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
CommandLinematchICACLS C:\ProgramData\dynatrace\gateway\config\config.properties /grant :r
CommandLinematchS-1-5-19:F
CommandLineends_withICACLS C:\ProgramData\dynatrace\gateway\config\connectivity.history /reset
CommandLinematch:\Program Files (x86)\Avira
CommandLinematch:\Program Files\Avira
CommandLinematch:\Program Files\Microsoft VS Code
CommandLinematch\AppData\Local\Programs\Microsoft VS Code

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
CommandLinematch
  • -r corpus 13 (sigma 9, kusto 4)
  • /grant
  • /inheritance:r corpus 2 (sigma 1, splunk 1)
  • /setowner
Imageends_with
  • \attrib.exe corpus 5 (sigma 5)
  • \cacls.exe
  • \icacls.exe corpus 2 (sigma 2)
  • \net.exe corpus 49 (sigma 49)
  • \net1.exe corpus 47 (sigma 47)
  • \takeown.exe corpus 2 (sigma 2)