🇰🇷 한글 설명
Active Storage의 프록시 컨트롤러가 파일을 스트리밍하는 도중 스토리지 서비스에서 오류가 발생하면, 이미 응답이 커밋된 상태에서 head가 응답 본문을 교체하면서 ActionController::Live 버퍼가 닫히지 않아 서버 스레드가 프로세스 재시작 전까지 블록됩니다. 반복된 다운로드 실패로 서버 스레드가 고갈되어 DoS가 발생할 수 있으며, 8.0~8.0.5.2 및 8.1~8.1.4.1 버전이 영향을 받고 8.1.4.1 및 8.0.5.2에서 수정되었습니다.
💡 쉬운 설명
웹 서버가 파일을 내려받아 전달하는 도중 클라우드 저장소에서 오류가 나면, 서버가 작업을 제대로 끝내지 못하고 멈춰버릴 수 있습니다. 이런 일이 반복되면 서버가 응답할 수 없게 되어 서비스가 중단될 수 있습니다.
🇺🇸 원문 (English)
Active Storage makes it simple to upload and reference files in cloud services and attach those files to Active Record objects. From 8.0 until 8.0.5.2 and 8.1.4.1, when Active Storage serves a file through its proxy controllers, ActiveStorage::Streaming#send_blob_stream handles an error from the storage service by calling head to send a 404 or 500 response. If the error occurs after the first chunk has been written, the response is already committed, and head replaces the response body while the server is still reading the original ActionController::Live buffer. That buffer is never closed, so the server thread handling the request blocks until the process restarts. Repeated failed downloads could exhaust the server's threads, possibly resulting in a DoS vulnerability. Applications are affected when they store files on a service that streams a download in several requests, such as Amazon S3, an S3-compatible service or Google Cloud Storage, and draw Active Storage's default routes. The proxy routes are drawn whether or not proxy mode is the default for the application. A file deleted while it is being served, or any other storage error partway through a download, triggers the condition. This issue is fixed in versions 8.1.4.1 and 8.0.5.2.
📍 영향받는 시스템
Rails Active Storage 8.0.0~8.0.5.1 및 8.1.0~8.1.4.0 (S3, S3 호환 서비스, Google Cloud Storage 등 스트리밍 다운로드를 쓰는 환경)
⚔️ 공격 벡터
다운로드 도중 파일이 삭제되거나 저장소 오류가 발생하는 상황을 반복 유도하여 서버 스레드를 고갈시키는 방식의 서비스 거부
🛡️ 대응 방법
Rails를 8.1.4.1 또는 8.0.5.2 이상으로 업그레이드
🔧 검증 코드
출력된 activestorage 버전이 8.0.5.2 또는 8.1.4.1 미만이면 취약하며, 이상이면 수정된 버전입니다 (프로젝트 디렉터리에서 실행).
bundle list 2>/dev/null | grep -i activestorage