Detect Clear Linux or Mac System Logs in Google Chronicle
Adversaries clear system logs on Linux and macOS to remove evidence of intrusion. Primary targets include /var/log/auth.log or /var/log/secure (authentication), /var/log/syslog or /var/log/messages (general), /var/log/wtmp and /var/log/btmp (login records), and web server logs (/var/log/apache2/, /var/log/nginx/). Common methods include truncating files (echo > /var/log/auth.log), deletion (rm /var/log/*.log), or overwriting with zeros. TeamTNT (crypto-mining), Rocke, Sea Turtle (DNS hijacking), Salt Typhoon (telecom espionage), UPSTYLE (Volt Typhoon PANW exploit), and MacMa (macOS) have all cleared Linux/macOS logs post-compromise.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1070 Indicator Removal
- Sub-technique
- T1070.002 Clear Linux or Mac System Logs
- Canonical reference
- https://attack.mitre.org/techniques/T1070/002/
YARA-L Detection Query
rule linux_mac_system_log_cleared {
meta:
author = "Detection Engineering"
description = "Detects deletion or truncation of Linux and macOS system log files by unauthorized processes — T1070.002"
mitre_attack_tactic = "Defense Evasion"
mitre_attack_technique = "T1070.002"
severity = "HIGH"
priority = "HIGH"
version = "1.0"
events:
(
$e.metadata.event_type = "FILE_DELETION"
or $e.metadata.event_type = "FILE_MODIFICATION"
)
re.regex($e.target.file.full_path, `/var/log/|/Library/Logs/|/private/var/log/`)
(
re.regex($e.target.file.full_path, `\.log$`)
or re.regex($e.target.file.full_path, `(auth\.log|syslog|messages|secure|wtmp|btmp|lastlog|kern\.log)$`)
)
not re.regex($e.principal.process.file.full_path, `(logrotate|newsyslog|rsyslog|syslogd|aslmanager)$`)
condition:
$e
} Chronicle YARA-L 2.0 rule detecting FILE_DELETION and FILE_MODIFICATION UDM events targeting system log paths on Linux (/var/log/) and macOS (/Library/Logs/, /private/var/log/). Matches on log file naming patterns and excludes known log rotation binaries via process path regex.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate log archival and cleanup scripts executed by the root or syslog service account that are not excluded by the process path regex — extend the exclusion regex with additional binary paths as needed
- macOS newsyslog or asl rotation triggered by launchd on a schedule that does not match the aslmanager exclusion — verify principal.process.file.full_path in matched events
- SIEM or observability agent upgrades that briefly modify or recreate log files they are tailing, particularly Elastic Agent or Splunk UF self-update routines
Other platforms for T1070.002
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Clear Linux Auth Log via Truncation
Expected signal: auditd: SYSCALL records showing open with O_TRUNC flag on /var/log/auth.log. File modification event captured by endpoint telemetry. rsyslog may log a restart after the file is truncated if it monitors file size.
- Test 2Delete /var/log Files Using rm
Expected signal: auditd: SYSCALL records for creat/open (file creation) and unlink (file deletion). File creation and deletion events in endpoint telemetry. The file creation followed immediately by deletion pattern is anomalous.
- Test 3Clear Login History via wtmp Manipulation
Expected signal: auditd: SYSCALL for open with O_TRUNC on /var/log/wtmp. Any process monitoring wtmp (e.g., login daemons) may detect the size change. File modification event in endpoint telemetry for wtmp.
Unlock Pro Content
Get the full detection package for T1070.002 including response playbook, investigation guide, and atomic red team tests.