vps-underattack

VPS 遭受攻击时的排查思路与应急处理方法。

#type / debug #status / growing

[!info] related notes

  • 相关 howto:
  • 相关 MOC:
  • 相关资源:

vps-underattack

现象

2026-06-17 12时左右,突然网络出现问题,查看后发现节点超时,并且不只是当前使用的韩国节点(azure-korea)出错,还有另外一个digital-ocean的美国节点。其他的azure-japan hongkong 的节点都还是正常的。

排查过程

nezha探针

早期有部署过一个哪吒面板(总共连接了其他三个服务器 azure-korea、do-america、aliyun-chengdu)。 一看发现所有都离线了。

ssh 连接

  1. 尝试用 windterm 连接 aliyun(使用的ssh密钥),几周前还能连接,结果这次直接被拒绝了。
  2. 终端使用 ssh 连接 do-america(使用ssh密钥),出现如下提示。
 baker  ssh DO @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the ED25519 key sent by the remote host is SHA256:HQYTxkDpmR78TwBnzBLdgnc/XjrSdsoX2vZt6dPQaOU. Please contact your system administrator. Add correct host key in C:\\Users\\baker/.ssh/known_hosts to get rid of this message. Offending ECDSA key in C:\\Users\\baker/.ssh/known_hosts:74 Host key for 165.227.x.x has changed and you have requested strict checking. Host key verification failed. 

核心意思 你以前连过这个服务器/IP,SSH 记住了它的主机密钥;现在对方发来的主机密钥变了,所以 SSH 拒绝连接。

  1. azure-korea 的服务器通过 windterm 之前的保存信息连上了,并且节点也恢复正常了一小段时间(1分钟左右),然后突然显示广播重启(我没有执行相关操作),连接就断了。
Linux hhc 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Nov 24 02:05:00 2025 from 115.227.x.x
hhc@hhc:~$ ls
agent.sh  config.yaml
hhc@hhc:~$ ls -al
total 52
drwxr-xr-x 3 hhc  hhc  4096 Nov 24  2025 .
drwxr-xr-x 3 root root 4096 Nov 22  2025 ..
-rw------- 1 hhc  hhc   566 Nov 24  2025 .bash_history
-rw-r--r-- 1 hhc  hhc   220 Jun  6  2025 .bash_logout
-rw-r--r-- 1 hhc  hhc  3526 Jun  6  2025 .bashrc
-rw-r--r-- 1 hhc  hhc   807 Jun  6  2025 .profile
drwx------ 2 hhc  hhc  4096 Nov 22  2025 .ssh
-rw-r--r-- 1 hhc  hhc     0 Nov 22  2025 .sudo_as_admin_successful
-rw------- 1 hhc  hhc  1062 Nov 24  2025 .viminfo
-rw-r--r-- 1 hhc  hhc   165 Nov 24  2025 .wget-hsts
-rwxr-xr-x 1 hhc  hhc  5331 Nov 24  2025 agent.sh
-rw-r--r-- 1 hhc  hhc  7958 Nov 22  2025 config.yaml
hhc@hhc:~$ sudo 
Broadcast message from root@hhc on pts/0 (Wed 2026-06-17 04:41:47 UTC):

The system will reboot now!

临时操作

暂时先直接进入管理后台关闭了 哪吒探针 相关的 4 个服务器

初步判断(猜测)

  • 服务器被入侵了,攻击者访问了服务器并且修改了相关连接配置。(让我之前的密钥失效了)
  • 被攻击的关键点可能是 哪吒面板,大概版本较旧,出现了漏洞,被利用了。

解决方案

请教一下优雅的解决方案,是要直接重置,还是可以简单处理。 服务器上面有部署一些服务,重置的话就需要重新部署了。

回归验证

创建于 2026/6/17 更新于 2026/7/15