Skip to content

Commit 74dac8f

Browse files
authored
Refine syslog clearing detection rules
Updated the title and description for clarity. Added new command selections for syslog clearing techniques and refined existing selections.
1 parent 22937bb commit 74dac8f

1 file changed

Lines changed: 64 additions & 24 deletions

File tree

rules/linux/process_creation/proc_creation_lnx_clear_syslog.yml

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,87 @@
1-
title: Commands to Clear or Remove the Syslog
1+
title: Syslog Clearing or Removal Via System Utilities
22
id: 3fcc9b35-39e4-44c0-a2ad-9e82b6902b31
33
status: test
4-
description: Detects specific commands commonly used to remove or empty the syslog. Which is often used by attacker as a method to hide their tracks
4+
description: |
5+
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
56
references:
67
- https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1070.002/T1070.002.md
78
- https://www.virustotal.com/gui/file/54d60fd58d7fa3475fa123985bfc1594df26da25c1f5fbc7dfdba15876dd8ac5/behavior
89
author: Max Altgelt (Nextron Systems), Roberto Rodriguez (Cyb3rWard0g), OTR (Open Threat Research), MSTIC
910
date: 2021-10-15
10-
modified: 2025-08-18
11+
modified: 2025-10-15
1112
tags:
1213
- attack.defense-evasion
1314
- attack.t1070.002
1415
logsource:
1516
product: linux
1617
category: process_creation
1718
detection:
18-
selection:
19+
selection_file:
20+
CommandLine|contains: '/var/log/syslog'
21+
selection_command_rm:
22+
# Examples:
23+
# rm -f /var/log/syslog
24+
Image|endswith:
25+
- '/rm'
26+
CommandLine|contains:
27+
- ' -r '
28+
- ' -f '
29+
- ' -rf '
30+
- '/var/log/syslog' # We use this to avoid re-writing a separate selection
31+
selection_command_unlink:
32+
# Examples:
33+
# unlink /var/log/syslog
34+
Image|endswith: '/unlink'
35+
selection_command_mv:
36+
# Examples:
37+
# mv /var/log/syslog
38+
Image|endswith: '/mv'
39+
selection_command_truncate:
40+
# Examples:
41+
# truncate --size 0 /var/log/syslog
42+
Image|endswith: '/truncate'
43+
CommandLine|contains|all:
44+
- '0 '
45+
- '/var/log/syslog' # We use this to avoid re-writing a separate selection
46+
CommandLine|contains:
47+
- '-s '
48+
- '-c '
49+
- '--size'
50+
selection_command_ln:
51+
# Examples:
52+
# ln -sfn /dev/null /var/log/syslog
53+
Image|endswith: '/ln'
54+
CommandLine|contains|all:
55+
- '/dev/null '
56+
- '/var/log/syslog' # We use this to avoid re-writing a separate selection
57+
CommandLine|contains:
58+
- '-sf '
59+
- '-sfn '
60+
- '-sfT '
61+
selection_command_cp:
62+
# Examples:
63+
# cp /dev/null /var/log/syslog
64+
Image|endswith: '/cp'
65+
CommandLine|contains: '/dev/null'
66+
selection_command_shred:
67+
# Examples:
68+
# shred -u /var/log/syslog
69+
Image|endswith: '/shred'
70+
CommandLine|contains: '-u '
71+
selection_unique_other:
1972
CommandLine|contains:
20-
- 'rm /var/log/syslog'
21-
- 'rm -r /var/log/syslog'
22-
- 'rm -f /var/log/syslog'
23-
- 'rm -rf /var/log/syslog'
24-
- 'unlink /var/log/syslog' # removed other variants because of potential mixup with rm, unlink doesnt support those flags
25-
- 'mv /var/log/syslog'
26-
- ' >/var/log/syslog'
2773
- ' > /var/log/syslog'
28-
- 'cp /dev/null /var/log/syslog'
29-
- 'ln -sf /dev/null /var/log/syslog' # link command variants
30-
- 'ln -sfn /dev/null /var/log/syslog'
31-
- 'ln -sfT /dev/null /var/log/syslog'
32-
- 'truncate -s 0 /var/log/syslog' # truncate command variants
33-
- 'truncate -c -s 0 /var/log/syslog'
34-
- 'truncate --size 0 /var/log/syslog'
35-
- 'truncate --size=0 /var/log/syslog'
36-
- 'shred -u /var/log/syslog'
74+
- ' >/var/log/syslog'
3775
- ' >| /var/log/syslog' # redirection empties w spacing, noclobber
38-
- '>|/var/log/syslog'
39-
- ':>/var/log/syslog'
40-
- ':> /var/log/syslog'
4176
- ': > /var/log/syslog'
77+
- ':> /var/log/syslog'
78+
- ':>/var/log/syslog'
79+
- '>|/var/log/syslog'
80+
selection_unique_journalctl:
81+
CommandLine|contains:
4282
- 'journalctl --vacuum'
4383
- 'journalctl --rotate' # archives current journal files and creates new empty ones
44-
condition: selection
84+
condition: (selection_file and 1 of selection_command_*) or 1 of selection_unique_*
4585
falsepositives:
4686
- Log rotation.
4787
- Maintenance.

0 commit comments

Comments
 (0)