在 CentOS(以及一般 Linux 系统)上“检测 exploit(漏洞利用/入侵行为)”通常包含系统安全检测、漏洞扫描、入侵痕迹排查三个层面。下面按实用顺序给你一套可操作的方法。
cat /etc/passwd
cat /etc/shadow
重点关注:
awk -F: '$3==0 {print $1}' /etc/passwd
who
w
last
lastlog
异常:
top
ps -ef
重点看:
ps 和 /proc)ls /proc | sort -n > proc.txt
ps -eo pid | sort -n > ps.txt
diff proc.txt ps.txt
find / -perm -4000 -type f 2>/dev/null
看是否有异常 SUID 文件(常见提权 exploit)
ls -la /tmp /var/tmp /dev/shm
exploit 常放这里
crontab -l
ls -la /etc/cron*
systemctl list-unit-files
异常服务、定时任务要重点看
netstat -antup
ss -antup
关注:
yum install -y yum-utils
yum updateinfo list security
或:
yum update --security
yum install epel-release -y
yum install lynis -y
lynis audit system
会给出:
yum install rkhunter -y
rkhunter --check
yum install chkrootkit -y
chkrootkit
/var/log/secure
/var/log/messages
/var/log/audit/audit.log
看:
grep -i "failed" /var/log/secure
常见方向:
可检查内核版本:
uname -a
对照 CVE 判断是否落后
建议:
如果你愿意,可以告诉我:
cat /etc/centos-release)我可以直接给你针对性检测命令或排查清单。