发布网友 发布时间:2022-04-19 23:54
共1个回答
热心网友 时间:2023-06-01 15:51
linux系统的服务器被入侵,总结了以下的基本方法,供不大懂linux服务器网理人员参考考学习。\x0d\x0a首先先用iptraf查下,如果没装的运行yum install iptraf装下,看里面是不是UDP包发的很多,如果是,基本都被人装了后门\x0d\x0a1. 检查帐户\x0d\x0a# less /etc/passwd\x0d\x0a# grep :0: /etc/passwd(检查是否产生了新用户,和UID、GID是0的用户)\x0d\x0a# ls -l /etc/passwd(查看文件修改日期)\x0d\x0a# awk -F: ‘$3= =0 {print $1}’ /etc/passwd(查看是否存在特权用户)\x0d\x0a# awk -F: ‘length($2)= =0 {print $1}’ /etc/shadow(查看是否存在空口令帐户)\x0d\x0a \x0d\x0a2. 检查日志\x0d\x0a# last(查看正常情况下登录到本机的所有用户的历史记录)\x0d\x0a注意”entered promiscuous mode”\x0d\x0a注意错误信息\x0d\x0a注 意Remote Procere Call (rpc) programs with a log entry that includes a large number (> 20) strange characters(-^PM-^PM-^PM-^PM-^PM-^PM-^PM-^PM)\x0d\x0a \x0d\x0a3. 检查进程\x0d\x0a# ps -aux(注意UID是0的)\x0d\x0a# lsof -p pid(察看该进程所打开端口和文件)\x0d\x0a# cat /etc/inetd.conf | grep -v “^#”(检查守护进程)\x0d\x0a检查隐藏进程\x0d\x0a# ps -ef|awk ‘{print }’|sort -n|uniq >1\x0d\x0a# ls /porc |sort -n|uniq >2\x0d\x0a# diff 1 2\x0d\x0a \x0d\x0a4. 检查文件\x0d\x0a# find / -uid 0 _perm -4000 _print\x0d\x0a# find / -size +10000k _print\x0d\x0a# find / -name “?” _print\x0d\x0a# find / -name “.. ” _print\x0d\x0a# find / -name “. ” _print\x0d\x0a# find / -name ” ” _print\x0d\x0a注意SUID文件,可疑大于10M和空格文件\x0d\x0a# find / -name core -exec ls -l {} ;(检查系统中的core文件)\x0d\x0a检查系统文件完整性\x0d\x0a# rpm _qf /bin/ls\x0d\x0a# rpm -qf /bin/login\x0d\x0a# md5sum _b 文件名\x0d\x0a# md5sum _t 文件名\x0d\x0a \x0d\x0a5. 检查RPM\x0d\x0a# rpm _Va\x0d\x0a输出格式:\x0d\x0aS _ File size differs\x0d\x0aM _ Mode differs (permissions)\x0d\x0a5 _ MD5 sum differs\x0d\x0aD _ Device number mismatch\x0d\x0aL _ readLink path mismatch\x0d\x0aU _ user ownership differs\x0d\x0aG _ group ownership differs\x0d\x0aT _ modification time differs\x0d\x0a注意相关的 /sbin, /bin, /usr/sbin, and /usr/bin\x0d\x0a \x0d\x0a6. 检查网络\x0d\x0a# ip link | grep PROMISC(正常网卡不该在promisc模式,可能存在sniffer)\x0d\x0a# lsof _i\x0d\x0a# netstat _nap(察看不正常打开的TCP/UDP端口)\x0d\x0a# arp _a\x0d\x0a \x0d\x0a7. 检查计划任务\x0d\x0a注意root和UID是0的schele\x0d\x0a# crontab _u root _l\x0d\x0a# cat /etc/crontab\x0d\x0a# ls /etc/cron.*\x0d\x0a \x0d\x0a8. 检查后门\x0d\x0a# cat /etc/crontab\x0d\x0a# ls /var/spool/cron/\x0d\x0a# cat /etc/rc.d/rc.local\x0d\x0a# ls /etc/rc.d\x0d\x0a# ls /etc/rc3.d\x0d\x0a# find / -type f -perm 4000\x0d\x0a \x0d\x0a9. 检查内核模块\x0d\x0a# lsmod\x0d\x0a \x0d\x0a10. 检查系统服务\x0d\x0a# chkconfig\x0d\x0a# rpcinfo -p(查看RPC服务)\x0d\x0a \x0d\x0a11. 检查rootkit\x0d\x0a# rkhunter -c\x0d\x0a# chkrootkit -q