What you'll learn
- Collect and read Linux authentication, journald and audit telemetry
- Detect brute force, sudo abuse, new root accounts and malicious execution
- Triage live processes and hunt persistence on hosts and fleets
- Use file integrity monitoring and eBPF runtime tools
- Build an ATT&CK timeline, collect evidence and harden the server
Each lesson is tagged Junior, Mid or Expert, so you can start where you are. Finish with the lab and the quiz; a score of 4 out of 5 marks the course complete in this browser.
The lessons below are in English for now, because they quote technical names, commands and log fields. An Arabic version is planned.
Course map
Each module moves from fundamentals to applied work to an expert challenge. Exercises have worked solutions: try first, then open the solution. 10 modules · 26 exercises · ~4 hours
- 0Start here: what to watch on a Linux serverJuniorMidExpert20 min · 2 exercises
- 1Authentication logs and journaldJuniorMidExpert25 min · 3 exercises
- 2Accounts, sudo and privilegesJuniorMidExpert20 min · 3 exercises
- 3Processes and /proc: finding what is running nowJuniorMidExpert25 min · 3 exercises
- 4auditd: recording who ran whatJuniorMidExpert30 min · 3 exercises
- 5Hunting persistenceJuniorMidExpert25 min · 3 exercises
- 6File integrity monitoringJuniorMidExpert20 min · 3 exercises
- 7Runtime security with eBPFJuniorMidExpert20 min · 2 exercises
- 8Central collection, detections as code and the timelineJuniorMidExpert25 min · 3 exercises
- 9Response, hardening and the enterprise fleet; cheat sheet and assessmentJuniorMidExpert30 min · 1 exercises
No prior experience is needed. Module 0 covers the architecture, installation and configuration, and sets up the project you extend in every module. Each command is labelled with its impact (read-only, changes files, changes the system, uses the network). Work on a computer or virtual machine you control.
Start here: what to watch on a Linux server
Goal: Understand the Linux telemetry sources, how attackers typically compromise servers, ATT&CK for Linux, and the course investigation.
Servers tell you everything, if you listen
Most of the internet runs on Linux: web servers, databases, containers, cloud instances. Linux records a lot about itself: every login and sudo command in the authentication log, services in journald, and, with auditd, every program executed and file changed. Live state (processes, sockets, open files) is visible in /proc. Security monitoring means collecting the right sources, shipping them off the host, and knowing what attacks look like in them.
Linux intrusions usually follow the same steps: weak or stolen credentials over SSH, or a vulnerable web application; privilege escalation to root (sudo mistakes, SUID files, kernel bugs); a downloaded tool; persistence that survives reboots; and cleanup. Each step leaves traces, but only in the places you collect.
| Telemetry | Where (Ubuntu / RHEL) | Shows |
|---|---|---|
| authentication | /var/log/auth.log · /var/log/secure · journald | SSH logins, sudo, su, account changes |
| system and services | journald (journalctl), /var/log/syslog · messages | service starts, crashes, kernel messages |
| audit | /var/log/audit/audit.log (auditd) | who ran what, which files changed, syscalls |
| processes | /proc, ps, eBPF agents (Falco, Tetragon) | what is running now, its binary, sockets |
| files | FIM (AIDE, Wazuh syscheck, osquery) | changed binaries, configs, keys |
| network | /proc/net, ss, conntrack, flow logs | listening ports, connections |
| packages and config | dpkg / rpm logs, configuration management | what was installed or changed |
The investigation in this course
On 2 December at 03:10, Rimal's tracker server trk-01 was attacked. You will reconstruct what happened from its authentication and audit logs, find a live implant through /proc, hunt the persistence the attacker left in a copy of its filesystem, detect changes with file integrity monitoring, and build the timeline, evidence and fixes. Process, strace, SUID, capability and FIM demos run for real on the build machine.
linuxmon/
├── auth.log, authdetect.py # modules 1-2
├── accounts.py # module 2
├── implant.sh, triage.py # module 3 (a live disguised process)
├── audit.log, auditparse.py # module 4
├── mkhost.sh → host/, hunt.py # module 5 (planted persistence)
├── fim.py, change.sh # module 6
├── timeline.py # module 8
└── collect.sh, harden.py # module 9sudo apt install auditd audispd-plugins aide
sudo systemctl enable --now auditd
sudo journalctl -u ssh --since '1 hour ago'
sudo ausearch -k identity -i --start todayQuick check: An attacker deletes /var/log/auth.log after logging in. What still shows the login?
Ship logs off the host continuously; local logs are the first thing attackers touch.
Exercise 1Junior
Name the log or source that answers each question: (a) who logged in over SSH at 03:14? (b) which commands did they run as root? (c) is anything listening on port 4444 right now?
Worked solution
(a) auth.log or journald (sshd messages). (b) auditd execve records (and sudo lines in auth.log for sudo commands). (c) live state: /proc/net/tcp, ss or lsof, which no log file shows.
Exercise 2Mid
Why does monitoring need both logs and live state?
Worked solution
Logs record events (logins, executions, changes) and survive if shipped off the host; live state shows what is running now, including things that never produced a log line (a process started before logging, or a rootkit hiding its files). Investigations combine both, and live state must be captured before a reboot erases it.
Tools in this course
Kernel audit framework and the systemd journal.
Use it for: the core host telemetry
Integrates with: rsyslog, agents, SIEMs
eBPF runtime detection (Tetragon can also enforce).
Use it for: processes, files, network in real time
Integrates with: Kubernetes, hosts
Open-source agent and SIEM: logs, FIM, rootcheck, vulnerability detection.
Use it for: fleet-wide host monitoring
Integrates with: OpenSearch, Splunk
SIEMs with Linux add-ons and agents.
Use it for: central detection
Integrates with: auditd, journald, osquery
Set up the investigation
Goal: ~/linuxmon holds trk-01's logs and a copy of its filesystem with the attacker's changes.
Authentication logs and journald
Goal: Read sshd, sudo and account messages, detect brute force followed by success, and ship logs off the host.
Accounts, sudo and privileges
Goal: Audit users, password hashes and sudo rules, and understand how sudo mistakes and SUID files become root.
Processes and /proc: finding what is running now
Goal: Triage live processes through /proc: deleted binaries, disguised names, unusual directories and listening sockets.
auditd: recording who ran what
Goal: Understand syscalls, write audit rules for execution, identity files and persistence, and decode audit records into a readable timeline.
Hunting persistence
Goal: Find the ways attackers survive reboots: cron, systemd, SSH keys, ld.so.preload, login scripts, SUID files and file capabilities.
File integrity monitoring
Goal: Baseline critical files, detect changes to binaries, configuration and keys, and keep FIM useful rather than noisy.
Runtime security with eBPF
Goal: Use eBPF-based agents to see and stop process, file and network activity in real time, with less overhead than auditd.
Central collection, detections as code and the timeline
Goal: Ship host telemetry to a SIEM, write portable Sigma rules, and correlate auth, audit and host findings into one ATT&CK timeline.
Response, hardening and the enterprise fleet; cheat sheet and assessment
Goal: Collect evidence in the right order, contain and rebuild, harden SSH and the host, and run Linux security monitoring across a fleet.
Quick reference (the cheat-sheet lessons and the PDF content)
Linux telemetry map
Default Linux logging misses most attacker activity. auditd or an EDR sensor fills the gap.
Linux attack chain to watch
Most Linux intrusions end in crypto-mining or a foothold for later. Catch them at persistence.
Where attackers hide (check these first)
/etc/cron*/var/spool/cron/etc/systemd/system~/.config/systemd/user~/.ssh/authorized_keys/etc/rc.local~/.bashrc/etc/profile.d/etc/ld.so.preload/tmp, /dev/shm/etc/passwd (UID 0)/etc/sudoers.dJunior quick wins
- Forward auth and audit logs to the SIEM
- Alert on root SSH logins and new sudoers entries
- Baseline listening ports per server role
- Watch for executions from
/tmpand/dev/shm
Key log files
| File / source | Distro | What it tells you |
|---|---|---|
/var/log/auth.log | Debian, Ubuntu | SSH logins, sudo, su, PAM |
/var/log/secure | RHEL, Rocky, Amazon Linux | Same as auth.log |
/var/log/audit/audit.log | All (auditd) | Syscalls, file watches, executions |
journalctl | systemd distros | Services, kernel, boot; -u sshd --since |
/var/log/syslog, messages | Debian / RHEL | General system events |
/var/log/wtmp, btmp, lastlog | All (binary) | Read with last, lastb, lastlog |
~/.bash_history | Per user | Commands typed (easy to wipe, so don't rely on it) |
| Web server logs | nginx, Apache | Web shells, exploit attempts, odd user agents |
auditd starter rules
# Identity and privilege files
-w /etc/passwd -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/sudoers -p wa -k sudoers
-w /etc/sudoers.d/ -p wa -k sudoers
# Persistence locations
-w /etc/cron.d/ -p wa -k cron
-w /etc/systemd/system/ -p wa -k systemd
-w /root/.ssh/ -p wa -k ssh_keys
-w /etc/ld.so.preload -p wa -k preload
# Every command run as root
-a always,exit -F arch=b64 -S execve -F euid=0 -k root_exec
# Kernel module loading
-a always,exit -F arch=b64 -S init_module,finit_module,delete_module -k modules# Events by key, human readable
ausearch -k identity -i
ausearch -k root_exec --start today
# Failed logins and auth summary
aureport --auth --failed
# Reload rules
augenrules --loadexecve is noisy on busy servers. Exclude known automation accounts and keep the rest.Detection use cases
| Use case | Source | Signal | ATT&CK |
|---|---|---|---|
| SSH brute force | auth.log | Many "Failed password" from one IP | T1110 |
| Login after failures | auth.log | "Accepted" from an IP that failed before | T1078 |
| New SSH key | auditd ssh_keys | Write to authorized_keys | T1098.004 |
| Cron / systemd persistence | auditd cron, systemd | New file in cron or unit directories | T1053.003 · T1543.002 |
| Sudo to a root shell | sudo log | COMMAND=/bin/bash or sudo su - | T1548.003 |
| SUID binary created | auditd / FIM | chmod u+s on a new file | T1548.001 |
| Reverse shell | EDR / execve | bash -i with /dev/tcp, nc -e | T1059.004 |
| Web shell | EDR / execve | Web server user (www-data) spawns sh | T1505.003 |
| Log tampering | auditd / FIM | Truncated logs, cleared history | T1070.002 |
| Crypto-miner | EDR / metrics | Sustained CPU, connections to mining pools | T1496 |
| Kernel module loaded | auditd modules | insmod outside change window | T1547.006 |
SIEM queries
Field names vary by parser. Check yours before deploying.
index=linux sourcetype=linux_secure "Failed password"
| rex "from (?<src_ip>\d+\.\d+\.\d+\.\d+)"
| stats count by src_ip, host
| where count > 20index=linux sourcetype=linux_secure
("Failed password" OR "Accepted")
| rex "from (?<src_ip>\S+)"
| stats count(eval(searchmatch("Failed"))) AS fails
count(eval(searchmatch("Accepted"))) AS wins
by src_ip, host
| where fails > 10 AND wins > 0Syslog
| where ProcessName == "sudo"
| where SyslogMessage has "COMMAND="
| parse SyslogMessage with * "USER=" RunAs " ;" * "COMMAND=" Cmd
| project TimeGenerated, HostName, RunAs, Cmdlogsource: {product: linux, category: process_creation}
detection:
selection:
Image|startswith: ['/tmp/', '/dev/shm/', '/var/tmp/']
condition: selection
tags: [attack.execution, attack.t1059]
level: mediumHost triage in 10 commands
w; last -a | head -20 # who is on, recent logins
ps auxf --sort=-%cpu | head -30 # process tree, top CPU
ss -tulpan # listening and connected sockets with PIDs
ls -la /proc/*/exe 2>/dev/null | grep deleted # running binaries deleted from disk
crontab -l; ls -la /etc/cron* /var/spool/cron # scheduled jobs
systemctl list-units --type=service --state=running
awk -F: '$3==0 {print $1}' /etc/passwd # UID 0 accounts
cat /etc/ld.so.preload 2>/dev/null # library injection
find / -perm -4000 -type f -newer /etc/hostname 2>/dev/null # new SUID files
journalctl -u sshd --since "24 hours ago" | grep -E "Accepted|Failed" Response flow
Rebuild compromised servers from a known-good image. Cleaning in place often misses persistence.
osquery hunting queries
-- Running binaries deleted from disk
SELECT pid, name, path FROM processes WHERE on_disk = 0;
-- Listening ports with owning process
SELECT p.name, l.port, l.address FROM listening_ports l
JOIN processes p USING (pid) WHERE l.port > 0;
-- Persistence and keys
SELECT * FROM crontab;
SELECT * FROM authorized_keys;
SELECT * FROM suid_bin;Hardening that helps detection
Make attacks louder
- SSH: keys only, no root login,
MaxAuthTries 3 - Mount
/tmpand/dev/shmwithnoexec - SELinux / AppArmor in enforcing mode
- Ship logs off-host in real time
- Patch the kernel and sudo quickly: both are favourite privilege-escalation targets
Key terms
- auditd
- The Linux audit daemon: records syscalls and file changes that match rules.
- auid
- Audit user ID: the original login user, kept through sudo and su.
- /proc
- A virtual filesystem showing every running process, its binary, files and sockets.
- Persistence
- A way for an attacker to regain access after reboots or password changes.
- File integrity monitoring
- Detecting changes to important files against a trusted baseline.
- eBPF
- Verified programs running in the kernel, used by tools such as Falco and Tetragon.
Hands-on lab
Knowledge check
Answer all five questions, then check your answers. Each answer comes with a short explanation.
Further reading
- Linux audit documentation (auditd) github.com
- MITRE ATT&CK for Linux attack.mitre.org
- GTFOBins gtfobins.github.io
- Falco rules falco.org
- Tetragon tetragon.io
- osquery osquery.io
- Sigma github.com
Put it into practice
Use these ThreatAI tools to apply what you learned to your own environment.