🇰🇷 한글 설명
Nezha Monitoring 1.0.0부터 2.2.0 미만 버전의 대시보드는 터미널 및 파일 관리자 연결을 위해 제한 없이 스트림 컨텍스트를 맵에 저장합니다. 이는 사용자별 속도 제한이나 연결 수 제한이 없어, 공격자가 다량의 WebSocket 연결을 생성하여 서버의 메모리를 고갈시킬 수 있는 취약점입니다.
💡 쉬운 설명
이 취약점은 시스템이 연결 요청을 무한히 저장하도록 만들어, 공격자가 많은 연결을 시도하면 서버가 메모리 부족으로 멈출 수 있습니다. 이를 방지하려면 해당 소프트웨어를 최신 버전으로 업데이트해야 합니다.
🇺🇸 원문 (English)
Nezha Monitoring is a self-hostable, lightweight, servers and websites monitoring and O&M tool. From version 1.0.0 to before version 2.2.0, the Nezha dashboard exposes two endpoints that create long-lived WebSocket streams to monitored agents: POST /api/v1/terminal → createTerminal() (terminal.go:27-67) and POST /api/v1/file → createFM() (fm.go:28-67). Both call rpc.NezhaHandlerSingleton.CreateStream(streamId, ...) which inserts a new ioStreamContext into an unbounded map[string]*ioStreamContext (s.ioStreams in io_stream.go:59-67). There is no per-user rate limit, no global semaphore, and no per-server connection cap. This issue has been patched in version 2.2.0.
📍 영향받는 시스템
Nezha Monitoring version 1.0.0 to before 2.2.0
⚔️ 공격 벡터
POST /api/v1/terminal 및 POST /api/v1/file 엔드포인트를 통해 다수의 WebSocket 스트림을 생성하여 메모리 고갈 유도
🛡️ 대응 방법
Nezha Monitoring을 버전 2.2.0 이상으로 업그레이드하여 패치 적용
🔧 검증 코드
명령어 실행 시 버전 번호가 반환되며, 2.2.0 미만 버전이 확인되면 취약한 것으로 판단합니다.
curl -s http://localhost:8008/api/v1/version 2>/dev/null | grep -oP '"version":\s*"\K[^"]+' | grep -E '^(1\.[0-9]\.[0-9]|2\.[0-1]\.)'