Log Files, Shell Artifacts & User Analysis
Section 5 of 12
Authentication attempts, sudo usage, SSH logins
# View failed login attempts
grep "Failed password" /var/log/auth.log
# Check sudo usage
grep "sudo" /var/log/auth.log
General system messages, kernel logs, service status
# View recent system messages
tail -f /var/log/syslog
# Search for errors
grep -i "error" /var/log/syslog
Login records - binary format requiring special tools
btmp
Failed logins
lastb
wtmp
All logins
last
lastlog
Last login per user
lastlog
Records of commands executed by users. Golden artifact for understanding user actions and attacker behavior.
/home/[username]/.bash_history
/root/.bash_history
🚩 Red Flags
🔍 Investigate
# View history with timestamps (if enabled)
export HISTTIMEFORMAT='%F %T '
history
# Search for specific commands
grep -i "wget\|curl\|nc\|bash" ~/.bash_history
User account information (world-readable)
username:x:UID:GID:comment:home:shell
root:x:0:0:root:/root:/bin/bash
john:x:1001:1001:John Doe:/home/john:/bin/bash
Password hashes (root-only)
username:$6$hash...:last:min:max:warn
root:$6$random$longhash...
Check who has sudo privileges and what they can execute
# View sudoers file (carefully!)
cat /etc/sudoers
# Check user's sudo privileges
sudo -l -U username
# Review sudo logs
grep sudo /var/log/auth.log
Cron jobs automate tasks on Linux. Common persistence mechanism for attackers.
/etc/crontab
System-wide crontab
/etc/cron.d/
Additional cron files
/etc/cron.{hourly,daily,weekly,monthly}/
Scheduled scripts
/var/spool/cron/crontabs/
User crontabs
# Min Hour Day Month Weekday Command
* * * * * /path/to/command
# Run every day at 2 AM
0 2 * * * /backup.sh
Check for:
# List user's cron jobs
crontab -l
# List all user cron jobs (as root)
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done