| CVE | CVE-2026-104882 |
| 组件 | contao/core-bundle — BackendCsvImportController(Backend::getBackendModule key-action 分发) |
| 受影响版本 | < 5.3.50 |
| 修复版本 | 5.3.50 — 提交 eb8088bcd(GHSA-23w9-4pg3-xwm3) |
| CWE | CWE-639(通过用户可控键绕过授权)、CWE-863(授权不正确) |
| 影响 | 被限定在特定页面/表单范围内的非管理员编辑者,可通过 CSV 导入向导覆盖其范围之外的任意 tl_content / tl_form_field 记录的 tableitems / listitems / options —— 盲完整性 IDOR(写入的值是纯字符串数组的 serialize(),而非对象注入) |
| 向量 | 已认证的低权限后端编辑者调用 CSV 导入 key-action |
| 触发条件 | CSV 导入针对范围之外的记录(仅检查模块级访问权限) |
存在漏洞的控制器在写入导入数据时没有进行逐记录投票:
// vulnerable BackendCsvImportController::importFromTemplate
$data = $this->fetchData($uploader, $separator, $callback);
$this->connection->update($table, [$field => serialize($data)], ['id' => $currentRecord['id']]);
// no denyAccessUnlessGranted — only the module-level check ran at dispatch
该修复在写入之前强制执行逐记录投票者校验:
// fixed (commit eb8088bcd)
$this->denyAccessUnlessGranted(
ContaoCorePermissions::DC_PREFIX.$table,
new UpdateAction($table, $currentRecord, [$field => serialize($data)])
);
$this->connection->update($table, [$field => serialize($data)], ['id' => $currentRecord['id']]);
自定义后端模块的 "key" 操作在 Backend::getBackendModule() 中分发,且仅经过模块级 USER_CAN_ACCESS_MODULE 检查——没有运行逐记录投票器。因此,CSV 导入向导(importListWizardAction、importTableWizardAction、importOptionWizardAction)将导入的 listitems / tableitems / options 直接写入数据库,而未验证编辑者是否有权修改目标记录。一个被限定到特定页面/表单的非管理员编辑者,可以通过 id 定位任意 tl_content / tl_form_field 记录并覆盖其内容——这是一种盲目的完整性 IDOR。修复方案在 connection->update 之前添加了 denyAccessUnlessGranted(DC_PREFIX.$table, new UpdateAction(...)),从而在导入路径上强制执行逐记录的 DataContainer 投票器。
| 服务 | 镜像 | 角色 |
|---|---|---|
csv-vuln | cve-2026-104882:vuln | 真实的 BackendCsvImportController(修复前) |
csv-fixed | cve-2026-104882:fixed | 真实控制器(厂商修复 eb8088bcd) |
poc | cve-2026-104882-poc:local | 仅使用标准库的 Python 驱动程序 |
一个 PHP 测试装置从每个标签原样加载真实控制器,并以非管理员身份驱动 importTableWizardAction()。逐记录授权检查器被模拟为拒绝范围外的记录;Doctrine 连接被模拟以记录写入。Symfony/Contao 基础设施被桩化;控制器逻辑(包括安全决策和数据库写入)是真实的上游代码。两侧仅在控制器源代码上有所不同。
./run-lab.sh build # builds both sides (php:8.3-cli)
./run-lab.sh up # cve104882lab network: csv-vuln / csv-fixed
./run-lab.sh sweep
./run-lab.sh down
poc/poc.py(仅使用标准库):
tl_content.tableitems 的盲覆盖。eb8088bcd。一个独立的完整链路利用程序位于 exploit/exploit.py:
python3 exploit/exploit.py --host=csv-vuln
# exit 1 on confirmed out-of-scope write, 0 on a safe target
| 导入范围 | csv-vuln(修复前) | csv-fixed(eb8088bcd) |
|---|---|---|
| 范围外 | db_update_called=true(IDOR) | access_denied=true,无写入 |
| 范围内(对照) | 写入(合法) | 写入(合法) |
已捕获的运行: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。
cve104882lab
网络上运行的有界容器;实验镜像中使用 PHP 8.3 运行时。修复后的控制器在任何 CSV 导入数据库写入之前强制执行逐记录的 UpdateAction 投票
(denyAccessUnlessGranted),因此范围外的记录受到保护,而范围内的导入仍然成功。同一防护覆盖
importListWizardAction / importTableWizardAction /
importOptionWizardAction(listitems / tableitems / options)。导入路径中不再存在
逐记录的 IDOR。
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 sides from upstream controller source
lab/vendor/ verbatim controller from pre-fix / fix commits
lab/stubs.php minimal Symfony/Contao/Doctrine infrastructure stubs
lab/harness.php drives the real import action as a non-admin
lab/service.py HTTP wrapper (POST /import)
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)