🇰🇷 한글 설명
view_component는 Ruby on Rails에서 재사용 가능한 뷰 컴포넌트를 구축하는 프레임워크입니다. 4.0.0부터 4.12.0 이전 버전까지 ViewComponent::Base#around_render가 일반 #call 반환값에 적용되는 이스케이프 처리를 우회하는 HTML-unsafe 문자열을 반환할 수 있어, 사용자 입력 데이터가 포함된 콘텐츠를 처리할 때 XSS 위험이 발생합니다. 또한 ViewComponent::Collection#render_in이 개별 결과를 결합한 후 전체 출력을 html_safe로 표시하여 문제를 증폭시킵니다.
💡 쉬운 설명
이 취약점은 웹 화면에 표시되는 컴포넌트가 사용자 입력값을 안전하게 처리하지 않아 악성 스크립트가 실행될 수 있는 문제입니다. 공격자가 삽입한 코드가 다른 사용자의 브라우저에서 실행되어 개인정보 탈취나 세션 가로채기가 가능합니다.
🇺🇸 원문 (English)
view_component is a framework for building reusable, testable, and encapsulated view components in Ruby on Rails. From 4.0.0 until 4.12.0, ViewComponent::Base#around_render can return HTML-unsafe strings that bypass the escaping behavior applied to normal #call return values. This creates an XSS risk when downstream applications use around_render to wrap, replace, instrument, or conditionally return content that includes user-controlled data, and ViewComponent::Collection#render_in can amplify the issue by joining per-item results and marking the entire output html_safe, converting raw unsafe output into an ActiveSupport::SafeBuffer. This issue is fixed in version 4.12.0.
📍 영향받는 시스템
view_component gem 4.0.0 이상 4.12.0 미만을 사용하는 Ruby on Rails 애플리케이션
⚔️ 공격 벡터
공격자가 around_render를 사용하는 컴포넌트에 악성 스크립트를 포함한 사용자 입력을 전달하면, 이스케이프되지 않은 채 렌더링되어 피해자 브라우저에서 XSS가 실행됨
🛡️ 대응 방법
view_component gem을 4.12.0 이상으로 업그레이드 (bundle update view_component)
🔧 검증 코드
출력된 버전 번호가 4.12.0 미만이면 취약하므로 업데이트가 필요하며, 결과가 없으면 프로젝트에 해당 gem이 설치되지 않은 것입니다.
bundle list 2>/dev/null | grep view_component