Active Logs
auth.log or secure - Contains the most recent authentication events in plain text.
Authentication logs are stored as plain text, allowing analysts to parse them using standard Unix utilities (grep, awk, sed) directly from a mounted forensic image (e.g., /mnt/analysis/).
/var/log/auth.log/var/log/secureLinux distributions utilize logrotate to archive older logs and prevent disk exhaustion. When investigating an incident, analysts must never restrict their scope to the current active file.
Active Logs
auth.log or secure - Contains the most recent authentication events in plain text.
Archived Logs
auth.log.1 (recently rotated plain text), auth.log.2.gz (older, compressed). Analysts must utilize zgrep or zcat to search across compressed archives without altering the evidence by extracting them.
Secure Shell (SSH) remains the primary initial access and lateral movement vector for threat actors targeting Linux infrastructure. Pattern matching within these logs reveals the attacker’s methodology.
Identifying how an attacker authenticated provides immediate insight into the compromise severity.
grep "Accepted password" /mnt/analysis/var/log/auth.loggrep "Accepted publickey" /mnt/analysis/var/log/auth.log~/.ssh/authorized_keys file.grep "Failed password" reveals standard brute-force attempts.grep "Invalid user" indicates automated scanning. A high volume of these logs targeting common administrative accounts (e.g., admin, root, oracle) strongly suggests non-targeted mass exploitation attempts.Tracking what a compromised standard user accomplished with administrative rights is a behavioral goldmine. Unless explicitly disabled in the configuration, the sudo utility logs the exact command executed.
grep "COMMAND=" /mnt/analysis/var/log/auth.logA standard sudo log entry follows a strict format:
Feb 6 10:00:00 server sudo: nico : TTY=pts/0 ; PWD=/home/nico ; USER=root ; COMMAND=/usr/bin/cat /etc/shadow
nico (The compromised account)PWD=/home/nico (Working directory at execution time)USER=root (Privileges assumed)COMMAND=/usr/bin/cat /etc/shadow (The executed binary and arguments)Analysts should actively hunt for:
sudo su - or sudo -i. Once an attacker spawns an interactive root shell, individual commands are no longer logged in auth.log. The investigation must immediately pivot to the Linux Shell History (.bash_history) of the root user.sudo awk, sudo find, or sudo nmap.sudo edit or sudo vi targeting critical system files.Threat actors frequently establish persistence by creating backdoor accounts or modifying group memberships. The authentication log meticulously tracks these modifications.
grep "new user" helps identify backdoor accounts disguised as system services (e.g., sysadmin, backup_svc).grep "password changed" tracks unauthorized credential resets.grep "add group" reveals if an attacker added a compromised standard account to highly privileged groups like sudo, wheel, or root.To maximize the efficiency of log analysis during an incident, DFIR teams employ specific correlation strategies.
cat /mnt/analysis/var/log/auth.log | grep "Failed password" | awk '{print $(NF-3)}' | sort | uniq -c | sort -nr | head192.168.x.x or 10.x.x.x). A successful login from another internal server maps the attacker’s lateral movement path.rsyslog or systemd-journald) exhibits suspicious restarts during the incident window, or if there are inexplicable chronological gaps in the text file, it is a high-fidelity indicator of log tampering.