linux 系统被入侵之后你要做什么
2017-08-19 18:17
423 查看
linux系统的服务器被入侵,总结了以下的基本方法
首先先用iptraf查下,如果没装的运行yum install iptraf装下,看里面是不是UDP包发的很多,如果是,基本都被人装了后门
1. 检查帐户
# less /etc/passwd
# 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. 检查日志
# last(查看正常情况下登录到本机的所有用户的历史记录)
注意”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. 检查进程
# ps -aux(注意UID是0的)
# 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 / -uid 0 –perm -4000 –print
# 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
# 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
6. 检查网络
# ip link | grep PROMISC(正常网卡不该在promisc模式,可能存在sniffer)
# lsof –i
# netstat –nap(察看不正常打开的TCP/UDP端口)
# arp –a
7. 检查计划任务
注意root和UID是0的schedule
# crontab –u root –l
# cat /etc/crontab
# ls /etc/cron.*
8. 检查后门
# cat /etc/crontab
# ls /var/spool/cron/
# cat /etc/rc.d/rc.local
# ls /etc/rc.d
# ls /etc/rc3.d
# find / -type f -perm 4000
9. 检查内核模块
# lsmod
10. 检查系统服务
# chkconfig
# rpcinfo -p(查看RPC服务)
11. 检查rootkit
# rkhunter -c
# chkrootkit -q
12.检查chkconfig 列表,防止一些程序加入到开机自启动中
chkconfig --list
本文出自 “xinsz08の平行时空” 博客,请务必保留此出处http://xinsz08.blog.51cto.com/10565212/1915958
首先先用iptraf查下,如果没装的运行yum install iptraf装下,看里面是不是UDP包发的很多,如果是,基本都被人装了后门
1. 检查帐户
# less /etc/passwd
# 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. 检查日志
# last(查看正常情况下登录到本机的所有用户的历史记录)
注意”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. 检查进程
# ps -aux(注意UID是0的)
# 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 / -uid 0 –perm -4000 –print
# 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
# 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
6. 检查网络
# ip link | grep PROMISC(正常网卡不该在promisc模式,可能存在sniffer)
# lsof –i
# netstat –nap(察看不正常打开的TCP/UDP端口)
# arp –a
7. 检查计划任务
注意root和UID是0的schedule
# crontab –u root –l
# cat /etc/crontab
# ls /etc/cron.*
8. 检查后门
# cat /etc/crontab
# ls /var/spool/cron/
# cat /etc/rc.d/rc.local
# ls /etc/rc.d
# ls /etc/rc3.d
# find / -type f -perm 4000
9. 检查内核模块
# lsmod
10. 检查系统服务
# chkconfig
# rpcinfo -p(查看RPC服务)
11. 检查rootkit
# rkhunter -c
# chkrootkit -q
12.检查chkconfig 列表,防止一些程序加入到开机自启动中
chkconfig --list
本文出自 “xinsz08の平行时空” 博客,请务必保留此出处http://xinsz08.blog.51cto.com/10565212/1915958
相关文章推荐
- linux 系统被入侵之后你要做什么
- linux 系统被入侵之后你要做什么
- 嵌入式linux和嵌入式android系统有什么区别和联系?
- linux内核剖析(零)linux系统启动过程详解-开机加电后发生了什么
- Linux系统的LOG日志文件及入侵后日志的清除
- Linux系统下的C语言开发都需要学些什么
- libnet、libnids、libpcap轻松搭建Linux网络入侵检测系统
- 双系统重装win7之后引导linux(无系统盘)
- Windows系统提供什么样的接口,Unix、Linux系统的用户接口是什么?
- Linux系统的LOG日志文件及入侵后日志的清除
- 什么是最好的网站学习&如何使用Linux系统?
- 安装linux系统之后,开机时没有Windows系统选项的解决办法(Ubuntu,Deepin,Centos,Redhat,Fedora)
- 什么是最好的网站学习&如何使用Linux系统?
- linux系统被入侵后处理经历
- Linux系统下的C语言开发都需要学些什么
- 什么是Linux系统,Linux与UNIX系统区别和Linux的创始人简介
- 系统安全防范之Linux下简单的入侵检测
- linux系统启动过程详解-开机加电后发生了什么 --linux内核剖析(零)
- Linux系统的LOG日志文件及入侵后日志的清除
- Linux3.10内核之后proc文件系统的使用