Linux artifacts
Linux forensics rebuilds activity from logs, shell history, cron and systemd persistence, package integrity and file system timestamps. It is everyday work on compromised servers (web, databases, cloud, containers), where attackers tend to leave webshells, SSH keys, accounts and miners. The artifacts are collected with UAC or another collector and feed the timeline.
What it solves
Section titled “What it solves”A Linux server has no Prefetch or Amcache: evidence of execution is poorer than on Windows and depends heavily on what was configured (auditd, persistent journal, timestamped history). Linux analysis therefore rests on three pillars: authentication and system logs, persistence and file system changes, complemented by memory when the host is still running.
Artifact map
Section titled “Artifact map”| Question | Artifacts |
|---|---|
| Who logged on, and from where? | /var/log/auth.log (Debian/Ubuntu) or /var/log/secure (RHEL), wtmp, btmp, lastlog, sshd journal |
| What did they run? | ~/.bash_history and equivalents, auditd (execve), journal, live processes, sudo in the auth log |
| What persists? | cron, systemd timers and units, authorized_keys, .bashrc/.profile, /etc/ld.so.preload, kernel modules, new accounts |
| What changed? | File MAC(B) times, package verification, recent files in sensitive paths |
| What was it serving? | Application logs: Apache/Nginx, databases, containers |
Authentication and system logs
Section titled “Authentication and system logs”# Accepted and failed SSH logonsgrep -E "Accepted|Failed password|Invalid user" /var/log/auth.log*zgrep -h "Accepted" /var/log/auth.log*.gz # rotated and compressed
# Session binaries: wtmp (successful) and btmp (failed)last -F -i -f /var/log/wtmplastb -F -i -f /var/log/btmp
# journal: filter by service and time window (in UTC)journalctl --utc -u ssh -u sshd --since "2026-11-01" --until "2026-11-03"journalctl --utc --list-boots # reboots: gaps and datesjournalctl --file /mnt/evidence/var/log/journal/*/system.journal # on an image
# sudo and user switchinggrep -E "sudo:|su\[" /var/log/auth.loglastandlastbread binary files; on an image, pass them with-f. On recent systemswtmpmay have been replaced by thewtmpdbdatabase: check what each distribution uses.- The journal is only persistent if
/var/log/journal/exists; otherwise it lives in/runand is lost on reboot. - Apache/Nginx logs are key to initial access on web servers: requests to unknown
.phpfiles,POSTto upload paths, command strings in parameters (webshells and RCE).
Execution: history and auditd
Section titled “Execution: history and auditd”- History files:
~/.bash_history,~/.zsh_history,~/.python_history,~/.mysql_history,~/.viminfo. By default bash does not store times;#<epoch>lines only appear ifHISTTIMEFORMATwas set. - auditd: if there are rules for
execve, it is the closest thing to a process log with command lines.
ausearch -m EXECVE -ts 11/01/2026 00:00:00 -te 11/03/2026 00:00:00 -iaureport -x --summary # most used executablesaureport -l -i # logonsPersistence: where to look
Section titled “Persistence: where to look”flowchart TD
A["Linux persistence"] --> B["cron<br/>/etc/crontab · /etc/cron.d<br/>/var/spool/cron"]
A --> C["systemd<br/>/etc/systemd/system<br/>~/.config/systemd/user"]
A --> D["SSH<br/>~/.ssh/authorized_keys"]
A --> E["Shell<br/>.bashrc · .profile · /etc/profile.d"]
A --> F["Dynamic loader<br/>/etc/ld.so.preload"]
A --> G["Kernel<br/>modules · eBPF"]
A --> H["Accounts<br/>extra UID 0 · sudoers"]
# Accounts with UID 0 besides root, and sudoers entriesawk -F: '$3==0 {print $1}' /etc/passwdcat /etc/sudoers; ls -la /etc/sudoers.d/
# System and user cronls -la /etc/cron.* /var/spool/cron/crontabs/ 2>/dev/null; cat /etc/crontab
# Recently modified systemd units and timersfind /etc/systemd/system /usr/lib/systemd/system ~/.config/systemd -newermt "2026-10-25" -type fsystemctl list-timers --all
# Authorized SSH keys for every userfind / -xdev -name authorized_keys -exec ls -la {} \; -exec cat {} \;
# Library preloading (user-space rootkits)cat /etc/ld.so.preload 2>/dev/nullCron as a mechanism is covered in cron and persistence in general in malware persistence.
System integrity
Section titled “System integrity”Package managers store hashes of installed files and let you detect replaced binaries. Test reproduced in an Ubuntu 24.04 lab after appending one byte to /usr/bin/tac:
$ dpkg --verify coreutils??5?????? /usr/bin/tacThe 5 means the MD5 digest no longer matches the package’s. On RHEL and derivatives the equivalent is rpm -Va (or rpm -V package).
- The hash database lives on the system itself (
/var/lib/dpkg/info/*.md5sums): an attacker with root can modify it. For a reliable check, compare against official packages downloaded from outside. - On minimal images (containers, cloud) verification lists many
missingentries for documentation removed on purpose: it is noise, not compromise. - Unexpected SUID/SGID binaries:
find / -xdev -perm -4000 -type fand compare with a baseline.
File system timestamps and timestomping
Section titled “File system timestamps and timestomping”touch -r or touch -d change the modification and access times, but not the metadata change time (ctime) or the creation time (crtime on ext4). Lab test: a webshell with its time copied from index.html:
$ touch -r index.html img.php$ stat -c '%n | mtime=%y | ctime=%z' img.phpimg.php | mtime=2026-03-01 09:00:00 +0100 | ctime=2026-11-20 13:45:54 +0100The mtime says March; the ctime gives away when it was tampered with. debugfs -R "stat <inode>" or Sleuth Kit’s istat also show crtime on an image. Changing ctime requires altering the system clock or editing the inode directly, which is much noisier. The technique is exploited in depth in the timeline.
- Collection: UAC, Velociraptor (
Linux.Triage.UAC), see system triage. - Analysis:
journalctl,ausearch/aureport,last/lastb, The Sleuth Kit (fls,istat), Plaso for the timeline. - Rootkits: rkhunter and chkrootkit as a first filter, always cross-checked with memory analysis (
linux.malware.check_modules,check_syscall). - Rules: YARA over
/tmp,/dev/shm,/var/wwwand system binaries (YARA).
Anti-forensics
Section titled “Anti-forensics”- History disabled:
unset HISTFILE,HISTSIZE=0,history -cor linking~/.bash_historyto/dev/null. No history for an active account is a signal. - Log editing: deleting lines from
auth.logor emptyingwtmp; cross-check against the journal, remote logs andlastlog. - Rootkits in user space (
LD_PRELOAD,/etc/ld.so.preload) or in the kernel (modules, eBPF) hiding processes, files and connections (rootkits). - Execution from memory: binaries launched from
/dev/shmor viamemfd_createand deleted afterwards; they stay visible as(deleted)in/proc/<pid>/exewhile the process lives. - Timestomping with
touch(see above).
Real-world cases
Section titled “Real-world cases”- Ebury (ESET, May 2024): ESET documented that this OpenSSH backdoor had been used to compromise almost 400,000 Linux, FreeBSD and OpenBSD servers since 2009, and that more than 100,000 were still compromised at the end of 2023. Ebury modifies OpenSSH components to steal credentials. Lesson: package integrity checks and comparison with official binaries are essential on servers, because the compromised component is precisely the one used to administer them.
- XZ Utils backdoor (CVE-2024-3094, March 2024): versions 5.6.0 and 5.6.1 of
xz/liblzmacontained malicious code injected through the build process, able to interfere withsshdauthentication on some distributions. It was discovered through an SSH performance anomaly, before it reached most distributions’ stable releases. Lesson: a signed package that its manager considers “intact” can still be malicious; the version inventory is part of the analysis.
Checklist
Section titled “Checklist”- Collection with UAC or equivalent, memory first if the host is running
- Authentication:
auth.log/secure,wtmp,btmp,lastlog, SSH journal - Execution: every user’s history, auditd if present
- Persistence: cron, systemd (services and timers),
authorized_keys, shell profiles,ld.so.preload, modules, UID 0 accounts - Integrity:
dpkg --verifyorrpm -Vachecked against official packages; new SUID binaries - Timestamps:
ctimeandcrtimeversusmtimeon suspicious files - Application logs for the exposed service (web, database)
- Everything in UTC and merged into the timeline
References
Section titled “References”- UAC: https://github.com/tclahr/uac
- Linux Audit (auditd,
ausearch,aureport): https://github.com/linux-audit/audit-userspace - systemd,
journalctl(1): https://www.freedesktop.org/software/systemd/man/latest/journalctl.html - The Sleuth Kit: https://www.sleuthkit.org/sleuthkit/
- ESET press release on Ebury (May 14, 2024): https://www.eset.com/int/about/newsroom/press-releases/research/eset-research-ebury-botnet-alive-growing-400k-linux-servers-compromised-for-cryptocurrency-theft-and-financial-gain/
- NVD, CVE-2024-3094: https://nvd.nist.gov/vuln/detail/CVE-2024-3094