|
1 | | -title: Commands to Clear or Remove the Syslog |
| 1 | +title: Syslog Clearing or Removal Via System Utilities |
2 | 2 | id: 3fcc9b35-39e4-44c0-a2ad-9e82b6902b31 |
3 | 3 | 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 |
5 | 6 | references: |
6 | 7 | - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1070.002/T1070.002.md |
7 | 8 | - https://www.virustotal.com/gui/file/54d60fd58d7fa3475fa123985bfc1594df26da25c1f5fbc7dfdba15876dd8ac5/behavior |
8 | 9 | author: Max Altgelt (Nextron Systems), Roberto Rodriguez (Cyb3rWard0g), OTR (Open Threat Research), MSTIC |
9 | 10 | date: 2021-10-15 |
10 | | -modified: 2025-08-18 |
| 11 | +modified: 2025-10-15 |
11 | 12 | tags: |
12 | 13 | - attack.defense-evasion |
13 | 14 | - attack.t1070.002 |
14 | 15 | logsource: |
15 | 16 | product: linux |
16 | 17 | category: process_creation |
17 | 18 | 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: |
19 | 72 | 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' |
27 | 73 | - ' > /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' |
37 | 75 | - ' >| /var/log/syslog' # redirection empties w spacing, noclobber |
38 | | - - '>|/var/log/syslog' |
39 | | - - ':>/var/log/syslog' |
40 | | - - ':> /var/log/syslog' |
41 | 76 | - ': > /var/log/syslog' |
| 77 | + - ':> /var/log/syslog' |
| 78 | + - ':>/var/log/syslog' |
| 79 | + - '>|/var/log/syslog' |
| 80 | + selection_unique_journalctl: |
| 81 | + CommandLine|contains: |
42 | 82 | - 'journalctl --vacuum' |
43 | 83 | - '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_* |
45 | 85 | falsepositives: |
46 | 86 | - Log rotation. |
47 | 87 | - Maintenance. |
|
0 commit comments