🇰🇷 한글 설명
Node.js의 body-parser 미들웨어에서 압축된 요청을 처리할 때 발생하는 취약점입니다. 특정 페이로드가 포함된 요청을 보내면 압축 해제 스트림에서 예외가 발생하여 애플리케이션 프로세스가 예기치 않게 종료될 수 있습니다.
💡 쉬운 설명
압축된 데이터를 보낼 때 데이터 끝에 잘못된 정보를 섞어 보내면 서버 프로그램이 갑자기 꺼져버리는 문제입니다. 이로 인해 서비스가 중단되는 장애가 발생할 수 있습니다.
🇺🇸 원문 (English)
body-parser is body parsing middleware for Node.js and Express. In versions before 1.20.9 and in versions from 2.0.0 before 2.4.0, a single request can crash any application using body-parser with default options. When a request carries a Content-Encoding such as gzip, body-parser pipes it into a decompression stream and, after reading the body, leaves that stream with no error listener. A payload of one valid compressed frame followed by trailing bytes decodes and the application responds normally, but the trailing bytes then reach the already-finished decoder, which emits an error that is re-thrown as an uncaught exception and terminates the process. No matching route is required because body parsing runs before routing, so any endpoint that parses a body is affected. The issue is fixed in body-parser 2.4.0 and 1.20.9, and users should upgrade to one of those versions or later. As a workaround, disable request-body inflation (set the body-parser inflate option to false) so encoded requests are rejected before any decompression stream is created.
📍 영향받는 시스템
body-parser 1.20.9 미만 버전 및 2.0.0 이상 2.4.0 미만 버전
⚔️ 공격 벡터
gzip 등으로 압축된 유효한 프레임 뒤에 잘못된 바이트를 추가한 요청을 전송하여 프로세스 종료 유도
🛡️ 대응 방법
body-parser를 1.20.9 또는 2.4.0 이상의 버전으로 업데이트하거나, inflate 옵션을 false로 설정
🔧 검증 코드
출력된 결과에서 body-parser의 버전을 확인하여 취약한 버전 범위에 해당하는지 체크