今天服务器 cpu 直接到 100% 日志中发现/test.html 一直被访问 这是被恶意访问了吗

2019-03-07 10:57:15 +08:00
 zhuzhiqiang

113.96.109.157 - - [07/Mar/2019:08:07:03 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 119.147.39.151 - - [07/Mar/2019:08:07:03 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 121.12.109.39 - - [07/Mar/2019:08:07:03 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 47.106.50.155 - - [07/Mar/2019:08:07:03 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 202.108.249.153 - - [07/Mar/2019:08:07:04 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 60.221.194.35 - - [07/Mar/2019:08:07:05 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 202.99.114.204 - - [07/Mar/2019:08:07:05 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 117.27.235.150 - - [07/Mar/2019:08:07:05 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 122.156.57.161 - - [07/Mar/2019:08:07:05 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 123.6.31.154 - - [07/Mar/2019:08:07:05 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 113.6.227.203 - - [07/Mar/2019:08:07:05 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 121.22.229.26 - - [07/Mar/2019:08:07:06 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 39.96.119.23 - - [07/Mar/2019:08:07:06 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 183.214.130.150 - - [07/Mar/2019:08:07:07 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 120.223.240.35 - - [07/Mar/2019:08:07:07 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 39.96.135.227 - - [07/Mar/2019:08:07:07 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 120.221.154.209 - - [07/Mar/2019:08:07:08 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 118.31.194.149 - - [07/Mar/2019:08:07:08 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 61.168.101.24 - - [07/Mar/2019:08:07:08 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 58.20.147.25 - - [07/Mar/2019:08:07:09 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 118.112.13.205 - - [07/Mar/2019:08:07:10 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 39.96.151.171 - - [07/Mar/2019:08:07:11 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 119.167.151.155 - - [07/Mar/2019:08:07:11 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 27.221.56.150 - - [07/Mar/2019:08:07:11 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 106.60.80.28 - - [07/Mar/2019:08:07:12 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 120.201.253.38 - - [07/Mar/2019:08:07:12 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 111.6.251.48 - - [07/Mar/2019:08:07:12 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 223.111.105.160 - - [07/Mar/2019:08:07:13 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 183.213.20.27 - - [07/Mar/2019:08:07:13 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 119.23.169.196 - - [07/Mar/2019:08:07:13 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 112.29.216.161 - - [07/Mar/2019:08:07:13 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 124.239.234.163 - - [07/Mar/2019:08:07:13 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 61.163.8.22 - - [07/Mar/2019:08:07:14 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 118.190.214.147 - - [07/Mar/2019:08:07:15 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 140.205.253.144 - - [07/Mar/2019:08:07:15 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 111.48.30.40 - - [07/Mar/2019:08:07:15 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1" 27.221.92.164 - - [07/Mar/2019:08:07:15 +0800] "GET /test.html HTTP/1.1" 404 132 "-" "Go-http-client/1.1

6647 次点击
所在节点    信息安全
38 条回复
Steps
2019-03-07 14:15:59 +08:00
求高人解决!
ryd994
2019-03-07 15:07:59 +08:00
直接让 web 服务器给他一个静态页面不就好了。Nginx 和 Apache 都可以轻松实现这个目的。
这点请求量,简单的静态请求不可能打满 CPU。要么有别的恶意请求混在里面。要么这些连接有鬼,比如 HTTP slow post 之类的。tcpdump 抓包分析吧。
Newbing
2019-03-07 15:30:32 +08:00
我也遇到了,每天几十万次的请求。我后面建立了一个默认的页面。
Steps
2019-03-07 15:59:45 +08:00
@ryd994 #22 就算是静态页面 只有 2b 一天几十万次,也有 几个 G 的流量啊
Steps
2019-03-07 16:22:04 +08:00
@zhuzhiqiang #12 我是姐姐,还有,我的 问题和你一模一样的
ryd994
2019-03-07 17:20:53 +08:00
@Steps 从你贴的 log 估测每秒 5 次,往上加一个数量级,50*24*3600 几百 MB 顶天了。你看到的这些都是烟幕弹。每秒 5 次的请求是不可能打出 100%CPU 的。
你可以直接使用 limit_req 控制频率。也可以写个脚本查 404 的频率,再把恶意 IP 加到 ipset 里让 iptables 过滤。

你先把 log 过滤一遍,看还有其他什么鬼。然后还是抓包分析。

不必屏蔽 UA:1.已经是 404 了,屏蔽 UA 也减少不了多少压力 2.换个 UA 还不简单?
opengps
2019-03-07 17:25:57 +08:00
404 不应该导致 cpu 爆满吧
SakuraKuma
2019-03-07 18:18:43 +08:00
fail2ban 检查到这个 test 封 ip
Marsss
2019-03-07 18:24:56 +08:00
触发验证码给他
Steps
2019-03-07 18:32:55 +08:00
@ryd994 #26 我并没有 100% CPU,我只是跑了很多 流量出来。。



这里有请求的次数 503 错误就是被 UA 封闭的
Steps
2019-03-07 18:33:54 +08:00
@ryd994 #26
@SakuraKuma #28 问题就是 IP 从不重复。。这个很害怕的。。
zhuzhiqiang
2019-03-07 18:57:37 +08:00
@CallMeReznov
@Humorce
@LanAiFaZuo
@Marsss
@Newbing
@SakuraKuma
@Steps
@Vhc
@blless
@boris1993
感谢各位 问题已经找到了
不是恶意访问造成的 CPU 100 如果不是 cpu100 还真发现不了这个恶意访问 [捂脸]
Steps
2019-03-08 13:58:48 +08:00
@zhuzhiqiang #32 问题是什么?

恶意访问不管了吗?
zhuzhiqiang
2019-03-08 15:33:12 +08:00
@Steps 恶意访问我也没办法 IP 动态的
导致 CPU100 的问题是 业务写的有问题 SQL 慢查询 [逃跑]
zhuzhiqiang
2019-03-08 15:40:37 +08:00
@Steps 姐姐 我刚刚 awk 统计了下 nginx log /test.html 5 个小时跑了 269247 次[捂脸]
Steps
2019-03-08 21:06:47 +08:00
@zhuzhiqiang #35 是的,我也是 1 天差不多 40 多万次吧。。。

很可怕,不晓得这是怎么回事!
Steps
2019-03-12 09:10:15 +08:00
/t/543424

看下这个,是否你也开了?
WanJiJun
2019-04-03 17:35:23 +08:00
是阿里云动态 CDN 搞的吧,我之前也这样,后来看 https://www.v2ex.com/t/543424,关掉动态加速恢复正常了。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/542018

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX