| CVE | CVE-2026-105803 |
| 组件 | Git LFS — tq/custom.go(configureCustomAdapters)、config/git_fetcher.go(readGitConfig) |
| 受影响版本 | 1.3.0 至 3.8.0 |
| 修复版本 | 3.8.1 — 提交 62a727e7/c5b3bff4(锚定正则表达式)、1ecddd43/45c0c51c(访问键)、5182fde/dcfb09ff(远程键);GHSA-x72p-hmqp-46hw |
| CWE | CWE-777(未锚定的正则表达式)、CWE-1286(对输入语法正确性的验证不当) |
| 影响 | 恶意仓库的 .lfsconfig 携带一个构造的键,该键能通过安全键过滤器并伪装成自定义传输选项,导致 Git LFS 在获取对象时注册并执行攻击者选定的命令/二进制文件 |
| 攻击向量 | 仓库控制的配置 — 从恶意仓库克隆/获取 |
| 触发条件 | .lfsconfig 键 lfs.customtransfer.evil.path.access = /tmp/evil-transfer |
存在漏洞的自定义传输匹配器使用了未锚定的正则表达式:
// v3.8.0, tq/custom.go configureCustomAdapters()
pathRegex := regexp.MustCompile(`lfs\.((?i)customtransfer\.([^.]+))\.path`)
该修复将其锚定到完整的键:
// v3.8.1
pathRegex := regexp.MustCompile(`\Alfs\.((?i)customtransfer\.([^.]+))\.path\z`)
两个缺陷串联起来,导致从仓库控制的 .lfsconfig 执行命令:
.lfsconfig 使用 onlySafeKeys=true 解析;以 .access 结尾的键被视为 LFS 访问配置。修复前的匹配器接受任意 *.access 键,甚至收紧后的匹配器也接受 lfs.customtransfer.evil.path.access,因为它以 lfs 开头并以 access 结尾。因此,精心构造的键在两个版本上都能通过过滤器。configureCustomAdapters 使用 lfs\.customtransfer\.([^.]+)\.path 扫描每个配置键——没有锚点。嵌入在以 .access 为后缀的键中的子串 lfs.customtransfer.evil.path 会匹配,因此名为 evil 的适配器被注册,其可执行路径为攻击者提供的值。Git LFS 在获取对象时将该二进制文件作为自定义传输代理运行。修复方案为正则表达式添加了锚点(\A...\z),因此只有完整、精确的 lfs.customtransfer.<name>.path 键才会注册适配器;配套提交在 readGitConfig 中收紧了访问/远程键的匹配。
| 服务 | 镜像 | 角色 |
|---|---|---|
lfs3-vuln | cve-2026-105803:vuln | Git LFS v3.8.0 |
lfs3-fixed | cve-2026-105803:fixed | Git LFS v3.8.1(厂商修复) |
poc | cve-2026-105803-poc:local | 仅使用标准库的 Python 驱动程序 |
包内 Go 测试二进制文件调用每个标签对应的真实上游代码:config.readGitConfig(安全键过滤器,/keys)以及 tq 清单/适配器设置(configureCustomAdapters、/transfer)。两侧仅在 Git LFS 版本上有所不同。
./run-lab.sh build # builds both tags with Go 1.25
./run-lab.sh up # cve105803lab network: lfs3-vuln / lfs3-fixed
./run-lab.sh sweep
./run-lab.sh down
poc/poc.py(仅使用标准库):
evil 传输适配器时退出码为 1,被拒绝时为 0;3 表示无 worker,2 表示不可达。*.access 过滤器检查。一个独立的完整攻击链利用程序位于 exploit/exploit.py:
python3 exploit/exploit.py --host=lfs3-vuln
# exit 1 on confirmed adapter registration, 0 on a safe target
| 键形态 | lfs3-vuln (3.8.0) | lfs3-fixed (3.8.1) |
|---|---|---|
lfs.customtransfer.evil.path(精确、合法) | 适配器 evil | 适配器 evil |
lfs.customtransfer.evil.path.access | 适配器 evil → /tmp/evil-transfer | 无适配器 |
extra.lfs.customtransfer.evil.path.access | 适配器 evil | 无适配器 |
remote.lfs.customtransfer.evil.path | 适配器 evil | 无适配器 |
other.example.access 安全过滤器接受 | 已接受 | 已拒绝 |
捕获的运行记录:evidence/check-*-run.txt、evidence/exploit-*-run.txt、
evidence/probe-*-run.txt、evidence/mitigation-*-run.txt、
evidence/exploit-standalone-run.txt、evidence/exploit-standalone-fixed-run.txt、
evidence/versions.txt、evidence/0day-sweep.txt。
cve105803lab
网络上运行的有界容器。.lfsconfig 携带精心构造的键;注册的二进制文件会在对象传输期间执行。修复版本会拒绝所有精心构造的键形态(访问后缀、额外
前缀、远程前缀)——只有完全合法的键才会注册
适配器。锚定正则表达式封堵了子串匹配绕过,
非 LFS 的 *.access 键会被收紧后的安全键过滤器拒绝。
README.md this write-up
run-lab.sh environment driver (build / up / sweep / down)
Makefile convenience targets
poc/poc.py the PoC (check / exploit / probe / mitigation)
exploit/exploit.py standalone full-chain exploit
lab/lab.Dockerfile builds both upstream tags
lab/harness/ in-package Go harnesses (config + tq), per-tag API
lab/service.py HTTP wrapper (POST /keys, POST /transfer)
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)