awk -F: '$3==0 {print $1}' /etc/passwd
#查看是否存在特权用户
awk -F: 'length($2)==0 {print $1}' /etc/shadow
#查看是否存在空口令帐户
awk -F\: '{system("passwd -S "$1)}' /etc/passwd|awk '{print $1,$3}'
#查看账户创建日期
last |head -20 #查看登录信息
grep Failed /var/log/secure |egrep -o '[0-9]{1,3}(\.[0-9]{1,3}){3}' |sort |uniq -c|sort -nr |head -10
ps -aux #注意UID是0的
lsof -p pid #察看该进程所打开端口和文件
#cat /etc/inetd.conf | grep -v “^#”(检查守护进程)
检查隐藏进程
ps -ef|awk '{print }' |sort -n|uniq >1
ls /proc |sort -n |uniq >2
diff 1 2
find / -uid 0 -perm -4000 -print
find / -size +10000k -print| xargs du -sh|sort -nr #10M以上的文件
find / -name “…” -print
find / -name “.. ” -print
find / -name “. ” -print
find / -name ” ” -print
注意SUID文件,可疑大于10M和空格文件
find / -name core -exec ls -l {} ;(检查系统中的core文件)
rpm -qf /bin/ls
rpm -qf /bin/login
md5sum -b 文件名
md5sum -t 文件名
rpm -Va 输出格式:
S - File size differs M - Mode differs (permissions) 5 - MD5 sum differs D - Device number mismatch L - readLink path mismatch U - user ownership differs G - group ownership differs T - modification time differs 注意相关的 /sbin, /bin, /usr/sbin, and /usr/bin
which ps |grep bin 2> /dev/null |xargs rpm -qf &> /dev/null && echo normal || echo change
which cd |grep bin 2> /dev/null |xargs rpm -qf &> /dev/null && echo normal || echo change
which ls |grep bin 2> /dev/null |xargs rpm -qf &> /dev/null && echo normal || echo change
which lsof |grep bin 2> /dev/null |xargs rpm -qf &> /dev/null && echo normal || echo change
which lsof |grep bin 2> /dev/null |xargs rpm -qf &> /dev/null && echo normal || echo change
which netstat |grep bin 2> /dev/null |xargs rpm -qf &> /dev/null && echo normal || echo change
#常用命令检查
ip link | grep PROMISC #正常网卡不该在promisc模式,可能存在sniffer
lsof -i
netstat -pltu #TCP/UDP服务端口检查
arp -a #arp 地址
crontab -u root -l
#查看指定用户是否有计划任务
cat /etc/crontab
#查看计划任务配置
ls -l /etc/cron.*
#查看计划任务创建的时间
ls /var/spool/cron/
#查看计划任务账号
cat /etc/rc.d/rc.local
ls /etc/rc.d
ls /etc/rc3.d
find / -type f -perm 4000
lsmod
chkconfig
systemctl
rpcinfo -p #查看RPC服务(nfs)
rkhunter -c
chkrootkit -q
https://cloud.tencent.com/developer/article/1437957 https://cloud.tencent.com/developer/article/1439648
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有