🇰🇷 한글 설명
Mistune는 Python Markdown 파서인데, 3.2.1 버전 이전의 math 플러그인에서 사용자가 입력한 수식($...$ 또는 $$...$$)을 HTML 이스케이프 처리 없이 그대로 HTML 출력에 포함시킵니다. escape=True 옵션으로 설정해도 이 보안 기능이 우회되어 XSS 공격이 가능합니다.
💡 쉬운 설명
Mistune의 수학 공식 기능이 사용자 입력을 안전하게 처리하지 않아, 악의적인 웹 코드가 실행될 수 있습니다. 공격자가 수식 대신 자바스크립트를 넣으면 웹페이지에서 그대로 실행됩니다.
🇺🇸 원문 (English)
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.2.1, the mistune math plugin renders inline math ($...$) and block math ($$...$$) by concatenating the raw user-supplied content directly into the HTML output without any HTML escaping. This occurs even when the parser is explicitly created with escape=True, which is supposed to guarantee that all user-controlled text is sanitised before reaching the DOM. This vulnerability is fixed in 3.2.1.
📍 영향받는 시스템
Mistune < 3.2.1 (math 플러그인 사용하는 모든 버전)
⚔️ 공격 벡터
사용자가 markdown에 $...$또는 $$...$$형식으로 악성 HTML/JavaScript를 포함시켜 제출하면 이스케이프되지 않고 렌더링됨
🛡️ 대응 방법
pip install --upgrade 'mistune>=3.2.1'로 업그레이드하거나 math 플러그인 사용 비활성화
🔧 검증 코드
Version이 3.2.1 이상이면 안전하며, 그 이하면 업그레이드 필요합니다.
pip show mistune | grep Version