🇰🇷 한글 설명
LiquidJS 10.25.7 이하 버전의 strip_html 필터는 정규식의 catch-all 분기(<.*?>)가 줄바꿈 문자를 매칭하지 않아, 태그 내부에 \n 또는 \r이 포함되면 HTML 태그가 제거되지 않고 그대로 통과합니다. 이로 인해 해당 필터를 XSS 방어 수단으로 사용하는 애플리케이션에서 XSS가 발생할 수 있으며, 이 문제는 10.26.0 버전에서 수정되었습니다.
💡 쉬운 설명
LiquidJS 템플릿 엔진의 HTML 태그 제거 기능이 줄바꿈이 들어간 태그를 걸러내지 못합니다. 공격자는 이 허점을 이용해 악성 스크립트를 웹페이지에 삽입할 수 있습니다.
🇺🇸 원문 (English)
LiquidJS is a Shopify/GitHub Pages compatible template engine written in pure JavaScript. Versions 10.25.7 and below are vulnerable to XSS through a flaw in the strip_html filter logic. The strip_html filter is intended to remove HTML tags from a string before rendering, and is widely used as an XSS sanitizer. The implementation uses a regex whose catch-all branch (<.*?>) does not match line terminators, so any HTML tag containing a \n or \r character passes through unmodified. An attacker who can place a newline inside a tag (e.g. <img\nsrc=x\nonerror=alert(1)>) bypasses sanitization entirely, since browsers treat newlines as whitespace within a tag and execute the resulting onerror/onload/etc. handler. Exploitation is possible for applications that both render attacker-controlled strings via {{ x | strip_html }} to defend against HTML injection and do not separately HTML-escape that output (default behavior — outputEscape is unset by default). This issue has been fixed in version 10.26.0.
📍 영향받는 시스템
LiquidJS 10.25.7 이하 버전을 사용하며 strip_html 필터로 XSS를 방어하고 outputEscape를 설정하지 않은 애플리케이션
⚔️ 공격 벡터
공격자가 사용자 입력에 줄바꿈이 포함된 태그(예: <img\nsrc=x\nonerror=alert(1)>)를 넣어 strip_html 필터를 우회하고 스크립트를 실행
🛡️ 대응 방법
LiquidJS를 10.26.0 이상으로 업그레이드하고, 필요 시 outputEscape 옵션을 활성화하거나 출력값을 별도로 HTML 이스케이프 처리
🔧 검증 코드
출력된 liquidjs 버전이 10.26.0 미만이면 취약하므로 업그레이드가 필요하고, 10.26.0 이상이면 패치가 적용된 것입니다.
npm ls liquidjs 2>/dev/null | grep liquidjs