
CVE-2026-104883에 대한 개념 증명 및 실습 환경: 위임된 Contao 사용자 관리자가 theme_import를 스스로 부여하여 PHP RCE로 권한을 상승시키며, 취약/수정 버전을 차등 비교하는 하네스를 포함합니다.
| CVE | CVE-2026-104883 |
| 구성 요소 | contao/core-bundle — CheckTemplateEditorSaveListener / TemplateEditorModuleVoter (tl_user, tl_user_group) |
| 영향 받는 버전 | < 5.3.50 (및 수정 전 5.7.x 계열) |
| 수정 버전 | 5.3.50 — 커밋 211498f28 (GHSA-r9qp-pqx5-8369) |
| CWE | CWE-269 (부적절한 권한 관리), CWE-863 (잘못된 인가) |
| 영향 | 위임된 사용자/그룹 관리자(템플릿/코드 접근 권한이 명시적으로 부여되지 않은 역할)가 RCE가 가능한 theme_import 권한 — 그리고 layout, unfiltered_html 등 — 을 스스로 부여하여 서버에서 임의의 PHP 실행으로 권한을 상승시킬 수 있음 |
| 공격 벡터 | 자신의 계정/그룹을 편집하는 인증된 저권한 백엔드 사용자 |
| 트리거 | themes = ['theme_import'] 저장 (themes 필드에 가드가 없었음) |
5.7.3의 강화 조치는 modules / tpl_editor만 보호했습니다:
// vulnerable CheckTemplateEditorSaveListener — registered only on fields.modules.save
if (!\is_array($newModules) || !\in_array('tpl_editor', $newModules, true)) {
return $value; // themes/theme_import is never inspected -> grant accepted
}
수정 사항은 모든 암시적 관리자 필드와 값을 보호합니다:
// fixed CheckImplicitAdminSaveListener (commit 211498f28)
private const IMPLICIT_ADMIN_VALUES = [
'modules' => ['tpl_editor'],
'themes' => ['theme_import', 'layout'],
'elements' => ['unfiltered_html'],
'frontendModules' => ['unfiltered_html', 'listing'],
'alexf' => [/* list_table, list_where, unfilteredHtml, ... */],
];
// registered on fields.modules/themes/elements/frontendModules/alexf.save;
// throws AccessDeniedException (ERR.grantAdminOnly) for a non-admin self-grant.
커밋 2b83a60f7763 (5.7.3)은 TemplateEditorModuleVoter와 저장 콜백을 추가하여 템플릿 편집기를 강화했으며, 이를 통해 비관리자가 tpl_editor 백엔드 모듈을 스스로 부여할 수 없게 했다(편집 가능한 PHP 지원 템플릿은 서버 측 코드 실행을 허용함). 이 보호 조치는 modules 필드와 리터럴 값 tpl_editor에만 적용된다. 마찬가지로 RCE가 가능한 theme_import 권한은 다른 필드, 즉 themes 체크박스 필드(tl_user_group.php / tl_user.php)에 존재하는데, 이 필드에는 save_callback도, voter도 없었다. TemplateEditorModuleVoter은 tl_user_group에 등록된 유일한 DataContainer voter이며 themes를 다루지 않는다. 따라서 위임된 사용자 관리자는 모듈 필드에 themes을, 테마 필드에 theme_import를 추가하고(둘 다 허용됨 — tpl_editor만 차단됨), 재인증하여 임의의 PHP 실행 권한을 얻을 수 있다. 수정 사항은 리스너의 이름을 CheckImplicitAdminSaveListener로 변경하고, 이를 modules/themes/elements/frontendModules/alexf에 등록하며, 모든 암묵적 관리자 값에 대한 비관리자의 자기 부여를 거부한다.
| service | image | role |
|---|---|---|
ct-vuln | cve-2026-104883:vuln | 실제 CheckTemplateEditorSaveListener (수정 전) |
ct-fixed | cve-2026-104883:fixed | 실제 CheckImplicitAdminSaveListener (벤더 수정) |
poc | cve-2026-104883-poc:local | 표준 라이브러리만 사용하는 Python 드라이버 |
PHP 하네스는 각 태그에서 실제 업스트림 리스너 클래스를 그대로 로드하고, 사전 접근 권한 없이 주어진 필드/값에 대해 비관리자(isGranted('ROLE_ADMIN') = false)로서 __invoke($value, $dc)을 호출한다. Symfony/Contao 의존성은 스텁으로 대체되며, 리스너 로직 자체는 변경되지 않는다. 양쪽은 업스트림 리스너 소스에서만 차이가 있다.
./run-lab.sh build # builds both sides (php:8.3-cli)
./run-lab.sh up # cve104883lab network: ct-vuln / ct-fixed
./run-lab.sh sweep
./run-lab.sh down
poc/poc.py (표준 라이브러리만 사용):
themes=['theme_import'] 저장이 허용되면 종료 코드 1, 거부되면 0, 워커가 없으면 3, 연결 불가/판별 불가면 2.theme_import 부여 → 재인증 → 임의 PHP 실행.tpl_editor (양쪽 모두 보호됨), theme_import
/ layout / unfiltered_html (우회 경로), 무해한 모듈 대조군.211498f28.전체 체인을 다루는 독립 실행형 익스플로잇은 exploit/exploit.py에 포함되어 있습니다:
python3 exploit/exploit.py --host=ct-vuln
# exit 1 on confirmed implicit-admin self-grant, 0 on a safe target
| 비관리자 저장 | ct-vuln (수정 전) | ct-fixed (211498f28) |
|---|---|---|
modules = ['tpl_editor'] | 거부됨 (ERR.grantTemplateEditor) | 거부됨 (ERR.grantAdminOnly) |
themes = ['theme_import'] | 허용됨 (우회) | 거부됨 |
themes = ['layout'] | 허용됨 | 거부됨 |
elements = ['unfiltered_html'] | 허용됨 | 거부됨 |
modules = ['news'] (정상) | 허용됨 | 허용됨 |
캡처된 실행: 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.
cve104883lab
네트워크 상의 제한된 컨테이너; 랩 이미지의 PHP 8.3 런타임.user 또는 group 백엔드 모듈)이 필요하며, 관리자
접근 권한은 필요하지 않습니다.수정된 CheckImplicitAdminSaveListener은 사전 접근 권한이 없는 비관리자에 대해
modules/themes/elements/frontendModules/alexf
(tpl_editor, theme_import, layout, unfiltered_html, listing, 그리고
alexf 목록 필드) 전반에 걸친 모든 암묵적 관리자 권한
자기 부여를 거부합니다. 정상 값은 여전히
저장됩니다. 이전의 tpl_editor 전용 가드는 theme_import / layout /
unfiltered_html을 열어두었으나, 이번 수정으로 모두 차단되었습니다. 암묵적 관리자 권한
자기 부여 경로는 더 이상 존재하지 않습니다.
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 listener source
lab/vendor/ verbatim listener class from pre-fix / fix commits
lab/stubs.php minimal Symfony/Contao dependency stubs
lab/harness.php invokes the real listener as a non-admin
lab/service.py HTTP wrapper (POST /check)
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)
2b83a60f7763 (5.7.3, tpl_editor 전용)