🇰🇷 한글 설명
Rack의 Rack::Sendfile#map_accel_path 메서드가 X-Accel-Mapping 요청 헤더 값을 이스케이프 처리 없이 정규 표현식에 직접 삽입하는 취약점입니다. 공격자가 정규 표현식 메타문자를 주입하면 X-Accel-Redirect 응답 헤더를 조작할 수 있습니다. 이로 인해 Nginx와 같은 서버 환경에서 내부의 의도치 않은 파일이 노출될 위험이 있습니다.
💡 쉬운 설명
공격자가 특수 문자가 섞인 요청을 보내 서버를 속여 내부의 비밀 파일을 훔쳐볼 수 있게 하는 취약점입니다. 입력값 검증이 제대로 되지 않아 발생하는 문제입니다.
🇺🇸 원문 (English)
Rack is a modular Ruby web server interface. Prior to versions 2.2.23, 3.1.21, and 3.2.6, Rack::Sendfile#map_accel_path interpolates the value of the X-Accel-Mapping request header directly into a regular expression when rewriting file paths for X-Accel-Redirect. Because the header value is not escaped, an attacker who can supply X-Accel-Mapping to the backend can inject regex metacharacters and control the generated X-Accel-Redirect response header. In deployments using Rack::Sendfile with x-accel-redirect, this can allow an attacker to cause nginx to serve unintended files from configured internal locations. This issue has been patched in versions 2.2.23, 3.1.21, and 3.2.6.
📍 영향받는 시스템
Rack 버전 2.2.23, 3.1.21, 3.2.6 미만 버전
⚔️ 공격 벡터
X-Accel-Mapping HTTP 요청 헤더에 정규 표현식 메타문자를 주입하여 응답 경로를 조작함
🛡️ 대응 방법
Rack 라이브러리를 2.2.23, 3.1.21, 3.2.6 이상의 최신 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 Rack 버전이 2.2.23, 3.1.21, 3.2.6보다 낮은 버전인지 확인하십시오.
bundle exec gem list rack | grep -E 'rack \([0-9.]+\)'