Ch3nyang's blog collections_bookmark

post

person

about

category

category

local_offer

tag

rss_feed

rss

我的服务器成了 DDoS 的肉鸡

calendar_month 2025-01
archive 安全
tag dns tag vps

悲报!我的一台 VPS 成了 DNS 反射放大攻击的肉鸡!

今天上 HostEONS 看来一眼,发现我的一台 VPS 的带宽异常飙升,每天的上传流量达到了 10 个 G。

HostEONS

我一看,这流量不对劲啊,怎么会这么高?

我赶紧登录服务器,跑了一下 iftop,发现我服务器的 48083 端口在疯狂访问 one.one.one.one:domaindns.google:domain。结合高上传流量低下载流量,我立刻意识到,我的服务器成了 DNS 反射放大攻击的肉鸡!

首先火速改掉了 SSH 的端口和密码。然后来排查恶意进程。

首先看看和 5343083 端口关联的进程:

lsof -i :53
lsof -i :43083

什么也没有。那还是先看看它在请求什么站点的 DNS 吧:

sudo tcpdump -i eth0 -n udp port 53 -vvv

然后发现全在访问 *.nv.gov*.us.gov*.gov 等老美的政府网站。鉴于这台 VPS 位置在 LA,请求这些玩意儿倒也算合理。

我又看了下

  • top
  • crontab
  • 隐藏进程
  • 最近修改/删除的可执行文件
  • 最近的用户登录

但什么异常也没看到。我还跑了下 Rootkit,也是一无所获。

抽象了啊,这个问题有点难搞!

然而,这台服务器上还跑着几个网站,重装系统有点麻烦。我决定把这个问题搁置,先配一下 iptables,把不用的端口都关掉,然后再看看情况。

$ iptables -L
Chain INPUT (policy DROP)
target     prot opt source    destination
ACCEPT     all  --  anywhere  anywhere
ACCEPT     all  --  anywhere  anywhere  ctstate RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere  anywhere  tcp dpt:PORT ctstate NEW limit: avg 5/min burst 5
ACCEPT     tcp  --  anywhere  anywhere  tcp dpt:PORT
ACCEPT     udp  --  anywhere  anywhere  udp dpt:3478
ACCEPT     udp  --  anywhere  anywhere  udp dpts:50000:51000
ACCEPT     tcp  --  anywhere  anywhere  tcp dpt:http
ACCEPT     tcp  --  anywhere  anywhere  tcp dpt:https
ACCEPT     icmp --  anywhere  anywhere  icmp echo-request limit: avg 1/sec burst 5
SYN_FLOOD  tcp  --  anywhere  anywhere  tcp flags:FIN,SYN,RST,ACK/SYN

Chain FORWARD (policy DROP)
target     prot opt source    destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source    destination

Chain SYN_FLOOD (1 references)
target     prot opt source    destination
RETURN     all  --  anywhere  anywhere  limit: avg 1/sec burst 3
DROP       all  --  anywhere  anywhere

现在,53 就访问不了了,不过我也没有需要访问它的服务。

目前来看,服务器暂时安全了。后面有时间我再排查排查,看看能不能把这个恶意进程揪出来。

Comments

Share This Post