🇰🇷 한글 설명
Rack 웹 서버 인터페이스의 Rack::Sendfile 미들웨어에서 정보 노출 취약점이 발견되었습니다. 공격자가 조작된 x-sendfile-type 또는 x-accel-mapping 헤더를 사용하여 프록시의 접근 제어를 우회하고 보호된 내부 엔드포인트에 접근할 수 있습니다.
💡 쉬운 설명
웹 서버 설정 오류를 이용해 원래는 접근할 수 없는 관리자 페이지 같은 비밀 공간에 몰래 들어갈 수 있는 문제입니다. 공격자가 특수한 명령어가 담긴 헤더를 보내 프록시 서버를 속이는 방식으로 작동합니다.
🇺🇸 원문 (English)
Rack is a modular Ruby web server interface. Prior to versions 2.2.20, 3.1.18, and 3.2.3, a possible information disclosure vulnerability existed in `Rack::Sendfile` when running behind a proxy that supports `x-sendfile` headers (such as Nginx). Specially crafted headers could cause `Rack::Sendfile` to miscommunicate with the proxy and trigger unintended internal requests, potentially bypassing proxy-level access restrictions. When `Rack::Sendfile` received untrusted `x-sendfile-type` or `x-accel-mapping` headers from a client, it would interpret them as proxy configuration directives. This could cause the middleware to send a "redirect" response to the proxy, prompting it to reissue a new internal request that was not subject to the proxy's access controls. An attacker could exploit this by setting a crafted `x-sendfile-type: x-accel-redirect` header, setting a crafted `x-accel-mapping` header, and requesting a path that qualifies for proxy-based acceleration. Attackers could bypass proxy-enforced restrictions and access internal endpoints intended to be protected (such as administrative pages). The vulnerability did not allow arbitrary file reads but could expose sensitive application routes. This issue only affected systems meeting all of the following conditions: The application used `Rack::Sendfile` with a proxy that supports `x-accel-redirect` (e.g., Nginx); the proxy did **not** always set or remove the `x-sendfile-type` and `x-accel-mapping` headers; and the application exposed an endpoint that returned a body responding to `.to_path`. Users should upgrade to Rack versions 2.2.20, 3.1.18, or 3.2.3, which require explicit configuration to enable `x-accel-redirect`. Alternatively, configure the proxy to always set or strip the header, or in Rails applications, disable sendfile completely.
📍 영향받는 시스템
Rack versions prior to 2.2.20, 3.1.18, and 3.2.3 (using Rack::Sendfile with compatible proxies)
⚔️ 공격 벡터
조작된 x-sendfile-type 및 x-accel-mapping 헤더를 포함한 HTTP 요청을 통해 프록시의 접근 제한을 우회함
🛡️ 대응 방법
Rack을 2.2.20, 3.1.18 또는 3.2.3 이상 버전으로 업그레이드하거나 프록시에서 관련 헤더를 제거하도록 설정함
🔧 검증 코드
출력된 Rack 버전이 취약한 버전(2.2.20, 3.1.18, 3.2.3 미만)인지 확인합니다.