🇰🇷 한글 설명
Nokogiri(루비용 XML/HTML 라이브러리)의 NodeSet#[] 및 slice 메서드가 32비트로 잘린 인덱스로 범위를 검사하여, 큰 음수 인덱스가 검사를 통과한 뒤 전체 폭으로 사용되면서 노드 집합 메모리 범위 밖을 읽을 수 있습니다. CRuby에서는 범위 밖 읽기로 프로세스가 충돌하며, JRuby에서는 메모리 안전성 문제 없이 잘못된 노드를 반환합니다. 1.19.4 이전 버전에 영향을 미칩니다.
💡 쉬운 설명
XML이나 HTML 문서를 처리하는 Ruby 도구에서 특정 값을 잘못 넣으면 프로그램이 비정상 종료될 수 있는 문제입니다. 최신 버전으로 업데이트하면 해결됩니다.
🇺🇸 원문 (English)
Nokogiri is an open source XML and HTML library for the Ruby programming language. Prior to 1.19.4, Nokogiri::XML::NodeSet#[] (and its alias #slice) checked the requested index against the node set's bounds using a 32-bit-truncated copy of the index. A large negative index could pass the check and then be used at full width, reading outside the node set's storage. On CRuby this is an out-of-bounds read that typically crashes the process; on JRuby it is not memory-unsafe but returns an incorrect node. This vulnerability is fixed in 1.19.4.
📍 영향받는 시스템
Nokogiri 1.19.4 미만 버전을 사용하는 Ruby 애플리케이션 (CRuby 및 JRuby 환경)
⚔️ 공격 벡터
공격자가 조작된 큰 음수 인덱스 값을 전달할 수 있는 입력을 통해 NodeSet#[] 호출을 유도하여 범위 밖 메모리 읽기나 잘못된 노드 반환을 일으킵니다.
🛡️ 대응 방법
Nokogiri를 1.19.4 이상으로 업그레이드하고 (gem update nokogiri 또는 Gemfile에서 버전 고정) 애플리케이션을 재배포합니다.
🔧 검증 코드
출력된 버전 번호가 1.19.4 미만이면 취약하므로 업그레이드가 필요하고, 1.19.4 이상이면 패치된 상태입니다.
gem list nokogiri 2>/dev/null | grep nokogiri