update_folder 中缺少授权检查,导致跨团队文件夹窃取| CVE | CVE-2026-103035 |
| 组件 | TeamPass — app/sources/folders.queries.php、update_folder 操作 |
| 受影响版本 | 2f271cdd (3.2.1.1),同样存在于 3.1.3.1 和 3.1.7.6 |
| 修复于 | 提交 e022b27(Fix missing authorization in folders update_folder action,GHSA-66q9-mxf2-xqw6) |
| CWE | CWE-639(通过用户可控键绕过授权)、CWE-862(缺少授权检查) |
| 影响 | 任何已认证的非只读用户都可以重命名、更改父级,并将实例中的任意文件夹转换为个人文件夹。用户可以将其他团队的凭据子树移动到自己的个人空间,从而将其从组织中移除,同时保留对其内容的访问权限。update_folder 操作直接从请求中分派 ID 和父 ID,而不检查它们是否属于调用者可访问的文件夹,这与同一文件中的同类操作不同 |
| 向量 | 已认证的 POST folders.queries.php,携带 action=update_folder 以及攻击者选择的 id / parentId |
| 触发条件 | 目标文件夹 ID 不在 user-accessible_folders 中,parentId 指向攻击者的个人文件夹 |
修复前的操作在执行数据库更新时没有任何授权检查:
// folders.queries.php — pre-fix
// no check that $inputData['id'] is in user-accessible_folders
// no check that $inputData['parentId'] is accessible
// no check that personal/shared domains match
该修复在确切的变更点处添加了三道防护:
// fixed (commit e022b27) — verbatim excerpts
if ((int) $session->get('user-admin') !== 1
&& in_array((int) $inputData['id'],
array_map('intval', (array) $session->get('user-accessible_folders')), true) === false) {
echo prepareExchangedData(array('error' => true, ...), 'encode');
break;
}
// ... identical check for $inputData['parentId'] when moving ...
// ... cross-domain check: (int) $dataFolder['personal_folder'] !== (int) $isPersonal ...
update_folder 从请求中接收文件夹 ID 和目标父级 ID,并用两者更新文件夹树,却从未将它们与调用者的 user-accessible_folders 进行比较。同时也没有检查源文件夹和目标是否属于同一域(组织共享 vs 个人)。因此,普通用户可以针对任意文件夹 ID,对其进行重命名或更改父级,并将其标记为个人——从而将子树的凭据转移到自己的私有空间,并对团队隐藏。修复方案在变更操作之前增加了三项授权检查:目标文件夹必须可访问,目标父级必须可访问(根目录除外),并且非管理员不得进行共享↔个人的转换。此外,还在该文件中添加了全局会话门控,以拦截未认证请求。
| 服务 | 镜像 | 角色 |
|---|---|---|
tp-vuln | cve-2026-103035:vuln | folders.queries.php 位于 e022b27^ — 无防护 |
tp-fixed | cve-2026-103035:fixed | e022b27 — 三个逐字防护块 |
poc | cve-2026-103035-poc:local | 仅使用标准库的 Python 驱动 |
PHP 测试框架在 do { ... } while (false) 中运行修复提交中的逐字上游防护块,使其原生的 break 语句退出模拟操作,并为会话、语言和交换编码器提供最小桩。模式:attack(其他团队的文件夹 → 个人)、admin(维护移动)和 shared_move(普通的共享到共享移动)。
./run-lab.sh build # builds both sides (php:8.3-alpine + python3 service)
./run-lab.sh up # cve103035lab network: tp-vuln / tp-fixed
./run-lab.sh sweep
./run-lab.sh down
poc/poc.py(仅使用标准库):
e022b27 / 三个授权防护。一个独立的完整攻击链利用程序位于 exploit/exploit.py:
python3 exploit/exploit.py --host=tp-vuln
# exit 1 on confirmed cross-team folder conversion, 0 on a safe target
| 模式 | tp-vuln (e022b27^) | tp-fixed (e022b27) |
|---|---|---|
| 攻击(其他团队的文件夹 → 个人文件夹) | 已移动,无拒绝 — 子树被窃取 | error_not_allowed_to — 未移动 |
| 管理员移动 | 已移动 | 已移动 |
| 共享到共享移动 | 已移动 | 已移动 |
捕获的运行: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。
cve103035lab
网络上运行的有界容器;实验镜像中的 PHP 8.3 CLI。三项授权检查均在模拟数据库更新之前运行,并且 覆盖目标文件夹、目标父级以及域变更。 管理员维护移动和普通共享到共享移动在 修复版本上仍然成功,确认这些防护并非过于宽泛。本次扫描未在修复版本上 发现残留的重新挂载绕过。
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/harness-*.php verbatim upstream guard blocks + minimal PHP stubs
lab/lab.Dockerfile builds both sides from the pinned upstream source slices
lab/service.py HTTP wrapper (POST /folder), child-process isolation
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)