🇰🇷 한글 설명
Gotenberg 8.31.0 이전 버전의 /forms/pdfengines/metadata/write 엔드포인트가 JSON 메타데이터 키를 검증하지 않아, 줄바꿈 문자를 삽입하여 ExifTool 명령어를 분할할 수 있습니다. 이를 통해 -if 플래그로 Perl 코드를 실행하여 인증 없이 OS 명령어를 원격 실행할 수 있습니다.
💡 쉬운 설명
Gotenberg는 PDF를 만드는 도구인데, 사용자 입력을 제대로 확인하지 않아 특정 문자를 넣으면 의도하지 않은 명령어를 실행하도록 속일 수 있습니다. 공격자가 단 한 번의 HTTP 요청으로 서버 권한으로 임의의 명령어를 실행할 수 있습니다.
🇺🇸 원문 (English)
Gotenberg is a Docker-powered stateless API for PDF files. Prior to 8.31.0, Gotenberg's /forms/pdfengines/metadata/write HTTP endpoint accepts a JSON metadata object and passes its keys directly to ExifTool via the go-exiftool library. No validation is performed on key characters. A \n embedded in a JSON key splits the ExifTool stdin stream into a new argument line, allowing an attacker to inject arbitrary ExifTool flags — including -if, which evaluates Perl expressions. This achieves unauthenticated OS command execution in a single HTTP request. The response is HTTP 200 with a valid PDF, making the attack transparent to basic monitoring. This vulnerability is fixed in 8.31.0.
📍 영향받는 시스템
Gotenberg 8.30.x 이하 (8.31.0부터 수정됨)
⚔️ 공격 벡터
/forms/pdfengines/metadata/write 엔드포인트로 HTTP POST 요청 시 JSON 메타데이터 키에 줄바꿈과 ExifTool 플래그(-if)를 삽입하여 Perl 표현식 실행
🛡️ 대응 방법
Gotenberg를 8.31.0 이상으로 즉시 업그레이드
🔧 검증 코드
출력된 버전 확인 (세 번째 열); 8.31.0 이상이면 안전, 8.31.0 미만이거나 설치 안 됨이면 취약
dpkg -l gotenberg 2>/dev/null | grep gotenberg || rpm -q gotenberg 2>/dev/null || docker images | grep gotenberg