🇰🇷 한글 설명
Kimai 2.32.0~2.56.0 버전에서 System-Admin 권한의 사용자가 악의적인 PDF 인보이스 템플릿을 업로드하면, Twig 렌더링 중 mPDF의 SetAssociatedFiles() 함수를 악용하여 PHP 워커가 접근 가능한 임의의 파일을 읽고 PDF에 포함시킬 수 있습니다.
💡 쉬운 설명
Kimai의 관리자가 특수 제작된 PDF 템플릿을 업로드하면 서버의 비공개 파일을 도용할 수 있습니다. 버전 2.56.0 이상으로 업데이트하면 해결됩니다.
🇺🇸 원문 (English)
Kimai is an open-source time tracking application. From version 2.32.0 to before version 2.56.0, users with the role System-Admin (ROLE_SYSTE_ADMIN) and the permission upload_invoice_template can upload PDF invoice templates, which can call pdfContext.setOption('associated_files', ...) inside the sandboxed Twig render. This is forwarded to mPDF's SetAssociatedFiles(), whose writer calls file_get_contents($entry['path']) during PDF output and embeds the bytes as a FlateDecode stream in the PDF. Any file readable by the PHP worker is returned to the attacker inside the rendered invoice. This issue has been patched in version 2.56.0.
📍 영향받는 시스템
Kimai 2.32.0 ~ 2.55.x (2.56.0 이상은 패치됨)
⚔️ 공격 벡터
System-Admin 역할 + upload_invoice_template 권한: 악의적인 Twig 코드 포함 PDF 템플릿 업로드 → mPDF SetAssociatedFiles()로 임의 파일 읽기 → 인보이스 렌더링 시 서버 파일 도용
🛡️ 대응 방법
Kimai를 버전 2.56.0 이상으로 즉시 업그레이드하거나 System-Admin + upload_invoice_template 권한을 신뢰할 수 있는 사용자에게만 제한
🔧 검증 코드
버전이 2.56.0 이상이면 안전, 2.55.x 이하면 취약. Kimai 루트 디렉토리에서 실행하거나 공식 배포판 버전 정보 확인
cat composer.json 2>/dev/null | grep -A2 '"name".*kimai' | grep -oE '"version"[[:space:]]*:[[:space:]]*"([^"]+)' || grep -E 'Version|version' web/index.php 2>/dev/null | head -1