You find a crypto-miner using 100% CPU under the `www-data` user. Beyond killing it, what do you do?
AdvancedScenarioSecurity, hardening and incident response
Answer
Situation read → The web app was exploited; the miner is just the symptom.
What I'd do →
- Capture
ps,ls -l /proc/<PID>/exe,cat /proc/<PID>/cmdline,ss -tnpbefore killing. - Find persistence:
crontab -l -u www-data,/tmp,/var/tmp,/dev/shm, systemd user units,.bashrc. - Find the entry point in the web logs (RCE, upload of a webshell).
- Rebuild the server, patch the app, rotate secrets the app could read.
- Add prevention:
noexecon/tmpand/dev/shm, egress filtering, and a systemd sandbox for the web service.
Why → If you only kill the process, the cron entry restarts it in a minute.
Interview tip → Mention egress restriction; miners and reverse shells need outbound access.
More on 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?AdvancedAfter the compromise you need to find how the attacker got in. Where do you look?AdvancedYour CISO asks you to harden a fresh Linux server baseline. What's on your list?IntermediateA developer says "SELinux keeps breaking my app, can we just disable it?" How do you respond and what do you do?IntermediateYou need to know when anyone modifies `/etc/sudoers`, `/etc/passwd` or SSH config. How?IntermediateA critical OpenSSL CVE is announced. How do you find and patch affected servers quickly?Intermediate