Skip to content
Pwnversity
DFIR-LIN-ARTadvanced · 9 min · upd. 2026-11

Linux artifacts

T1053.003T1543.002T1070.006

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.

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.

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
Ventana de terminal
# Accepted and failed SSH logons
grep -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/wtmp
lastb -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 dates
journalctl --file /mnt/evidence/var/log/journal/*/system.journal # on an image
# sudo and user switching
grep -E "sudo:|su\[" /var/log/auth.log
  • last and lastb read binary files; on an image, pass them with -f. On recent systems wtmp may have been replaced by the wtmpdb database: check what each distribution uses.
  • The journal is only persistent if /var/log/journal/ exists; otherwise it lives in /run and is lost on reboot.
  • Apache/Nginx logs are key to initial access on web servers: requests to unknown .php files, POST to upload paths, command strings in parameters (webshells and RCE).
  • History files: ~/.bash_history, ~/.zsh_history, ~/.python_history, ~/.mysql_history, ~/.viminfo. By default bash does not store times; #<epoch> lines only appear if HISTTIMEFORMAT was set.
  • auditd: if there are rules for execve, it is the closest thing to a process log with command lines.
Ventana de terminal
ausearch -m EXECVE -ts 11/01/2026 00:00:00 -te 11/03/2026 00:00:00 -i
aureport -x --summary # most used executables
aureport -l -i # logons
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"]
Ventana de terminal
# Accounts with UID 0 besides root, and sudoers entries
awk -F: '$3==0 {print $1}' /etc/passwd
cat /etc/sudoers; ls -la /etc/sudoers.d/
# System and user cron
ls -la /etc/cron.* /var/spool/cron/crontabs/ 2>/dev/null; cat /etc/crontab
# Recently modified systemd units and timers
find /etc/systemd/system /usr/lib/systemd/system ~/.config/systemd -newermt "2026-10-25" -type f
systemctl list-timers --all
# Authorized SSH keys for every user
find / -xdev -name authorized_keys -exec ls -la {} \; -exec cat {} \;
# Library preloading (user-space rootkits)
cat /etc/ld.so.preload 2>/dev/null

Cron as a mechanism is covered in cron and persistence in general in malware persistence.

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/tac

The 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 missing entries for documentation removed on purpose: it is noise, not compromise.
  • Unexpected SUID/SGID binaries: find / -xdev -perm -4000 -type f and compare with a baseline.

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.php
img.php | mtime=2026-03-01 09:00:00 +0100 | ctime=2026-11-20 13:45:54 +0100

The 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/www and system binaries (YARA).
  • History disabled: unset HISTFILE, HISTSIZE=0, history -c or linking ~/.bash_history to /dev/null. No history for an active account is a signal.
  • Log editing: deleting lines from auth.log or emptying wtmp; cross-check against the journal, remote logs and lastlog.
  • 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/shm or via memfd_create and deleted afterwards; they stay visible as (deleted) in /proc/<pid>/exe while the process lives.
  • Timestomping with touch (see above).
  • 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/liblzma contained malicious code injected through the build process, able to interfere with sshd authentication 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.
  • 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 --verify or rpm -Va checked against official packages; new SUID binaries
  • Timestamps: ctime and crtime versus mtime on suspicious files
  • Application logs for the exposed service (web, database)
  • Everything in UTC and merged into the timeline