Ubuntu 被入侵后的应急响应流程
一 目标与原则
二 快速处置与隔离
三 取证与排查要点
grep "Accepted" /var/log/auth.log;失败登录:grep "Failed" /var/log/auth.log。last、lastb、lastlog。ss -tulnp 或 netstat -antlp;可疑外连可结合 lsof -i 定位进程。top/htop;进程树与完整信息:ps -ef、ps aux。/proc 目录枚举的 PID 与 ps 输出,识别异常。cat /etc/passwd、awk -F: '$3==0 {print $1}' /etc/passwd(UID 为 0 的账号)。/etc/shadow 检查空口令、禁用标记(如 *、!、!!)。cat /etc/sudoers、cat /etc/sudoers.d/*,确认无越权配置。crontab -l、cat /etc/crontab、ls /etc/cron.*、ls /var/spool/cron/crontabs。systemctl list-unit-files --type=service --state=enabled、ls /lib/systemd/system/*.service /etc/systemd/system/*.service、cat /etc/rc.local。~/.bashrc、~/.bash_profile、~/.profile、/etc/profile、/etc/bash.bashrc。find / -mtime -1 -ls;异常 SUID/SGID:find / -type f \( -perm -4000 -o -perm -2000 \) -ls。debsums -c;异常则 apt-get install --reinstall <package> 修复。/tmp、/dev/shm)、伪装系统进程。nvidia-smi 观察异常占用与进程。alias 检查是否被重写为空操作以干扰排查。tcpdump -i any -w capture.pcap;必要时用 Wireshark 深入分析。四 常见攻击场景与处置要点
Accepted password 与来源 IP;last 确认成功登录;检查 ~/.ssh/authorized_keys 是否新增公钥。五 恢复与加固清单
apt update && apt full-upgrade -y 更新系统与应用;使用 debsums 持续校验关键包;对关键配置文件设置不可变位(chattr +i)。