🔍 CVE-2021-29475

10.0
CVSS Score
CRITICAL
2021-04-26
2026-06-17 03:47
✅ 완료

🇰🇷 한글 설명

HedgeDoc(구 CodiMD)에서 노트를 PDF로 내보낼 때 공격자가 파일 시스템의 임의 파일을 탈취할 수 있는 취약점입니다. 공격자가 노트를 수정할 수 있는 권한이 있다면, JavaScript 렌더링을 통해 서버 내의 설정 파일이나 데이터베이스 자격 증명 등 민감한 정보를 읽어낼 수 있습니다.

💡 쉬운 설명

메모를 PDF로 저장하는 기능을 악용하여 해커가 서버에 저장된 중요한 비밀번호나 파일을 몰래 훔쳐갈 수 있는 문제입니다. 메모를 작성하거나 수정할 수 있는 사람이 있다면 시스템 전체의 정보가 위험해질 수 있습니다.

🇺🇸 원문 (English)

HedgeDoc (formerly known as CodiMD) is an open-source collaborative markdown editor. An attacker is able to receive arbitrary files from the file system when exporting a note to PDF. Since the code injection has to take place as note content, there fore this exploit requires the attackers ability to modify a note. This will affect all instances, which have pdf export enabled. This issue has been fixed by https://github.com/hedgedoc/hedgedoc/commit/c1789474020a6d668d616464cb2da5e90e123f65 and is available in version 1.5.0. Starting the CodiMD/HedgeDoc instance with `CMD_ALLOW_PDF_EXPORT=false` or set `"allowPDFExport": false` in config.json can mitigate this issue for those who cannot upgrade. This exploit works because while PhantomJS doesn't actually render the `file:///` references to the PDF file itself, it still uses them internally, and exfiltration is possible, and easy through JavaScript rendering. The impact is pretty bad, as the attacker is able to read the CodiMD/HedgeDoc `config.json` file as well any other files on the filesystem. Even though the suggested Docker deploy option doesn't have many interesting files itself, the `config.json` still often contains sensitive information, database credentials, and maybe OAuth secrets among other things.

📍 영향받는 시스템

HedgeDoc (CodiMD) PDF 내보내기 기능이 활성화된 모든 버전 (1.5.0 미만)

⚔️ 공격 벡터

노트 내용에 악성 JavaScript를 삽입하여 PDF 내보내기 시 file:/// 프로토콜을 통해 로컬 파일을 외부로 유출

🛡️ 대응 방법

HedgeDoc를 1.5.0 버전 이상으로 업데이트하거나, 설정에서 PDF 내보내기 기능을 비활성화(allowPDFExport: false)합니다.

🔧 검증 코드

출력 결과에 1.5.0 이상의 버전 정보가 포함되어 있는지 확인하여 패치 여부를 판단합니다.

Shell / Script
curl -s http://<target-ip>:<port>/version | grep -E '1.5.0'

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N

💻 영향받는 소프트웨어

Docker