CHAPTER 08 40 MIN READ ADVANCED

Linux Incident Response and Hardening: Investigation Workflow & Baseline Controls

Every earlier chapter in this module taught a skill in isolation: reading accounts, parsing logs, spotting persistence, reading process and network state, catching shell tradecraft, securing containers. This closing chapter pulls all of it into one repeatable investigation workflow, then covers the baseline hardening that prevents a repeat.

Linux incident responselive responsehardening baseline

Linux Live Response

The Digital Forensics, Chapter 1 order of volatility applies to a live Linux host the same way it applies to any system: capture what decays fastest first. On a suspected-compromised host that is still running, that ordering shapes exactly what to pull before anything else changes state.

PriorityWhat To Collect
1 (highest volatility)Running process list and process tree, so parent/child relationships aren't lost when a short-lived process exits.
2A full memory (RAM) image, if the investigation can support it. It is lost entirely at power-off and captures process, network, and injected-code state as a single point-in-time snapshot, matching where memory sits in the Digital Forensics module's order of volatility.
3Active network connections, since a live C2 socket or exfil connection disappears the moment it closes.
4Currently logged-in users and their sessions, before a session ends and that context is gone.
5Loaded kernel modules, to catch a rootkit module before a reboot unloads it.
6 (lowest volatility)Disk-resident evidence: logs and persistence locations, both covered in earlier chapters of this module, which survive a reboot.

A live-response collection script or tool automates this capture in one pass, so the order is enforced consistently instead of depending on an analyst remembering it under pressure.

Why this order: process and network state exist only while the host keeps running. Disk-resident logs and persistence artifacts will still be there in an hour; the process tree and open sockets will not.

Linux Incident Response Workflow

A live-response capture on its own is not an investigation. It feeds into a workflow that decides whether the host is actually compromised and what happens next.

1
Triage
Decide whether this is a real incident, based on the alert or anomaly that triggered the review.
2
Contain
Isolate the host from the network without necessarily powering it off, to preserve memory for capture.
3
Collect
Run live response, plus a full disk image if the investigation needs deeper offline analysis.
4
Analyze
Correlate findings from earlier chapters: accounts, logs, persistence, process and network state.
5
Recover and Harden
Remove the attacker's access, restore the host to a trusted state, and apply controls that stop a repeat.
On containment: pulling network access, rather than cutting power, keeps memory intact for capture. A powered-off host loses everything that only ever existed in RAM.

Common Linux Incident Patterns

Recognizing the pattern points straight at which chapter's skillset to apply first, instead of starting the analysis from scratch every time.

PatternWhere To Look
Web shell dropped on a serverPersistence locations from chapter 4, plus unexpected child processes of the web server from chapter 5.
SSH brute-force or compromised credentialsAuth events from chapter 3, plus account changes from chapter 2.
Cryptomining malwareUnusual sustained CPU use visible in process state from chapter 5.
Container escapeContainer and Docker security controls from chapter 7.

A web server spawning a shell it never should, or CPU pegged at 100% with no obvious cause, are both starting points, not conclusions. They tell the analyst exactly which earlier chapter's technique to reach for next.

Hardening Baseline

Hardening is what turns a one-time recovery into a durable fix. Each control below closes a specific gap this module already covered.

ControlWhat It Does
SSH hardeningKey-based authentication and disabling direct root login, cutting off the most common brute-force and credential-stuffing path.
Least-privilege sudo rulesNarrows chapter 2's sudo risk down to only the specific commands a role actually needs.
Mandatory access control (SELinux or AppArmor)Confines what even a compromised process is allowed to do, beyond what standard file permissions restrict.
auditd configured for execve and file-access monitoringCloses the shell-history-tampering gap from chapter 6 by logging execution independent of any shell's own history file.
Timely security updatesCloses known kernel and package vulnerabilities before chapter 7's escape techniques can use them.
Note: a mandatory access control framework matters because standard Unix permissions are discretionary, an application running as its own user can still do a lot of damage within that user's rights. SELinux and AppArmor add a policy layer on top that restricts even that.

How This Module Fits Together

Every chapter in this module builds toward the same outcome: a Linux investigation that's actually defensible, not a guess backed by a single log line.

1FoundationsChapter 1
→
2Accounts and PrivilegeChapter 2
→
3LoggingChapter 3
→
4PersistenceChapter 4
→
5Process and Network InternalsChapter 5
→
6Shell TradecraftChapter 6
→
7ContainersChapter 7
→
8Incident Response and HardeningChapter 8

No single chapter's skillset catches everything on its own. An attacker who covers their tracks in the shell history from chapter 6 still leaves auth events in chapter 3's logs and a persistence mechanism from chapter 4. The layered approach, account discipline, logging, persistence awareness, process and network visibility, shell tradecraft, container isolation, and a repeatable IR workflow, is what makes a Linux investigation stand up to scrutiny instead of resting on one lucky find.

Key Takeaways

  • Live response on a Linux host follows order of volatility: process list and tree, network connections, logged-in sessions, kernel modules, then disk-resident logs and persistence artifacts.
  • The IR workflow runs triage, containment (network isolation, not necessarily power-off), collection, analysis, and recovery and hardening.
  • Common incident patterns, a web shell, SSH compromise, cryptomining, or container escape, each point to a specific earlier chapter's skillset.
  • Hardening controls include SSH hardening, least-privilege sudo, a mandatory access control framework like SELinux or AppArmor, auditd execve and file monitoring, and timely security updates.
  • SELinux and AppArmor add a policy layer beyond standard discretionary permissions, confining what a compromised process can do even as its own user.
  • No single chapter in this module catches every incident alone; the combination of accounts, logging, persistence, process/network visibility, shell tradecraft, and container security is what makes an investigation defensible.

Knowledge Check

Click an answer to reveal the explanation.

During live response on a running Linux host, which of these should generally be collected first, and why?

Correct answer: B. Process state is more volatile than session lists, kernel modules, or disk-resident evidence, so it needs to be captured before that volatile state changes or disappears.

What does a mandatory access control framework like SELinux or AppArmor add beyond standard Linux file permissions?

Correct answer: C. Standard permissions are discretionary and tied to the running user; a mandatory access control policy adds a separate confinement layer that limits a process regardless of what its user account is otherwise allowed to do.

An analyst finds a web server spawning an unexpected child process. Which chapters' skillsets does this incident pattern point to first?

Correct answer: B. A web shell pattern points straight at persistence locations from chapter 4 and unexpected child processes of the web server from chapter 5, since that's exactly how a dropped web shell typically surfaces.