🇰🇷 한글 설명
인증되지 않은 클라이언트가 변환 불가능한 Session 헤더를 포함한 요청을 보내 RTSP 서버의 패킷 풀을 고갈시킬 수 있는 취약점입니다. Session 처리 과정에서 오류 발생 시 응답 패킷이 풀로 반환되지 않아, 반복적인 요청 시 서버의 메모리 할당이 불가능해집니다.
💡 쉬운 설명
공격자가 잘못된 형식의 요청을 계속 보내면 서버가 사용할 수 있는 메모리 공간을 모두 써버리게 만듭니다. 이로 인해 서버가 더 이상 새로운 요청을 처리하지 못하고 멈추게 됩니다.
🇺🇸 원문 (English)
An unauthenticated client can drain the RTSP server's packet pool with a couple of dozen requests
that carry a Session header the parser cannot convert.
The Session branch returns the raw NetX error code instead of an RTSP status code:
```c
/* addons/rtsp/nx_rtsp_server.c:2754 */
status = _nx_utility_string_to_uint(field_value_ptr, field_value_length, &session_id);
if (status)
{
return(status); /* NX_INVALID_PARAMETERS / NX_SIZE_ERROR / NX_OVERFLOW */
}
```
Every other branch of the same function maps its failure to an RTSP status first. The CSeq branch
eighteen lines earlier does exactly that (line 2736 returns NX_RTSP_STATUS_CODE_BAD_REQUEST). The
raw code then reaches `_nx_rtsp_server_error_response_send` (nx_rtsp_server.c:1234), which does not
recognise it, takes a path that returns without releasing the response packet it already allocated,
and the block never goes back to the pool.
Six requests with an empty Session header against a 22 packet pool:
```
valid requests: after request 6: pool available = 21, AFTER = 22 / 22
malformed requests: after request 6: pool available = 16, AFTER = 17 / 22
```
One block per request, not returned when the client disconnects. Twenty six requests take the pool
to zero and the server starts failing allocations, after which it serves nobody. If the pool is
shared with the rest of the application, as it is in the shipped sample, the rest of the stack
stops with it.
Convert the `_nx_utility_string_to_uint` failure in the Session branch into
NX_RTSP_STATUS_CODE_BAD_REQUEST the way the CSeq branch does, and release the response packet on
every exit path of `_nx_rtsp_server_error_response_send`.
📍 영향받는 시스템
NetX Duo RTSP Server (nx_rtsp_server.c 관련 구현체)
⚔️ 공격 벡터
인증되지 않은 사용자가 변환 불가능한 Session 헤더를 포함한 RTSP 요청을 반복 전송
🛡️ 대응 방법
Session 처리 실패 시 NX_RTSP_STATUS_CODE_BAD_REQUEST를 반환하도록 수정하고, 모든 오류 경로에서 응답 패킷이 해제되도록 코드를 수정해야 합니다.
🔧 검증 코드
명령어 실행 결과 Session 처리 분기에서 오류 발생 시 RTSP 상태 코드가 아닌 원시 NetX 에러 코드를 반환하는지 확인합니다.
grep -n "_nx_utility_string_to_uint" nx_rtsp_server.c
💻 영향받는 소프트웨어
IBM WebSphere Application Server