🇰🇷 한글 설명
Nest.js 프레임워크의 SseStream._transform() 함수가 message.type과 message.id 필드의 줄바꿈 문자(
,
)를 검증하지 않아, 공격자가 임의의 SSE(Server-Sent Events) 이벤트를 주입하고 연결 상태를 손상시킬 수 있습니다. 11.1.18 버전에서 수정되었습니다.
💡 쉬운 설명
Nest.js의 실시간 메시지 서비스가 특수 문자를 필터링하지 않아 공격자가 가짜 메시지를 주입할 수 있습니다. 서버 연결 상태를 교란하거나 클라이언트를 속일 수 있습니다.
🇺🇸 원문 (English)
Nest is a framework for building scalable Node.js server-side applications. Prior to 11.1.18, SseStream._transform() interpolates message.type and message.id directly into Server-Sent Events text protocol output without sanitizing newline characters (\r, \n). Since the SSE protocol treats both \r and \n as field delimiters and \n\n as event boundaries, an attacker who can influence these fields through upstream data sources can inject arbitrary SSE events, spoof event types, and corrupt reconnection state. This vulnerability is fixed in 11.1.18.
📍 영향받는 시스템
Nest.js 11.1.17 이하 버전
⚔️ 공격 벡터
SSE 메시지의 message.type 또는 message.id 필드에 줄바꿈 문자를 포함시켜 프로토콜 경계를 넘어 임의 이벤트 주입
🛡️ 대응 방법
Nest.js를 11.1.18 이상으로 업그레이드
🔧 검증 코드
출력된 버전 번호가 11.1.18 이상이면 안전, 11.1.17 이하면 취약
npm list @nestjs/core 2>/dev/null | grep -E 'nestjs/core@[0-9]' | grep -oE '[0-9.]+' | head -1