🇰🇷 한글 설명
PyMdown Extensions의 b64 확장 기능에서 경로 탐색(Path Traversal) 취약점이 발견되었습니다. 공격자가 특수하게 조작된 이미지 경로를 포함한 마크다운을 입력하면, 설정된 base_path 외부의 파일을 읽어 base64로 인코딩하여 노출시킬 수 있습니다. 이 문제는 버전 11.0에서 수정되었습니다.
💡 쉬운 설명
마크다운 문서에 이미지 경로를 조작해 넣으면, 원래 보여주면 안 되는 컴퓨터 내부의 중요한 파일 내용을 몰래 읽어낼 수 있는 보안 약점입니다. 이미지 확장자를 가진 파일이라면 무엇이든 공격자에게 전달될 위험이 있습니다.
🇺🇸 원문 (English)
PyMdown Extensions is a set of extensions for the Python-Markdown markdown project. In versions up to and including 10.21.3, the b64 extension is vulnerable to a path traversal that discloses arbitrary files: it inlines images referenced by <img src="..."> by joining the src onto the configured base_path with os.path.normpath and opening the result directly, without verifying that the resolved path stays inside base_path. As a result, an src containing ../ sequences or an absolute path reads a file outside base_path as long as it has an allowed image extension (.png, .jpg, .jpeg, .gif, .svg), and the file's contents are then base64-encoded into the rendered output, disclosing them. An application that renders untrusted Markdown with pymdownx.b64 enabled can therefore leak the contents of image-extension files readable by the process to whoever controls the Markdown or views the output, a targeted file-read bounded by the extension check. This issue has been fixed in version 11.0.
📍 영향받는 시스템
PyMdown Extensions 10.21.3 및 그 이하 버전 (pymdownx.b64 확장 기능 사용 시)
⚔️ 공격 벡터
마크다운 내 <img src="..."> 태그에 ../와 같은 경로 탐색 문구 또는 절대 경로를 삽입하여 공격
🛡️ 대응 방법
PyMdown Extensions를 최신 버전인 11.0 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 11.0 미만이면 해당 취약점에 노출된 상태입니다.
pip show pymdown-extensions | grep Version