Detection rules › Sigma

Chmod Targeting Sensitive Directories

Status
test
Severity
medium
Log source
product linux, category process_creation
Author
Christopher Peacock @SecurePeacock, SCYTHE @scythe_io
Source
github.com/SigmaHQ/sigma

Detects chmod targeting files in sensitive directory paths on Linux systems. Attackers may use chmod to change permissions of files in these directories to maintain persistence, escalate privileges, or disrupt system operations.

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Chmod Targeting Sensitive Directories
id: 6419afd1-3742-47a5-a7e6-b50386cd15f8
status: test
description: |
    Detects chmod targeting files in sensitive directory paths on Linux systems.
    Attackers may use chmod to change permissions of files in these directories to maintain persistence, escalate privileges, or disrupt system operations.
references:
    - https://www.intezer.com/blog/malware-analysis/new-backdoor-sysjoker/
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1222.002/T1222.002.md
author: 'Christopher Peacock @SecurePeacock, SCYTHE @scythe_io'
date: 2022-06-03
modified: 2026-03-18
tags:
    - attack.defense-impairment
    - attack.t1222.002
logsource:
    product: linux
    category: process_creation
detection:
    selection:
        Image|endswith: '/chmod'
        CommandLine|contains:
            - '/tmp/'
            - '/.Library/'
            - '/etc/'
            - '/opt/'
    filter_main_update_shells:
        CommandLine|contains: 'chmod --reference=/etc/shells'
        ParentCommandLine|endswith: '/update-shells'
    filter_main_postinst:
        CommandLine|contains: '/etc/'
        ParentCommandLine|contains|all:
            - '/var/lib/dpkg/info/'
            - '.postinst configure'
    filter_main_apt_key:
        CommandLine|startswith: 'chmod 700 /tmp/apt-key-gpghome.'
    filter_main_mkinitramfs:
        CommandLine|startswith: 'chmod 755 /var/tmp/mkinitramfs'
    filter_main_landscape:
        CommandLine: 'chmod 0775 /etc/landscape/'
    filter_main_ubuntu_apparmor:
        CommandLine: 'chmod 644 /etc/apparmor.d/tunables/home.d/ubuntu'
    condition: selection and not 1 of filter_main_*
falsepositives:
    - Some false positives are to be expected. Apply additional filters as needed before pushing to production.
level: medium

Stages and Predicates

Stage 0: condition

selection and not 1 of filter_main_*

Stage 1: selection

selection:
    Image|endswith: '/chmod'
    CommandLine|contains:
        - '/tmp/'
        - '/.Library/'
        - '/etc/'
        - '/opt/'

Stage 2: not filter_main_*

filter_main_update_shells:
    CommandLine|contains: 'chmod --reference=/etc/shells'
    ParentCommandLine|endswith: '/update-shells'
filter_main_postinst:
    CommandLine|contains: '/etc/'
    ParentCommandLine|contains|all:
        - '/var/lib/dpkg/info/'
        - '.postinst configure'
filter_main_apt_key:
    CommandLine|startswith: 'chmod 700 /tmp/apt-key-gpghome.'
filter_main_mkinitramfs:
    CommandLine|startswith: 'chmod 755 /var/tmp/mkinitramfs'
filter_main_landscape:
    CommandLine: 'chmod 0775 /etc/landscape/'
filter_main_ubuntu_apparmor:
    CommandLine: 'chmod 644 /etc/apparmor.d/tunables/home.d/ubuntu'

Exclusions

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

FieldKindExcluded values
CommandLinematch/etc/
ParentCommandLinematch.postinst configure
ParentCommandLinematch/var/lib/dpkg/info/
CommandLinematchchmod --reference=/etc/shells
ParentCommandLineends_with/update-shells
CommandLineeqchmod 0775 /etc/landscape/
CommandLineeqchmod 644 /etc/apparmor.d/tunables/home.d/ubuntu
CommandLinestarts_withchmod 700 /tmp/apt-key-gpghome.
CommandLinestarts_withchmod 755 /var/tmp/mkinitramfs

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
  • /.Library/
  • /etc/
  • /opt/
  • /tmp/
Imageends_with
  • /chmod