Sign in Start free

Blue teamFree course

Linux Security Monitoring in Practice

Investigate the compromise of a Linux server from SSH brute force to rootkit: auth logs and journald, accounts and sudo, live /proc triage, auditd rules and records, persistence hunting, file integrity monitoring, eBPF runtime security, Sigma detections, an ATT&CK timeline, evidence collection and hardening.

  • Level Junior → Expert
  • Time 240 min
  • Modules 10
  • Exercises 26 with worked solutions
  • Includes Lab, 5-question quiz, references

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

  1. 0Start here: what to watch on a Linux serverJuniorMidExpert20 min · 2 exercises
  2. 1Authentication logs and journaldJuniorMidExpert25 min · 3 exercises
  3. 2Accounts, sudo and privilegesJuniorMidExpert20 min · 3 exercises
  4. 3Processes and /proc: finding what is running nowJuniorMidExpert25 min · 3 exercises
  5. 4auditd: recording who ran whatJuniorMidExpert30 min · 3 exercises
  6. 5Hunting persistenceJuniorMidExpert25 min · 3 exercises
  7. 6File integrity monitoringJuniorMidExpert20 min · 3 exercises
  8. 7Runtime security with eBPFJuniorMidExpert20 min · 2 exercises
  9. 8Central collection, detections as code and the timelineJuniorMidExpert25 min · 3 exercises
  10. 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.

0

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.

20 min

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.

TelemetryWhere (Ubuntu / RHEL)Shows
authentication/var/log/auth.log · /var/log/secure · journaldSSH logins, sudo, su, account changes
system and servicesjournald (journalctl), /var/log/syslog · messagesservice 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
filesFIM (AIDE, Wazuh syscheck, osquery)changed binaries, configs, keys
network/proc/net, ss, conntrack, flow logslistening ports, connections
packages and configdpkg / rpm logs, configuration managementwhat was installed or changed
DistributionsUbuntuUbuntuDebianDebianRed Hat Enterprise LinuxRed Hat Enterprise LinuxLogsLinuxLinuxFluent BitFluent BitRuntimeFalcoFalcoCiliumCiliumAgentsWazuhWazuhElastic SecurityElastic SecuritySIEMSplunkSplunkOpenSearchOpenSearchAutomationAnsibleAnsiblePythonPythonBashBashDashboardsGrafanaGrafanaSupply chainSigstoreSigstoreThe Linux monitoring toolchain: distributions, logs, eBPF runtime security, agents, SIEMs, automation, dashboards and supply chain.

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.

Brute force40 tries, backupSudo escapefind -exec shSecond rootsysupdate UID 0Implantcurl, /tmp, reverse shellPersistencecron, systemd, keysCover tracksshred auth.log.1
trk-01Ubuntu 24.04, trackerUbuntuNEWAdmins and servicesSSH, sudoLinuxNEWauth.log + journaldAccounts + sudo audit/proc triageauditd rulesPersistence huntFile integrityeBPF runtimeFleet queriesLog shippingSIEM + SigmaATT&CK timelineEvidence + responseHardening + fleetStage 0: trk-01 runs the tracker; logs stay on the host and nobody reads them.
shell
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 9

Quick check: An attacker deletes /var/log/auth.log after logging in. What still shows the login?

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

auditd + journaldOperate

Kernel audit framework and the systemd journal.

Use it for: the core host telemetry

Integrates with: rsyslog, agents, SIEMs

Falco / TetragonRuntime

eBPF runtime detection (Tetragon can also enforce).

Use it for: processes, files, network in real time

Integrates with: Kubernetes, hosts

WazuhSecOps

Open-source agent and SIEM: logs, FIM, rootcheck, vulnerability detection.

Use it for: fleet-wide host monitoring

Integrates with: OpenSearch, Splunk

Splunk / Elastic SecuritySecOps

SIEMs with Linux add-ons and agents.

Use it for: central detection

Integrates with: auditd, journald, osquery

Project step 0

Set up the investigation

Goal: ~/linuxmon holds trk-01's logs and a copy of its filesystem with the attacker's changes.

1

Authentication logs and journald

Goal: Read sshd, sudo and account messages, detect brute force followed by success, and ship logs off the host.

25 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

2

Accounts, sudo and privileges

Goal: Audit users, password hashes and sudo rules, and understand how sudo mistakes and SUID files become root.

20 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

3

Processes and /proc: finding what is running now

Goal: Triage live processes through /proc: deleted binaries, disguised names, unusual directories and listening sockets.

25 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

4

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.

30 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

5

Hunting persistence

Goal: Find the ways attackers survive reboots: cron, systemd, SSH keys, ld.so.preload, login scripts, SUID files and file capabilities.

25 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

6

File integrity monitoring

Goal: Baseline critical files, detect changes to binaries, configuration and keys, and keep FIM useful rather than noisy.

20 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

7

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.

20 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

8

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.

25 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

9

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.

30 min

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

Quick reference (the cheat-sheet lessons and the PDF content)
1

Linux telemetry map

JuniorMid

Default Linux logging misses most attacker activity. auditd or an EDR sensor fills the gap.

Linux hostwhat to collectAuthenticationauth.log / secure: SSH, sudo, suPAM events, failed and accepted loginsauditdexecve, file watches, identity fileskernel modules, privileged commandsjournald / syslogservice starts and stopsforward with rsyslog or syslog-ngProcess telemetryEDR or eBPF sensor (Falco, Tetragon)parent-child, command line, hashesNetworkoutbound connections per processDNS queries, firewall (nftables) logsFile integrity/etc, /bin, /usr/bin, web rootsAIDE, Wazuh FIM, osquery
2

Linux attack chain to watch

JuniorMid

Most Linux intrusions end in crypto-mining or a foothold for later. Catch them at persistence.

1Initial accessSSH brute force,web app exploit2Executionbash, python,curl | sh3Persistencecron, systemd,SSH keys4Priv. escalationsudo, SUID,kernel exploit5Evasionlog wipe,LD_PRELOAD6Impactminers, C2,ransomware

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.d

Junior 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 /tmp and /dev/shm
3

Key log files

Junior
File / sourceDistroWhat it tells you
/var/log/auth.logDebian, UbuntuSSH logins, sudo, su, PAM
/var/log/secureRHEL, Rocky, Amazon LinuxSame as auth.log
/var/log/audit/audit.logAll (auditd)Syscalls, file watches, executions
journalctlsystemd distrosServices, kernel, boot; -u sshd --since
/var/log/syslog, messagesDebian / RHELGeneral system events
/var/log/wtmp, btmp, lastlogAll (binary)Read with last, lastb, lastlog
~/.bash_historyPer userCommands typed (easy to wipe, so don't rely on it)
Web server logsnginx, ApacheWeb shells, exploit attempts, odd user agents
4

auditd starter rules

MidExpert
/etc/audit/rules.d/soc.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
Search and report
# 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 --load
Tune it Root execve is noisy on busy servers. Exclude known automation accounts and keep the rest.
5

Detection use cases

JuniorMid
Use caseSourceSignalATT&CK
SSH brute forceauth.logMany "Failed password" from one IPT1110
Login after failuresauth.log"Accepted" from an IP that failed beforeT1078
New SSH keyauditd ssh_keysWrite to authorized_keysT1098.004
Cron / systemd persistenceauditd cron, systemdNew file in cron or unit directoriesT1053.003 · T1543.002
Sudo to a root shellsudo logCOMMAND=/bin/bash or sudo su -T1548.003
SUID binary createdauditd / FIMchmod u+s on a new fileT1548.001
Reverse shellEDR / execvebash -i with /dev/tcp, nc -eT1059.004
Web shellEDR / execveWeb server user (www-data) spawns shT1505.003
Log tamperingauditd / FIMTruncated logs, cleared historyT1070.002
Crypto-minerEDR / metricsSustained CPU, connections to mining poolsT1496
Kernel module loadedauditd modulesinsmod outside change windowT1547.006
6

SIEM queries

MidExpert

Field names vary by parser. Check yours before deploying.

SPL · SSH brute force
index=linux sourcetype=linux_secure "Failed password"
| rex "from (?<src_ip>\d+\.\d+\.\d+\.\d+)"
| stats count by src_ip, host
| where count > 20
SPL · success after many failures
index=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 > 0
KQL · Sentinel Syslog · sudo commands
Syslog
| where ProcessName == "sudo"
| where SyslogMessage has "COMMAND="
| parse SyslogMessage with * "USER=" RunAs " ;" * "COMMAND=" Cmd
| project TimeGenerated, HostName, RunAs, Cmd
Sigma · execution from /tmp or /dev/shm
logsource: {product: linux, category: process_creation}
detection:
  selection:
    Image|startswith: ['/tmp/', '/dev/shm/', '/var/tmp/']
  condition: selection
tags: [attack.execution, attack.t1059]
level: medium
7

Host triage in 10 commands

JuniorMid
bash · run as root, save output off the host
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" 
8

Response flow

Mid

Rebuild compromised servers from a known-good image. Cleaning in place often misses persistence.

AlertSIEM / EDRPreservememory, disk, logsIsolatefirewall / EDRInvestigatetimeline, entry pointHunt the fleetsame IOCs, same TTPsEradicaterebuild, rotate keys
9

osquery hunting queries

Expert
SQL · osqueryi or fleet
-- 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;
10

Hardening that helps detection

JuniorMid

Make attacks louder

  • SSH: keys only, no root login, MaxAuthTries 3
  • Mount /tmp and /dev/shm with noexec
  • SELinux / AppArmor in enforcing mode
  • Ship logs off-host in real time
  • Patch the kernel and sudo quickly: both are favourite privilege-escalation targets
Try it free threatai.net/soc-gap shows which ATT&CK techniques your Linux log sources can see, and which log source to add next.

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

Premium This part is included in the Premium and Pro plans. Sign in or see the plans to continue.

Knowledge check

Answer all five questions, then check your answers. Each answer comes with a short explanation.

1Many 'Failed password' lines followed by 'Accepted password' from the same IP mean:
2sudo allows a user to run /usr/bin/find as root. This means:
3Which audit field names the human behind a sudo command?
4A process shows exe -> /tmp/.x/kworker (deleted). First action?
5A server was rooted and a kernel module loaded. Best recovery?

Further reading

Put it into practice

Use these ThreatAI tools to apply what you learned to your own environment.