我們在使用linux系統的時候經常會擔心被入侵,其實我們是可以檢查出來的,那么你知道怎么linux是否被入侵嗎?下面我們就去看看Linux是否被入侵的檢查方法。
1. 檢查帳戶
?
?
# grep :0: /etc/passwd(檢查是否產生了新用戶,和UID、GID是0的用戶)
# ls -l /etc/passwd(查看文件修改日期)
# awk -F: ‘$3= =0 {print $1}’ /etc/passwd(查看是否存在特權用戶)
# awk -F: ‘length($2)= =0 {print $1}’ /etc/shadow(查看是否存在空口令帳戶)
2. 檢查日志
?
?
?
?
注意”entered promiscuous mode”
?
注意錯誤信息
注 意Remote Procedure Call (rpc) programs with a log entry that includes a large number (> 20) strange characters(-^PM-^PM-^PM-^PM-^PM-^PM-^PM-^PM)
3. 檢查進程
?
?
# lsof -p pid(察看該進程所打開端口和文件)
# cat /etc/inetd.conf | grep -v “^#”(檢查守護進程)
檢查隱藏進程
# ps -ef|awk ‘{print }’|sort -n|uniq >1
# ls /porc |sort -n|uniq >2
# diff 1 2
4. 檢查文件
?
?
?
?
?
# find / -size +10000k –print
# 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 文件名
5. 檢查RPM
?
?
?
?
?
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
6. 檢查網絡
?
?
?
?
?
# lsof –i
# netstat –nap(察看不正常打開的TCP/UDP端口)
# arp –a
7. 檢查計劃任務
?
?
?
?
?
# crontab –u root –l
# cat /etc/crontab
# ls /etc/cron.*
8. 檢查后門
?
?
?
?
?
# ls /var/spool/cron/
# cat /etc/rc.d/rc.local
# ls /etc/rc.d
# ls /etc/rc3.d
# find / -type f -perm 4000
9. 檢查內核模塊
?
?
?
?
10. 檢查系統服務
?
?
?
?
?
# rpcinfo -p(查看RPC服務)
11. 檢查rootkit
?
?
?
?
?
# chkrootkit -q
以上內容就是關于Linux是否被入侵的檢查方法,小編還收集了一些審查Linux系統是否被入侵的方法,這些方法可以添加到你運維例行巡檢中。
新聞熱點
疑難解答