Interview Prep/Linux/Security, hardening and incident response

Monitoring shows a web server making outbound connections to an unknown IP on port 4444 at 2 AM. You suspect it is compromised. What do you do?

AdvancedScenarioSecurity, hardening and incident response
Answer

Situation read → Contain, preserve evidence, then investigate. Don't "clean" a live box and put it back.

What I'd do →

  1. Contain: pull it out of the load balancer and restrict network at the security group/firewall to your forensic IPs only. Don't power it off yet (memory is evidence).
  2. Capture volatile data:
ss -tanp > /tmp/ir/conns.txt
ps auxwwf > /tmp/ir/ps.txt
ls -l /proc/*/exe 2>/dev/null | grep deleted > /tmp/ir/deleted-exe.txt
last -F > /tmp/ir/last.txt
  1. Snapshot the disk (EBS snapshot) for offline forensics.
  2. Check persistence: crontabs, systemd units, ~/.ssh/authorized_keys, /etc/ld.so.preload, new users.
  3. Rebuild from a known-good image, rotate every credential the host had, and patch the entry point.

Why → You can't trust a compromised kernel or binaries; rebuilding is the only clean state.

Interview tip → Say "isolate, preserve, investigate, rebuild, rotate", and that you'd involve the security team immediately.

All Linux questions Roadmap: Linux

More on Security, hardening and incident response