论坛: UNIX系统 标题: SYN攻击 复制本贴地址    
作者: cimsxiyang [cimsxiyang]    版主   登录
环境:
redhat 7.1

症状:
#/usr/local/apache2/apachectl start
#ps -aux
......................
.....httpd进程达到上限
......................
#less /error_log
代码:

[Thu Feb 27 18:52:30 2003] [error] server reached MaxClients setting, consider raising the MaxClients setting 
[Thu Feb 27 19:01:34 2003] [warn] child process 28112 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28113 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28114 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28115 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28116 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28117 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28118 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28119 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28120 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28121 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28122 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28123 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28124 still did not exit, sending a SIGTERM 
[Thu Feb 27 19:01:34 2003] [warn] child process 28125 still did not exit, sending a SIGTERM 
.................................. 


#netstat -a
...............................
.........全部是httpd的SYN_RECV
...............................

由此判断,是80遭受SYN攻击。

临时解决方法:
/*调整socket序列防止SYN攻击*/
/sbin/sysctl -w net.ipv4.tcp_max_syn_backlog=1280
/sbin/sysctl -w net.ipv4.tcp_syncookies=1 
/*路由设置*/
/sbin/sysctl -w net.ipv4.conf.all.accept_source_route=0 
/sbin/sysctl -w net.ipv4.conf.all.forwarding=0 
/sbin/sysctl -w net.ipv4.conf.all.mc_forwarding=0 
/*不响应直接广播. */
/sbin/sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=1

应用以上方法,现在基本上恢复正常,不知道有没有更好的解决方法?







地主 发表时间: 03/03 19:05

回复: bigsea [bigsea]   论坛用户   登录
用防火墙(tcp-wrapper)订立拒绝少于1秒的多次连接的规则就可以了,虽然治标不治本但至少给以解决SYN攻击的问题,还有限制同时打开的Syn半连接数目缩短Syn半连接的time out 时间就大部分的SYN攻击,不知道大家的看法呢

B1层 发表时间: 03/04 23:26

回复: NetDemon [netdemon]   ADMIN   登录
20CN的主机现在就已经 server reached MaxClients setting, consider raising the MaxClients setting 了 ,不过一点事都没有,哈哈,95%idle .

另外errorlog中的[warn]是你stop之后start得太快了,和攻击无关的

事实上这样的攻击方式是完全愚蠢的

B2层 发表时间: 03/05 16:36

回复: cimsxiyang [cimsxiyang]   版主   登录
to  大海:
 
引用:

用防火墙(tcp-wrapper)订立拒绝少于1秒的多次连接的规则就可以了,虽然治标不治本但至少给以解决SYN攻击的问题,


SYN攻击根本没有完成3次握手的过程,而只是client在单一的不停的向server发送带有一个SYN标志的TCP报文,当server收到client的SYN报文后,试图返回一个SYN+ACK的报文,但你的源地址是伪造的,自然是收不到这个包的。server一般会报文重传(再次发送SYN+ACK)并等待一段时间(SYN TIMEOUT)后丢弃这个未完成的连接.打个不恰当的比方:你一个人泼别人一盆水,别人还可能无所谓(造不成什么后果),但如果n多人对它进行泼水,那这就泛滥了,人家不被淹死(TCP/IP栈溢出崩溃),门前的道路(带宽)也被搞的一塌糊涂,使得别人根本无法对其访问。而这和主人每秒接待多少客人无关。

缩短SYN Timeout时间,依赖于对方SYN攻击的频率。如果一味的减少SYN TIMEOUT,也必然将影响正常用户访问
SYN Cookie我查了好多的资料(http://cr.yp.to/syncookies.html),但这个东西也解决不了根本问题,它依赖于攻击者使用真实的IP地址。




[此贴被 夕阳(cimsxiyang) 在 03月05日21时49分 编辑过]

B3层 发表时间: 2003-03-05 21:06:49

论坛: UNIX系统

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号