Detection rules › Sigma

Syslog Clearing or Removal Via System Utilities

Status
test
Severity
high
Log source
product linux, category process_creation
Author
Max Altgelt (Nextron Systems), Roberto Rodriguez (Cyb3rWard0g), OTR (Open Threat Research), MSTIC
Source
github.com/SigmaHQ/sigma

Detects specific commands commonly used to remove or empty the syslog. Which is a technique often used by attacker as a method to hide their tracks

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Syslog Clearing or Removal Via System Utilities
id: 3fcc9b35-39e4-44c0-a2ad-9e82b6902b31
status: test
description: |
    Detects specific commands commonly used to remove or empty the syslog. Which is a technique often used by attacker as a method to hide their tracks
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1070.002/T1070.002.md
    - https://www.virustotal.com/gui/file/54d60fd58d7fa3475fa123985bfc1594df26da25c1f5fbc7dfdba15876dd8ac5/behavior
author: Max Altgelt (Nextron Systems), Roberto Rodriguez (Cyb3rWard0g), OTR (Open Threat Research), MSTIC
date: 2021-10-15
modified: 2025-10-15
tags:
    - attack.defense-impairment
    - attack.t1685.006
logsource:
    product: linux
    category: process_creation
detection:
    selection_file:
        CommandLine|contains: '/var/log/syslog'
    selection_command_rm:
        # Examples:
        #   rm -f /var/log/syslog
        Image|endswith: '/rm'
        CommandLine|contains:
            - ' -r '
            - ' -f '
            - ' -rf '
            - '/var/log/syslog' # We use this to avoid re-writing a separate selection
    selection_command_unlink:
        # Examples:
        #   unlink /var/log/syslog
        Image|endswith: '/unlink'
    selection_command_mv:
        # Examples:
        #   mv /var/log/syslog
        Image|endswith: '/mv'
    selection_command_truncate:
        # Examples:
        #   truncate --size 0 /var/log/syslog
        Image|endswith: '/truncate'
        CommandLine|contains|all:
            - '0 '
            - '/var/log/syslog' # We use this to avoid re-writing a separate selection
        CommandLine|contains:
            - '-s '
            - '-c '
            - '--size'
    selection_command_ln:
        # Examples:
        #   ln -sfn /dev/null /var/log/syslog
        Image|endswith: '/ln'
        CommandLine|contains|all:
            - '/dev/null '
            - '/var/log/syslog' # We use this to avoid re-writing a separate selection
        CommandLine|contains:
            - '-sf '
            - '-sfn '
            - '-sfT '
    selection_command_cp:
        # Examples:
        #   cp /dev/null /var/log/syslog
        Image|endswith: '/cp'
        CommandLine|contains: '/dev/null'
    selection_command_shred:
        # Examples:
        #   shred -u /var/log/syslog
        Image|endswith: '/shred'
        CommandLine|contains: '-u '
    selection_unique_other:
        CommandLine|contains:
            - ' > /var/log/syslog'
            - ' >/var/log/syslog'
            - ' >| /var/log/syslog'  # redirection empties w spacing, noclobber
            - ': > /var/log/syslog'
            - ':> /var/log/syslog'
            - ':>/var/log/syslog'
            - '>|/var/log/syslog'
    selection_unique_journalctl:
        CommandLine|contains:
            - 'journalctl --vacuum'
            - 'journalctl --rotate' # archives current journal files and creates new empty ones
    condition: (selection_file and 1 of selection_command_*) or 1 of selection_unique_*
falsepositives:
    - Log rotation.
    - Maintenance.
level: high

Stages and Predicates

Stage 0: condition

(selection_file and 1 of selection_command_*) or 1 of selection_unique_*

Stage 1: selection_file

selection_file:
    CommandLine|contains: '/var/log/syslog'

Stage 2: selection_command_rm

selection_command_rm:
    Image|endswith: '/rm'
    CommandLine|contains:
        - ' -r '
        - ' -f '
        - ' -rf '
        - '/var/log/syslog'

Stage 3: selection_command_unlink

selection_command_unlink:
    Image|endswith: '/unlink'

Stage 4: selection_command_mv

selection_command_mv:
    Image|endswith: '/mv'

Stage 5: selection_command_truncate

selection_command_truncate:
    Image|endswith: '/truncate'
    CommandLine|contains|all:
        - '0 '
        - '/var/log/syslog'
    CommandLine|contains:
        - '-s '
        - '-c '
        - '--size'

Stage 6: selection_command_ln

selection_command_ln:
    Image|endswith: '/ln'
    CommandLine|contains|all:
        - '/dev/null '
        - '/var/log/syslog'
    CommandLine|contains:
        - '-sf '
        - '-sfn '
        - '-sfT '

Stage 7: selection_command_cp

selection_command_cp:
    Image|endswith: '/cp'
    CommandLine|contains: '/dev/null'

Stage 8: selection_command_shred

selection_command_shred:
    Image|endswith: '/shred'
    CommandLine|contains: '-u '

Stage 9: selection_unique_other

selection_unique_other:
    CommandLine|contains:
        - ' > /var/log/syslog'
        - ' >/var/log/syslog'
        - ' >| /var/log/syslog'
        - ': > /var/log/syslog'
        - ':> /var/log/syslog'
        - ':>/var/log/syslog'
        - '>|/var/log/syslog'

Stage 10: selection_unique_journalctl

selection_unique_journalctl:
    CommandLine|contains:
        - 'journalctl --vacuum'
        - 'journalctl --rotate'

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
  • -f
  • -r
  • -rf
  • > /var/log/syslog
  • >/var/log/syslog
  • >| /var/log/syslog
  • --size
  • -c
  • -s
  • -sf
  • -sfT
  • -sfn
  • -u
  • /dev/null
  • /dev/null
  • /var/log/syslog
  • 0
  • : > /var/log/syslog
  • :> /var/log/syslog
  • :>/var/log/syslog
  • >|/var/log/syslog
  • journalctl --rotate
  • journalctl --vacuum
Imageends_with
  • /cp
  • /ln
  • /mv
  • /rm
  • /shred
  • /truncate
  • /unlink