🇰🇷 한글 설명
Rubygems.org의 Gem 발행자가 악의적인 YAML 별칭(alias)을 포함한 Gem을 발행하여 원격 서비스 거부(DoS) 공격을 유발할 수 있는 취약점입니다. Gem::Specification.from_yaml이 SafeYAML.load를 사용하면서 메모리 폭탄(YAML-bomb) 공격에 취약해졌습니다.
💡 쉬운 설명
Ruby Gem 패키지 메타데이터에 악의적인 코드를 숨겨서 시스템을 마비시킬 수 있는 보안 문제입니다. Gem을 설치할 때 과도한 메모리를 소비하여 서버가 먹통이 될 수 있습니다.
🇺🇸 원문 (English)
Rubygems.org is the Ruby community's gem hosting service. A Gem publisher can cause a Remote DoS when publishing a Gem. This is due to how Ruby reads the Manifest of Gem files when using Gem::Specification.from_yaml. from_yaml makes use of SafeYAML.load which allows YAML aliases inside the YAML-based metadata of a gem. YAML aliases allow for Denial of Service attacks with so-called `YAML-bombs` (comparable to Billion laughs attacks). This was patched. There is is no action required by users. This issue is also tracked as GHSL-2024-001 and was discovered by the GitHub security lab.
📍 영향받는 시스템
Rubygems.org의 Gem 패키지, Ruby 1.8.7 이상의 Gem::Specification 사용 환경
⚔️ 공격 벡터
공격자가 YAML 별칭으로 반복 참조 구조를 만든 악의적인 Gem을 발행하면, 메타데이터 처리 시 지수적 메모리 확대로 DoS 유발
🛡️ 대응 방법
Rubygems에서 제공한 패치 적용 (gem update --system으로 최신 버전 설치, 이미 패치됨)
🔧 검증 코드
Gem 버전이 최신 패치 버전 이상이고 SafeYAML이 제대로 로드되면 보호됨 (버전이 낮으면 취약함)
gem --version && ruby -e "puts Gem.const_defined?(:SafeYAML) ? 'Using SafeYAML' : 'Standard YAML'"