🇰🇷 한글 설명
Loofah는 Nokogiri 기반의 HTML/XML 문서 처리 라이브러리입니다. 2.25.0부터 2.25.2 버전까지 Loofah::HTML5::Scrub.allowed_uri? 메서드가 세미콜론 없는 숫자형 문자 참조(:, 	, 
, 
 등)로 분리된 javascript: 또는 vbscript: URI를 차단하지 못합니다. 이 문제는 HTML 인코딩된 문자열을 allowed_uri?에 직접 전달하는 호출자에게만 영향을 주며, 기본 sanitize() 경로는 영향을 받지 않습니다. 2.25.2 버전에서 수정되었습니다.
💡 쉬운 설명
웹 페이지의 링크를 검사하는 보안 도구가 특정 방식으로 숨겨진 악성 스크립트 링크를 안전하다고 잘못 판단할 수 있습니다. 기본 정화 기능은 영향을 받지 않으며, 이 검사 함수를 직접 호출하는 경우에만 위험합니다.
🇺🇸 원문 (English)
Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri. From 2.25.0 until 2.25.2, Loofah::HTML5::Scrub.allowed_uri? does not reject javascript: or vbscript: URIs whose scheme is split by semicolon-less numeric character references such as :, 	, 
, or 
. CGI.unescapeHTML leaves these references encoded, so allowed_uri? reports the URL safe even though a browser decodes an encoded colon or strips encoded whitespace and executes the resulting URI scheme. This issue affects only callers that pass HTML-encoded strings directly to allowed_uri?; Loofah's default sanitize() path is not affected. This issue is fixed in version 2.25.2.
📍 영향받는 시스템
Loofah 2.25.0 이상 2.25.2 미만을 사용하며 allowed_uri?를 직접 호출하는 Ruby 애플리케이션
⚔️ 공격 벡터
: 등 세미콜론 없는 숫자 문자 참조로 'javascript:' 스킴을 분리한 URI를 입력해 필터를 우회하고, 브라우저에서 스크립트가 실행되도록 유도
🛡️ 대응 방법
loofah 젬을 2.25.2 이상으로 업데이트(bundle update loofah)하고, 가능하면 allowed_uri?를 직접 호출하지 말고 sanitize() 경로를 사용
🔧 검증 코드
출력된 loofah 버전이 2.25.0 이상 2.25.2 미만이면 취약하며, 2.25.2 이상이면 패치된 상태입니다.
bundle list 2>/dev/null | grep -i loofah