- 论坛徽章:
- 0
|
大家都知道,互联网每时每刻都会存在攻击的可能性,(系统频繁发包,SYN攻击,等等)安全问题是系统管理员不可忽视的一个问题。当系统出现了问题,我们该如何下手,如何去排查系统问题呢?
正巧,今天公司一台线上的Linux系统出现了入侵的问题。(其实这已经困扰了我快一个月的问题了)(DDOS 系统频繁发包)我把我的处理思路分享给大家,如有哪一点说的不到位,请大家指出,并提出宝贵的意见,谢谢。勿喷。
由于是系统在内网发包,把我们的网络都堵塞了,以至于我不能远程登录到linux系统上,查看cacti流量图都查看不了。ping也全部丢包。这时去机房也不可能,所以,我只好等待发包不频繁的时机,趁此登录系统。功夫不负有心人,终于远程登录上系统了。
由于经历这样的问题不只一次,所以登录系统后,直接奔系统进程查看。查看结果如下:
# ps -ef (只显示可疑进程)
root 2013 1 0 10:01 ? 00:00:00 /boot/.IptabLex
root 5953 1 0 10:01 ? 00:00:00 /boot/.IptabLex
root 6035 1 0 10:01 ? 00:00:00 /boot/.IptabLes
root 24852 1 2 14:31 ? 00:04:29 /boot/.IptabLes
root 27322 1 3 15:08 ? 00:03:50 /boot/.IptabLes
由于程序还在发作,所以只保留唯一一个进程,剩下的进程全部kill掉,以便排查系统的根源在哪里
# kill -9 5953 6035 24852
查看打开的文件,及系统关联的文件都有哪些
# lsof -p 27322 ; lsof -p 2013
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
.IptabLes 27322 root cwd DIR 253,0 4096 2 /
.IptabLes 27322 root rtd DIR 253,0 4096 2 /
.IptabLes 27322 root txt REG 104,1 1103243 5905 /boot/.IptabLes
.IptabLes 27322 root 0u REG 253,0 5 98310 /.mylisthbS.pid
.IptabLes 27322 root 1u REG 253,0 5 98313 /.mylisthb.pid
.IptabLes 27322 root 2u sock 0,5 0t0 3442424 can't identify protocol
.IptabLes 27322 root 3u raw 0t0 3445564 00000000:00FF->00000000:0000 st=07
.IptabLes 27322 root 4u raw 0t0 3445565 00000000:00FF->00000000:0000 st=07
.IptabLes 27322 root 5u raw 0t0 3445566 00000000:00FF->00000000:0000 st=07
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
.IptabLex 2013 root cwd DIR 253,0 4096 2 /
.IptabLex 2013 root rtd DIR 253,0 4096 2 /
.IptabLex 2013 root txt REG 104,1 722580 5906 /boot/.IptabLex
.IptabLex 2013 root 0u REG 253,0 5 98309 /.mylisthbSx.pid
.IptabLex 2013 root 1uW REG 253,0 5 98311 /.mylisthbx.pid
.IptabLex 2013 root 2u IPv4 3479690 0t0 TCP 192.168.116.11:10038->59.63.167.168:1001 (ESTABLISHED)
经百度查看59.63.167.168的IP为江西省南昌市 电信
查看Cacti流量图。很遗憾,论坛现在上传图片上传不了。
显示的结果是 Output 300M 跑满了。
查看产生的可疑所有的文件。
# ll -a / (只显示可疑的文件)
-rw-r--r-- 1 root root 5 Jan 12 17:15 .mylisthb.pid
-rw-r--r-- 1 root root 5 Jan 12 10:01 .mylisthbS.pid
-rw-r--r-- 1 root root 5 Jan 12 10:01 .mylisthbSx.pid
-rw-r--r-- 1 root root 5 Jan 12 16:57 .mylisthbx.pid
查看/boot/分区下
# ll -a /boot/
-rw-r--r-- 1 root root 5 Jan 12 10:01 .IptabLes
-rw-r--r-- 1 root root 5 Jan 12 10:01 .IptabLex
-rw-r--r-- 1 root root 5 Jan 12 10:01 IptabLes -> /etc/rc.d/init.d/IptabLes
-rw-r--r-- 1 root root 5 Jan 12 10:01 IptabLex -> /etc/rc.d/init.d/IptabLex
查看/etc/rc.d/init.d/IptabLex和/etc/rc.d/init.d/IptabLes文件内容
# cat /etc/rc.d/init.d/IptabLex
#!/bin/sh
/boot/.IptabLex
exit 0
# cat /etc/rc.d/init.d/IptabLes
#!/bin/sh
/boot/.IptabLes
exit 0
查看两个文件的文件类型,可知是32位的可执行文件
# file /boot/.IptabLex
.IptabLex: sticky ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, statically linked, not stripped
# file /boot/.IptabLes
.IptabLes: sticky ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, statically linked, not stripped
查看message信息
# cat /var/log/message
Jan 12 11:36:24 localhost kernel: .IptabLes[12688]: segfault at 0000000000000000 rip 000000000804e837 rsp 00000000ffeb1fb0 error 4
Jan 12 11:36:39 localhost kernel: .IptabLes[12706]: segfault at 0000000000000000 rip 000000000804e837 rsp 00000000ffeb1fb0 error 4
Jan 12 11:36:54 localhost kernel: .IptabLes[12723]: segfault at 0000000000000000 rip 000000000804e837 rsp 00000000ffeb1fb0 error 4
Jan 12 11:37:10 localhost kernel: .IptabLes[12739]: segfault at 0000000000000000 rip 000000000804e837 rsp 00000000ffeb1fb0 error 4
Jan 12 11:37:46 localhost kernel: .IptabLes[12756]: segfault at 0000000000000000 rip 000000000804e837 rsp 00000000ffeb1fb0 error 4
处理方法,删除关联的文件
# rm -f /.mylisthb* 产生的pid文件
# rm -f /boot/.IptabLex
# rm -f /boot/..IptabLes 编译后的二进制文件
# rm -f /etc/rc.d/init.d/IptabLex
# rm -f /etc/rc.d/init.d/IptabLes
因为这个文件发包基于什么协议,或者基于什么系统命令发包尚未清楚,所以在iptables这无法断定基于什么协议或者基于什么端口进行限制。待大家给一些宝贵的意见。 |
|