Linux Forensic Artifacts Reference
Where the evidence lives on a compromised Linux host, from acquisition to the timeline: system profile and distro differences, filesystem times and deleted files, the journal and login records, accounts, SSH, auditd, persistence, user and package history, network, memory, web servers, containers and cloud agents, and the anti-forensics tells. Commands and paths for Debian, Ubuntu and RHEL-family systems, with what each one shows and what it does not. No account needed.
Acquisition and order of volatility
Collect in order of volatility: memory first, then live state, then the disk. Write everything to external storage, never to the suspect disk, and record the UTC time as you start, because every later record has to be set against it. Then work from the image, mounted so that nothing writes to it.
# 1. Memory (see Memory below), then live state, to external storage
date -u > /mnt/evidence/collected.txt
ps -eo pid,ppid,user,lstart,args --forest > /mnt/evidence/ps.txt
ss -tunap > /mnt/evidence/ss.txt
cat /proc/modules > /mnt/evidence/modules.txt
# Or a scripted collection that follows the order of volatility
./uac -p ir_triage /mnt/evidence
# 2. The disk, hashed as it is read
dcfldd if=/dev/sda of=/mnt/evidence/sda.raw hash=sha256 \
hashlog=/mnt/evidence/sda.raw.sha256
ewfacquire -t /mnt/evidence/sda /dev/sda # E01 with case details| Step | Why it matters |
|---|---|
| UAC | An open-source collector for Linux and other Unix-like systems. Its profiles gather live state, logs, configuration and a filesystem body file, and its documentation says it respects the order of volatility. ir_triage is the triage profile. |
| dcfldd, ewfacquire | Both hash while they read, so the hash describes exactly what was acquired. ewfacquire writes EnCase-format images with case and examiner details in the header. |
| Open LUKS volume | If the host is running with a LUKS volume open, the decrypted device under /dev/mapper/ is readable now and may not be after shutdown. Image it live before you power down. |
# Attach the image read-only and expose its partitions
losetup --read-only --find --show --partscan /mnt/evidence/sda.raw
# LVM inside the image: find the volume groups, activate, list
vgscan; vgchange -ay; lvs
# LUKS: header details, then a read-only mapping (needs the key)
cryptsetup luksDump /dev/loop0p3
cryptsetup open --readonly /dev/loop0p3 evidencenoload, as below, and attach the image through a read-only loop device as well, so no write can reach it even by mistake.# ext4 image: read-only and no journal replay
mount -o ro,noload /dev/loop0p1 /mnt/image
# xfs image: norecovery must be combined with ro
mount -o ro,norecovery /dev/loop0p1 /mnt/image
# Which filesystem is it?
findmnt -no FSTYPE /mnt/imagejournalctl -D, last -f, ausearch -if) so you read the suspect host's records rather than your workstation's.System profile
Before reading any record, establish what the host is: the distribution and version decide where its logs live, and the time zone decides how to read every timestamp that is not already in UTC.
cat /etc/os-release # distribution and version
cat /etc/hostname
ls -l /etc/localtime # symlink to the zone file
cat /etc/timezone # Debian and Ubuntu
timedatectl # live: zone and NTP state
uname -a # live: the running kernel
ls /boot/vmlinuz-* # kernels installed on disk
# When the filesystem was made, usually at installation
tune2fs -l /dev/sda1 | grep -i created
# Boot and shutdown history
journalctl --list-boots
last -x -F reboot shutdown| Artifact | What it tells you |
|---|---|
| /etc/os-release | Distribution, version and ID. If it is missing, /usr/lib/os-release holds the same fields. |
| /etc/localtime | The zone the host keeps local time in. Text logs written in local time need this offset before they can sit on a UTC timeline. |
| tune2fs created | The creation time of an ext filesystem. For a root filesystem made by the installer, it is close to the installation date. |
| last -x | Reboots and shutdowns from wtmp. A reboot inside the incident window can mean a kernel module or a boot-time persistence mechanism being tested. |
Distro differences
The same evidence lives in different places on Debian-family and RHEL-family systems. The table gives the defaults; the configuration on the host (/etc/rsyslog.conf and /etc/rsyslog.d/ for text logs) always wins over the default.
| Evidence | Debian, Ubuntu | RHEL, Fedora, Alma, Rocky |
|---|---|---|
| Authentication log | /var/log/auth.log | /var/log/secure |
| General system log | /var/log/syslog | /var/log/messages |
| cron log | In /var/log/syslog (Ubuntu's separate cron.log rule is commented out) | /var/log/cron |
| Package history | /var/log/dpkg.log, /var/log/apt/history.log | /var/log/dnf.rpm.log, dnf history |
| Package verification | dpkg -V, debsums -c | rpm -Va |
| Per-user crontabs | /var/spool/cron/crontabs/<user> | /var/spool/cron/<user> |
| Apache logs | /var/log/apache2/ | /var/log/httpd/ |
| Network configuration | /etc/netplan/ (Ubuntu), then the renderer's own files | /etc/NetworkManager/system-connections/ |
rsyslog.conf loads imjournal, so the text logs are a filtered copy of what journald received. An entry in one and missing from the other, for the same minute and facility, needs an explanation.Filesystem and timestamps
Every file carries access, modify and change times, and ext4 and xfs (v5) also record a birth time. Current GNU stat prints the birth time where the kernel and filesystem supply it; on an unmounted image, read the inode directly. The relationships between the four are where tampering shows, and where it is easy to overread.
# All timestamps, including Birth where available
stat /path/to/file
# ext4: read the inode from the device or image (read-only by default)
debugfs -R "stat /path/to/file" /dev/sdX1
debugfs -R "stat <1234567>" /dev/sdX1 # by inode number
# ext4: journal records for the block holding that inode
debugfs -R "logdump -i <1234567>" /dev/sdX1
# xfs: print the inode (look for crtime) with the device opened read-only
xfs_db -r -c "inode 1234567" -c "print" /dev/sdX1
# Files whose content changed in a window, and files whose inode did
find / -xdev -newermt "2026-03-15 02:00" ! -newermt "2026-03-15 03:00"
find / -xdev -newerct "2026-03-15 02:00" ! -newerct "2026-03-15 03:00"| Timestamp | What it records and how far to trust it |
|---|---|
| atime | Last access. Mount options such as relatime and noatime suppress most updates, so a stale atime proves nothing. |
| mtime | Last content change. Any user who owns the file can set it with touch -d. |
| ctime | Last inode change (permissions, owner, links, and any mtime change). touch cannot set it, which makes it the better witness when mtime looks wrong. |
| crtime / Birth | When this inode was created on this filesystem. A copy or extraction creates a new inode, so it is when the file arrived here, not when it was first made. |
touch -d produces it, and so do cp -p, tar and package installs, which all preserve an older mtime on a newly created inode. It becomes meaningful when the file sits where those tools do not write, or when ctime and birth fall inside the incident window while mtime claims years earlier.A PHP file in a web root shows an mtime in 2024, which helps it blend in. Its birth time and its ctime both fall at 02:09 on the incident date, and nothing deploys into that directory by copying with preserved times. The 2024 mtime was set after the file was written.
Who wrote it or whether it ran. Birth time also says nothing about the file's history before it reached this filesystem.
The web access log around 02:09 for the request that wrote it; other files with a ctime in the same minute; the ext4 journal records for its inode block.
Deleted files and filesystem internals
A deleted file leaves its directory entry, its inode and its data blocks behind until something reuses them. The Sleuth Kit reads all three from an image without mounting it, and the ext4 journal can hold older copies of the metadata.
# Deleted names, still pointing at an inode
fls -r -d /mnt/evidence/sda1.raw
# The inode: times (including Deleted), size, blocks
istat /mnt/evidence/sda1.raw 1234567
# Its content, if the blocks are still mapped and not reused
icat /mnt/evidence/sda1.raw 1234567 > /mnt/evidence/inode1234567.bin
# ext4: journal copies of the block holding that inode
debugfs -R "logdump -i <1234567>" /mnt/evidence/sda1.raw
# Btrfs: snapshots can hold earlier versions of a file
btrfs subvolume list -s /mnt/image| Artifact | What it tells you |
|---|---|
| fls -d | File names whose directory entries are marked deleted, with the inode each one last pointed to. |
| istat Deleted | The inode's deletion time (dtime on ext). Set against the incident window, it dates the cleanup. |
| icat | The data the inode still maps. If the blocks were reused, the output is another file's content, so check it before you rely on it. |
| logdump -i | Journal transactions that touched the inode's block: earlier versions of the inode, sometimes with the block mappings the live copy has lost. |
| Snapshots | On Btrfs, and on hosts using LVM snapshots, a snapshot taken before the incident is a copy of the filesystem as it was. |
icat recovers nothing from that inode, and the journal and file carving are what is left.Building a timeline
A timeline puts filesystem times, log entries and login records in one sorted list. Build it in UTC, from the image, and record every tool and option, because the timeline is what the report will be checked against.
# Sleuth Kit: a body file from the image, then a sorted timeline
fls -r -m / /mnt/evidence/sda1.raw > body.txt
mactime -b body.txt -d -z UTC > timeline.csv
mactime -b body.txt -d -z UTC 2026-03-15..2026-03-16 # one window
# Live or mounted: GNU find writes the same fields itself
find / -xdev -printf '%T+ %C+ %A+ %u %m %s %p\n' | sort > fs.txt
# plaso: files, logs and many artifact parsers in one timeline
log2timeline.py --storage-file timeline.plaso sda.raw
psort.py -o dynamic -w timeline.csv timeline.plaso| Tool | What it gives you |
|---|---|
| fls -m, mactime | One line per file per timestamp change, labeled m, a, c and b, for allocated and deleted files alike. -z UTC fixes the output zone. |
| find -printf | Content, inode and access times with owner, mode and size, for a live host or a mounted image. It leaves out birth time, which GNU find cannot read on every filesystem; use stat for the files that matter. |
| plaso | Filesystem times plus parsed logs and application records. psort writes UTC unless told otherwise. |
Logs and login records
On systemd hosts the journal is the primary record. Text files such as /var/log/auth.log exist only where a syslog daemon is configured to write them, so check the configuration before you conclude a log is missing. Login accounting is a separate set of files, and Debian 13 replaced it.
# Where the journal is kept: /var/log/journal (persistent) if that
# directory exists, otherwise /run/log/journal (lost at shutdown)
ls -la /var/log/journal /run/log/journal
journalctl --list-boots
# Read a copied or mounted journal, in UTC, by unit
journalctl -D /mnt/image/var/log/journal --utc -o short-iso
journalctl -D /mnt/image/var/log/journal -u ssh --since "2026-03-15 02:00"
systemctl list-unit-files '*ssh*' # the SSH unit name on this host
# Does a syslog daemon write text logs, and where does auth go?
grep -rE "auth|authpriv" /etc/rsyslog.conf /etc/rsyslog.d/
grep -E "Accepted|Failed|sudo" /var/log/auth.log # where configured-u catches all of them. Find the unit name with systemctl list-unit-files rather than assuming one.# Login accounting (util-linux): history, failed logins, current sessions
last -F -f /var/log/wtmp
lastb -F -f /var/log/btmp
who -a /var/run/utmp
lslogins --failed # failed logins per account
# Debian 13 and later: wtmpdb replaces wtmp and last
wtmpdb last -F -f /var/lib/wtmpdb/wtmp.db| Record | What it tells you |
|---|---|
| /var/log/journal/ | Everything journald received, with the process, unit and boot that produced each entry. Read a copy with journalctl -D. |
| /var/log/auth.log | SSH, sudo and PAM messages, where rsyslog's auth,authpriv rule writes them (Ubuntu's default). RHEL-family systems conventionally use /var/log/secure; the rsyslog configuration on the host is the authority. |
| /var/log/secure | RHEL-family authentication log (authpriv.* in the default rsyslog.conf), with /var/log/messages for general messages and /var/log/cron for cron. |
| /run/log/journal/ | A volatile journal, lost at shutdown. With the default Storage=auto, journald keeps its files here unless /var/log/journal exists. |
| /var/log/wtmp | Login and logout history, read with last. |
| /var/log/btmp | Failed logins, read with lastb. Brute-force evidence. |
| /var/run/utmp | Sessions open now, read with who. |
| /var/lib/wtmpdb/wtmp.db | Debian 13 and later. The Debian release notes say util-linux no longer ships last or lastb there, and that the old files will not be usable after 2038. |
Accounts and privilege
New accounts, a second UID 0, a recent password change on a service account and new members of an administrative group are cheap ways to keep access. Each leaves a trace in plain-text files, and sudo logs every command it runs.
# name:password:UID:GID:comment:home:shell
awk -F: '$3==0 || $3>=1000' /etc/passwd # root-equivalent, humans
# Accounts with a usable password, and the day it was last changed
awk -F: '$2 !~ /^[!*]/ {print $1, $3}' /etc/shadow
date -u -d @$((20527*86400)) # day number to a date
grep -E '^(sudo|wheel|adm|docker):' /etc/group
# sudo and su
cat /etc/sudoers; ls -la /etc/sudoers.d/
journalctl _COMM=sudo -o short-iso
grep -E " (sudo|su)(\[[0-9]+\])?: " /var/log/auth.log
ls -la /var/log/sudo-io/ # if I/O logging is on
# Last login per account
lastlog
lastlog2 -d /var/lib/lastlog/lastlog2.db # Debian 13 and later| Artifact | What it tells you |
|---|---|
| /etc/shadow field 3 | The date of the last password change, as days since 1 January 1970 UTC. A change inside the incident window on an account nobody uses is a lead. |
| ! or * password | The account has no usable password. It can still log in with an SSH key, so check its authorized_keys too. |
| docker group | Membership controls the Docker daemon, which runs as root, so it is root access in practice. Treat it like the sudo group. |
| sudo log lines | Each command logged as the invoking user, then TTY, PWD, USER (the target) and COMMAND. sudoers sends these to syslog by default. |
| /var/log/sudo-io | Keystrokes and output of sudo sessions, only where log_input or log_output is set in sudoers. |
| /var/log/lastlog | Most recent login per UID. It is a sparse file indexed by UID, so its apparent size means nothing. |
SSH in depth
SSH is the usual way into and between Linux servers, for administrators and attackers alike. The server log says who got in and how, the key files say who can get back in, and the client files on each account say where the attacker went next.
# Logins: method, account, source address and port
journalctl -u ssh -o short-iso | grep -E "Accepted|Failed|Invalid user"
# (the unit is ssh on Debian and Ubuntu, sshd on RHEL-family systems)
# A key login names the key: match its fingerprint to a key on disk
ssh-keygen -lf /home/alice/.ssh/authorized_keys
# The configuration sshd runs with, including Include'd drop-ins
sshd -T | grep -iE "loglevel|permitrootlogin|authorizedkeys|userrc"
ls -la /etc/ssh/sshd_config.d/
# Per-login hooks and environment
ls -la /home/*/.ssh/rc /root/.ssh/rc /etc/ssh/sshrc
ls -la /home/*/.ssh/environment
# Where this account connected to; works on hashed entries too
ssh-keygen -F 10.0.0.5 -f /home/alice/.ssh/known_hosts| Artifact | What it tells you |
|---|---|
| Accepted publickey | A successful login, logged at the default INFO level with the key type and its SHA256 fingerprint. ssh-keygen -lf on each authorized_keys file finds which key that was. |
| Failed, Invalid user | Password failures and logins for accounts that do not exist are logged at INFO. Failed key attempts are logged only at VERBOSE until they reach half of MaxAuthTries, so a quiet log does not rule out key guessing. |
| authorized_keys options | command= forces a command, from= pins a source, environment= sets variables (only if PermitUserEnvironment allows it). |
| ~/.ssh/rc | Run by sshd at every login for that account, before the shell, when PermitUserRC allows it. A quiet persistence hook. |
| known_hosts | Hosts this account connected to. Ubuntu's client configuration hashes the names, so test candidate addresses with ssh-keygen -F rather than reading the file. |
| $TMPDIR/ssh-*/agent.* | A forwarded or running agent's socket. Whoever can reach it can use the keys it holds without the private key files. |
auditd: kernel-level evidence
Where the journal records what services chose to report, auditd records what the kernel saw, to the extent its rules asked. It is only as good as the rules in force before the incident, so read the rules first. Many hosts never had it running, and that absence is a finding too.
# The rules that define what was captured
auditctl -l
cat /etc/audit/rules.d/*.rules
# Search: by key, file, message type, executable; -i decodes numbers
ausearch -i -k persistence
ausearch -i -f /etc/shadow
ausearch -i -m EXECVE --start today
ausearch -i -x /usr/bin/curl
# Dates follow your locale (en_US: MM/DD/YYYY) and use a 24-hour clock
ausearch -i --start 03/15/2026 02:00:00 --end 03/15/2026 03:00:00
# Copied logs from an image
ausearch -i -if /mnt/image/var/log/audit/
aureport -if /mnt/image/var/log/audit/ -l # logins
aureport -if /mnt/image/var/log/audit/ -x --summary| Search | What it tells you |
|---|---|
| -m EXECVE | Commands executed with their arguments, where a rule watches execve. |
| -f /etc/shadow | Every access to a watched file: credential theft, account tampering. |
| -k <key> | Events tagged by the rule author. The key names tell you what the rules were written to catch. |
| aureport -l | Login attempts recorded by audit, a second source to set against the journal. |
Persistence locations
Finding one foothold is rarely the end, because attackers plant more than one. Work through every mechanism below, then ask the package manager which system files have changed: it is the fastest way to find a trojaned binary or library among thousands.
# Accounts and privilege
awk -F: '$3==0' /etc/passwd # any UID 0 besides root
grep -vE "nologin|false$" /etc/passwd # accounts with a shell
cat /etc/sudoers; ls -la /etc/sudoers.d/
# SSH: keys, key options, and the effective server configuration
find / -xdev -name authorized_keys -exec ls -la {} \;
grep -E "command=|from=|environment=" /root/.ssh/authorized_keys
sshd -T | grep -iE "authorizedkeys|permitrootlogin"# cron and at (Debian paths; other families use /var/spool/cron/<user>)
cat /etc/crontab; ls -la /etc/cron.d /etc/cron.hourly /etc/cron.daily
ls -la /var/spool/cron/crontabs/ # per-user crontabs
ls -la /var/spool/cron/atjobs/ # pending at jobs
# systemd: system and per-user units, generators, timers
ls -la /etc/systemd/system/ /etc/systemd/user/
ls -la /home/*/.config/systemd/user/ /root/.config/systemd/user/
ls -la /etc/systemd/system-generators/
ls -la /usr/local/lib/systemd/system-generators/
systemctl list-timers --all
systemctl cat suspicious.service # unit file plus drop-ins
ls -la /etc/rc.local # run at boot if executable
# Shell start-up files
ls -la /etc/profile /etc/profile.d/ /etc/bash.bashrc
ls -la /root/.bashrc /root/.profile /home/*/.bashrc /home/*/.profile# Library, PAM, device and kernel level
cat /etc/ld.so.preload # preloaded into every program
find /usr/lib /usr/lib64 -name 'pam_*.so' -exec ls -la {} + 2>/dev/null
ls -la /etc/pam.d/
ls -la /etc/udev/rules.d/ # RUN+= starts a program
cat /proc/modules
cat /proc/sys/kernel/modules_disabled
# Which installed files differ from their packages?
dpkg -V # Debian, Ubuntu
rpm -Va # RHEL family
dpkg -S /usr/sbin/sshd; rpm -qf /usr/sbin/sshd # owning package| Location | Mechanism |
|---|---|
| /etc/passwd, /etc/sudoers.d/ | Backdoor accounts, a second UID 0, or a sudo rule granting root. |
| authorized_keys | Password-free re-entry. Key options such as command= and from= can hide a forced command or pin the key to the attacker's address. |
| sshd -T | The configuration sshd actually runs with, including an AuthorizedKeysFile or AuthorizedKeysCommand pointing somewhere unexpected. |
| /var/spool/cron/crontabs/ | Per-user crontabs, missed when only /etc/cron* is checked. |
| ~/.config/systemd/user/ | User units start without root and are missed by a look at /etc/systemd/system alone. |
| system-generators/ | Generators run very early at boot and at every configuration reload, and write the units they create under /run, which does not survive shutdown. |
| /etc/ld.so.preload | A shared object loaded into every dynamically linked program: the classic userland rootkit hook. |
| pam_*.so | A trojaned PAM module that records passwords or accepts a master password. |
| /etc/udev/rules.d/ | A rule whose RUN starts a program when a device appears. |
| dpkg -V, rpm -Va | System files whose size, digest or mode no longer match the package. Configuration files change legitimately; binaries and libraries should not. |
/proc/modules and lsmod. Memory analysis is where it shows (see Memory below). modules_disabled set to 1 means no module can be loaded or unloaded until reboot.More start-up hooks. Less obvious places that run code at boot, at login or on a schedule.
ls -la /etc/update-motd.d/ # Ubuntu: root, every login
ls -la /etc/xdg/autostart/ /home/*/.config/autostart/
ls -la /etc/modules-load.d/ /run/modules-load.d/ /usr/lib/modules-load.d/
cat /etc/anacrontab; ls -la /var/spool/anacron/
ls -la /var/lib/systemd/linger/ # users with lingering
atq; at -c <job> # one pending at job in full
# eBPF programs and links, and anything pinned to bpffs
bpftool prog show; bpftool link show
ls -la /sys/fs/bpf/| Location | Mechanism |
|---|---|
| /etc/update-motd.d/ | On Ubuntu, pam_motd runs every executable script here as root at each interactive login. |
| autostart/ | Desktop entries started when a user logs in to a desktop session. ~/.config/autostart/ overrides the system directory. |
| modules-load.d/ | Kernel modules loaded at every boot. |
| /var/lib/systemd/linger/ | A file per user with lingering on. That user's manager starts at boot and keeps running after logout, so their user units run with nobody logged in. |
| /var/spool/anacron/ | The date each anacron job last ran, one timestamp file per job. |
| bpftool prog show | Every eBPF program loaded in the kernel. Programs attached to tracepoints, sockets or cgroups can be used to hide traffic or files; one pinned under /sys/fs/bpf outlives the process that loaded it. |
Execution and process evidence
What ran, what is running, and what is hiding. On a live host /proc is ground truth for each process; on disk, shell history and file ownership carry the execution story.
# A running process
ls -la /proc/<pid>/exe # "(deleted)" = unlinked binary
tr '\0' ' ' < /proc/<pid>/cmdline; echo
tr '\0' '\n' < /proc/<pid>/environ
ls -la /proc/<pid>/cwd; cat /proc/<pid>/maps
# Recover a binary that was deleted after it started
cp /proc/<pid>/exe /mnt/evidence/pid<pid>.bin
# SUID and SGID files; flag any a package does not own
find / -xdev -perm -4000 -type f 2>/dev/null
find / -xdev -perm -2000 -type f 2>/dev/null
# Shell history per account, and staging areas
ls -la /root/.bash_history /home/*/.bash_history
ls -la /tmp /var/tmp /dev/shm| Artifact | What it tells you |
|---|---|
| /proc/<pid>/exe | The binary behind a process. A target marked "(deleted)" is a program running from a file that no longer exists on disk, and cp recovers it. |
| /proc/<pid>/environ | The environment the process started with, including variables such as LD_PRELOAD. |
| find -perm -4000 | SUID files. Check each against dpkg -S or rpm -qf: one no package owns is a planted escalation until proven otherwise. |
| ~/.bash_history | Commands typed, written when the shell exits. A session still open, or one killed, has not written its history yet. |
| /dev/shm | RAM-backed and world-writable. Anything staged here is gone after a reboot. |
HISTFILE is unset, and HISTCONTROL=ignorespace drops any command typed with a leading space. Check /etc/profile, /etc/bash.bashrc and the user's start-up files for either before reading a short history as a quiet account.User activity beyond bash
Bash history is the history everyone checks, so it is the one an attacker is most likely to clear. Other tools on the host keep their own histories, and a cleanup that stops at bash leaves them behind.
# For each home directory, and /root
H=/home/alice
ls -la $H/.bash_history $H/.zsh_history $H/.python_history
ls -la $H/.mysql_history $H/.lesshst $H/.viminfo $H/.wget-hsts
ls -la $H/.local/share/recently-used.xbel $H/.config/autostart/
ls -la $H/.local/share/Trash/files/ $H/.local/share/Trash/info/
cat $H/.local/share/Trash/info/*.trashinfo| File | What it holds |
|---|---|
| .zsh_history | zsh history, only where the configuration sets HISTFILE: zsh saves nothing when it is unset. The zsh package's recommended start-up file sets ~/.zsh_history. |
| .python_history | Lines typed at the interactive Python prompt, the default history file of Python's site module. |
| .mysql_history | Statements typed in the mysql client, including any that carried a password. |
| .viminfo | Command-line and search history, registers and marks for recently edited files: which files were opened in vim, and what was searched for in them. |
| .lesshst | Search strings and shell commands from less. |
| .wget-hsts | Hosts wget reached over HTTPS that sent an HSTS header: a record of download sources. |
| recently-used.xbel | Files opened through GTK desktop applications, with URIs and times. |
| Trash/info/*.trashinfo | The original path and deletion time of each file moved to the desktop trash. The time has no zone and is local time. |
Software and package history
Attackers install tools, and some replace system packages. The package manager logs every transaction with its time and command line, and its database says which files on disk no longer match what was installed.
# Debian and Ubuntu
grep -E " (install|upgrade|remove|purge) " /var/log/dpkg.log
zgrep -h -A3 "^Start-Date" /var/log/apt/history.log*
debsums -c # changed package files
debsums -ce # changed configuration files
# RHEL family
rpm -qa --last | head -40 # newest installs first
rpm -Va # S size, 5 digest, T mtime
dnf history list; dnf history info <id>
less /var/log/dnf.rpm.log
# Installed outside the package manager
pip list --path /usr/local/lib/python3.12/dist-packages
ls -la /usr/local/bin /usr/local/sbin /opt /home/*/.local/bin| Artifact | What it tells you |
|---|---|
| /var/log/dpkg.log | Every package install, upgrade and removal with date, time, package and version. |
| apt history.log | Each apt transaction as a block: Start-Date, the Commandline that ran it, the packages and End-Date. term.log holds the console output. |
| rpm -qa --last | Installed packages ordered by install time, newest first. |
| debsums -c, rpm -Va | Package files whose content no longer matches the package database. A changed binary under /usr/bin or /usr/sbin is a trojan until proven otherwise. |
| ~/.local/bin, /opt | Software placed by hand or by a language package manager. No system package log records it, so file times are the only record. |
Network and volatile state
Connections, the neighbor cache and the routing table live in kernel memory and are gone at shutdown. Capture them before containment, and tie every connection to a process and the binary behind it.
# Sockets with the owning process
ss -tunap # TCP and UDP, all states
ss -tlnp # listening TCP
lsof -i -n -P # network files per process
lsof -p <pid> # everything one process has open
# The kernel's own table, read directly (addresses in hex)
cat /proc/net/tcp /proc/net/tcp6
# Neighbors, routes, firewall, name resolution
ip neigh show; ip route show
nft list ruleset; iptables-save
cat /etc/resolv.conf /etc/hosts| Artifact | What it tells you |
|---|---|
| ss -tunap | Every connection with its process. An established session to an external address is a candidate C2 or exfiltration channel. |
| ss -tlnp | Listeners. A port owned by a process that is not a service is a backdoor candidate. |
| /proc/net/tcp | The kernel connection table, useful when you suspect a replaced ss or netstat. A kernel rootkit can still filter it. |
| ip neigh | Hosts this machine talked to on the local segment recently: lateral movement leads. |
| /etc/hosts | An added entry redirects a name without touching DNS. |
Network configuration and firewall
Configuration that changes where traffic goes survives a reboot and is easy to miss: a hosts entry, a changed resolver, a proxy, a firewall rule that opens or hides a port.
cat /etc/hosts
ls -l /etc/resolv.conf; cat /etc/resolv.conf
resolvectl show-cache # live, systemd-resolved
ls -la /etc/netplan/ # Ubuntu
ls -la /etc/NetworkManager/system-connections/
nft list ruleset; iptables-save
cat /etc/environment; env | grep -i proxy
grep -ri proxy /etc/apt/apt.conf.d/ /etc/dnf/dnf.conf 2>/dev/null| Artifact | What it tells you |
|---|---|
| /etc/hosts | A name pinned to an address without DNS: redirected updates, a blocked security vendor, or a C2 name resolved locally. |
| /etc/resolv.conf | On systemd-resolved hosts it is a symlink to /run/systemd/resolve/stub-resolv.conf, which lists only 127.0.0.53. On a host that normally uses it, a plain file naming another server is a change to explain. |
| resolvectl show-cache | Names the resolver has cached, on systemd versions that offer it. Live only: it is gone at reboot. |
| system-connections/ | NetworkManager profiles, including VPN and Wi-Fi definitions and, where stored, their secrets. |
| nft, iptables-save | The firewall as it stands. Compare it with the saved configuration: a rule present only in the running set was added at runtime. |
Memory
Memory holds the processes, connections and modules a rootkit hides from userland tools. Acquire it first, with the smallest footprint you can, and analyze offline.
# LiME: a kernel module built for this exact kernel
insmod ./lime-$(uname -r).ko "path=/mnt/evidence/mem.lime format=lime"
# AVML: a static binary; reads /proc/kcore, /dev/crash or /dev/mem
avml acquire /mnt/evidence/mem.limemodules_disabled is 1 or when module signing rejects an unsigned module. Check before you depend on either, and record what blocked you.# Volatility 3: identify the kernel, then use a matching symbol table
vol -f mem.lime banners
# Place the ISF symbol file for that kernel under volatility3/symbols
vol -f mem.lime linux.pslist
vol -f mem.lime linux.pstree
vol -f mem.lime linux.psscan # processes found by scanning
vol -f mem.lime linux.psaux # command lines
vol -f mem.lime linux.sockstat # sockets per process
vol -f mem.lime linux.lsmod
vol -f mem.lime linux.malware.hidden_modules
vol -f mem.lime linux.malware.check_syscall
vol -f mem.lime linux.malware.malfind
vol -f mem.lime linux.bash # history still in memory| Plugin | What it recovers |
|---|---|
| linux.psscan | Processes found by scanning memory. One here and missing from linux.pslist was unlinked from the task list. |
| linux.malware.hidden_modules | Kernel modules present in memory but removed from the module list. |
| linux.malware.check_syscall | System call table entries that point outside the kernel: a hook. |
| linux.malware.malfind | Memory regions that look like injected code. |
| linux.bash | Bash history held by running shells, including commands not yet written to disk. |
banners first to see which kernel you need.On the live host ps and ss look clean, but the firewall keeps logging a connection to one external address. In the memory image, linux.psscan finds a process that linux.pslist does not, and linux.malware.hidden_modules finds a module missing from the module list.
What the process did, or that the module hid it, until you look at the hooks and the process itself.
linux.malware.check_syscall for the hook; dump the process and recover its binary for analysis; set the module's name against dpkg -V or rpm -Va results on disk.
Web and application logs
On a server compromise the web logs often hold the way in. The access log records the request that wrote or called a web shell; the error log often records the paths and failures the access log does not.
# nginx
/var/log/nginx/access.log /var/log/nginx/error.log
# Apache on Debian and Ubuntu
/var/log/apache2/access.log /var/log/apache2/error.log
# Apache on RHEL-family systems
/var/log/httpd/access_log /var/log/httpd/error_log
# POSTs to script files outside the application's known endpoints
grep -E '"POST [^"]*\.php' access.log | grep -vE "wp-admin|wp-cron"
# Command or code parameters in a query string
grep -E "cmd=|exec=|eval\(|base64_decode" access.log
# Requests that touched one suspect file, with their source addresses
grep "/uploads/.cache.php" access.log | awk '{print $1}' | sort | uniq -c| Artifact | What it tells you |
|---|---|
| access.log | Every request with source address, method, path, status and user agent. The first request to a web shell is usually the upload or the exploit that wrote it. |
| error.log | Script errors and file paths from failed or exploited requests, often the clearer record of what an attacker tried. |
access.log.1 and the compressed .gz rotations with zgrep; the first request often predates the current file.# Files in the web root whose inode changed after a date
find /var/www -type f -newerct "2026-03-14" -printf '%C+ %T+ %u %p\n' \
| sort -r
# Files the web server account owns outside its expected paths
find / -xdev -user www-data -type f 2>/dev/null # Debian and UbuntuContainer and cloud
A compromised Linux host is often a container or a cloud instance, and the evidence extends past the box. Containers are short-lived, so the host's view of them matters; cloud instances add the metadata service, which an SSRF bug or a foothold turns into credentials.
# AWS instance metadata. IMDSv1 is a plain GET:
# GET http://169.254.169.254/latest/meta-data/iam/security-credentials/
# IMDSv2 needs a token from a PUT first, then sends it as a header:
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
http://169.254.169.254/latest/meta-data/
# First-boot configuration
cat /var/log/cloud-init.log /var/log/cloud-init-output.log# Docker: every container, its configuration, and what changed in it
docker ps -a
docker inspect <container>
docker diff <container> # A added, C changed, D deleted
ls -la /var/lib/docker/containers/ # per-container logs and config
ls -la /var/lib/docker/overlay2/ # the writable layers
# Kubernetes and CRI runtimes
kubectl get pods -A
kubectl logs <pod> --previous # the container that crashed
crictl ps -a
ls /var/log/containers/ /var/log/pods/| Artifact | What it tells you |
|---|---|
| IMDS request | A request for iam/security-credentials/ from a web process is the SSRF credential-theft pattern. Look for it in proxy, WAF or application logs; the metadata service itself logs nothing on the host. |
| cloud-init logs | What configured the instance at first boot. Unexpected user-data or a provisioning step that adds keys or users shows here. |
| docker diff | Files added, changed or deleted inside a container since it started. |
| overlay2/ | Container writable layers on the host. Files written inside a stopped container are still here until the container is removed. |
| /var/log/pods/ | Container output on a Kubernetes node, which can outlast the pod for a while. |
kubectl, but its logs on the node, the node's journal and the cloud provider's audit logs remain. When the container is gone, pivot to those.# Kubernetes node: runtime and kubelet
crictl ps -a; crictl inspect <container>
journalctl -u kubelet -u containerd -o short-iso
ls -la /etc/kubernetes/manifests/ # static pods (kubeadm)
grep audit-log-path /etc/kubernetes/manifests/kube-apiserver.yaml
# Cloud agents that run commands or manage accounts
ls -la /var/log/amazon/ssm/ # AWS SSM Agent logs
ls -la /var/lib/amazon/ssm/ # SSM stdout and stderr
less /var/log/waagent.log # Azure Linux Agent
ls -la /var/log/azure/ /var/lib/waagent/ # extension logs, files
journalctl -u google-guest-agent -u google-startup-scripts
cat /etc/default/instance_configs.cfg| Artifact | What it tells you |
|---|---|
| Kubernetes audit log | Who did what through the API server. It exists only if the API server was started with --audit-log-path and a policy; on kubeadm clusters, read the flags in the static pod manifest. |
| /etc/kubernetes/manifests/ | Static pods the kubelet runs from files on the node, without the API server. Deleting the pod through kubectl does not remove the file. |
| /var/log/amazon/ssm/ | amazon-ssm-agent.log and errors.log: the commands and executions the agent ran. An attacker with cloud credentials can run commands this way instead of over SSH. |
| waagent.log | The Azure Linux Agent's own log. Each extension it runs logs under /var/log/azure/, and downloaded extension files sit under /var/lib/waagent/. |
| google-guest-agent | The Google guest agent creates accounts and installs SSH keys pushed through instance metadata; startup scripts from metadata run under their own unit. Its configuration is /etc/default/instance_configs.cfg. |
Anti-forensics indicators
Cleanup leaves its own evidence: logs that start mid-incident, history that is empty, files whose times disagree. Treat each as a lead to corroborate against a second source.
# Journal files: internal consistency, and authenticity if sealed
journalctl -D /mnt/image/var/log/journal --verify
# Immutable and append-only flags set to resist removal
lsattr -a /etc/cron.d/* /root/.ssh/authorized_keys
# History redirected or disabled
ls -la /root/.bash_history /home/*/.bash_history
grep -rE "HISTFILE|HISTCONTROL|HISTSIZE" /etc/profile* /etc/bash.bashrc| Indicator | What it means |
|---|---|
| A text log that starts or ends mid-incident | Edited or rotated at an odd time. Compare with the journal, wtmp and the audit log for the same hours. |
| Sequence gaps in one journal file | Each journal file holds only part of the sequence, because journald writes several files in parallel. Read the whole directory together before calling a gap a deletion. |
| journalctl --verify fails | The file is inconsistent. With Forward Secure Sealing set up and the verification key, it also proves whether sealed entries were altered. |
| bash_history linked to /dev/null, or empty | History deliberately discarded. Look for linux.bash in memory and audit EXECVE records. |
| mtime earlier than birth, with a recent ctime | Backdated content time. Rule out copies and package installs first (see Filesystem). |
| Histories that disagree | An empty bash history beside a .viminfo or .lesshst full of recent activity. The cleanup missed the other tools (see User activity). |
| Package files changed | debsums -c or rpm -Va flags a binary such as ps, ss or sshd: a userland rootkit replacing the tools you would use to look. |
| chattr +i on attacker files | Immutable files resist deletion, even by root, until the flag is cleared. |
Quick lookup
| Question | Where to look |
|---|---|
| What is this host, and its zone? | /etc/os-release, /etc/localtime, tune2fs -l, last -x |
| Who logged in, from where? | journalctl -u <ssh unit>, auth.log or secure, last or wtmpdb last |
| Who failed to log in? | lastb or lslogins --failed, "Failed password" in the journal |
| How did they persist? | crontabs, at jobs, systemd system and user units, generators, authorized_keys, sudoers, ld.so.preload, PAM, udev rules, motd scripts, autostart, linger, modules-load.d, eBPF |
| Which system files changed? | dpkg -V or debsums -c, rpm -Va |
| What did they install? | dpkg.log, apt history.log, rpm -qa --last, dnf history, /usr/local, /opt |
| Which account did they add or change? | /etc/passwd, shadow field 3, /etc/group, sudoers.d, lastlog |
| Which key did they use? | Accepted publickey fingerprint, ssh-keygen -lf on authorized_keys |
| Where did they go next? | known_hosts (ssh-keygen -F), shell histories, ip neigh |
| How did they escalate? | SUID files no package owns, sudoers, sudo entries in the journal |
| What ran, or is running? | /proc/<pid>/exe and cmdline, bash history, audit EXECVE |
| Where did they stage tools? | /tmp, /var/tmp, /dev/shm, dot-named directories |
| When did it happen? | find -newermt and -newerct windows, stat and debugfs times, journal timestamps, a mactime or plaso timeline |
| What did they delete? | fls -d and istat, debugfs logdump, Trash .trashinfo files, snapshots |
| What is talking to the network? | ss -tunap, lsof -i, /proc/net/tcp, ip neigh |
| Is something hidden from ps? | Volatility linux.psscan against linux.pslist, linux.malware.hidden_modules |
| Was it a container or cloud compromise? | IMDS requests in app logs, cloud-init logs, docker diff, /var/log/pods, static pod manifests |
| Did a cloud agent run commands? | /var/log/amazon/ssm, /var/log/waagent.log and /var/log/azure, google-guest-agent |
| Did they cover their tracks? | journalctl --verify, lsattr, history settings, mtime before birth |
From artifacts to a defensible Linux investigation
This reference shows where the evidence lives. Linux Endpoint Investigation teaches the method: reconstructing a server compromise end to end across the filesystem, logs, and memory, and proving what happened. Built by cybersecurity professionals who still do the job.
Explore the courseWeekly security engineering insights
Detection techniques, architecture patterns, and operational judgment, every Tuesday.
No spam. Unsubscribe anytime.