Incident Response First-Hour Cheat Sheet: Triage & Containment

First-hour Linux & account compromise triage checklist: preserving volatile network/process state, isolating hosts, and revoking active sessions.

Interactive Target Variable Replacer

Change the target IP or host below and every command block on this page updates to match.

Command Reference

1. Snapshot Active Network Connections & Listeners

Record all established outbound C2 connections and listening sockets before rebooting.

ss -antup > /tmp/ir-netstat.txt && lsof -i -n -P > /tmp/ir-lsof.txt

2. Capture Running Processes & Deleted Binaries

List full command lines and spot running processes whose on-disk binary was deleted.

ps auxwwf > /tmp/ir-ps.txt && ls -l /proc/*/exe 2>/dev/null | grep "(deleted)"

3. Audit Logged-In Users & Recent Auth Events

Check currently active TTY sessions, recent SSH logins, and failed brute-force attempts.

w && last -aiF -n 30 && grep -i "Accepted\|Failed" /var/log/auth.log | tail -n 50

4. Check Persistence: SSH Keys, Systemd & Cron

Inspect authorized_keys and recently modified systemd services.

find /home /root -name "authorized_keys" -exec ls -la {} + && find /etc/systemd/system -mtime -7 -ls

5. Compute SHA-256 Hashes of Suspicious Artifacts

Generate cryptographic digests of suspicious binaries before quarantine.

sha256sum /tmp/suspicious-binary

6. Host Firewall Containment (Preserve Investigation SSH)

Block all outbound traffic except your management IP during containment.

sudo iptables -A INPUT -s 192.0.2.10 -j ACCEPT && sudo iptables -P OUTPUT DROP

Frequently Asked Questions

Why should you never immediately reboot a suspected compromised server?

Rebooting destroys volatile RAM, active network socket tables, in-memory fileless malware processes, and unlinked /proc/*/exe file descriptors that are essential for determining root cause and lateral movement.

What is the correct order of operations after discovering a credential breach?

First revoke active session tokens and OAuth grants, then rotate the password to a unique CSPRNG value, verify MFA devices and forwarding rules, and audit login logs.


Related Guides, Tools & Cheat Sheets