Board: STM32F769I_EVAL
Compiler: arm-none-eabi-gcc v13
Describe the bug
A buffer overflow occurs in the RTSP server response construction. The server builds responses using repeated sprintf, strcat, and strlen appends without tracking the destination buffer's capacity. Additionally, the unsupported Require-header path copies unbounded request data until a Carriage Return (CR) character is encountered.
How To Reproduce
-
Indicate the global behavior of your application project:
RTSP Streaming Server via LwIP.
-
The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...):
Middleware/Application: LwIP_StreamingServer
File: Projects/STM32F769I_EVAL/Applications/LwIP/LwIP_StreamingServer/Src/rtsp_protocol.c
-
The use case that generates the problem:
Receiving a remote RTSP request containing a highly expanded header field, specifically an overly long Require value.
-
How we can reproduce the problem:
- Send an RTSP request to the server with a long
Require value that does not contain implicit-play, or include other fields that expand the response construction.
- The vulnerable code appends each character to
response + strlen(response) until a CRLF sequence is reached, performing no checks against the remaining buffer capacity.
Additional context
- Impact: A remote RTSP client can force response generation to exceed the allocated response buffer, causing memory corruption in the streaming-server process/task.
- Affected Revision: STM32CubeF7 revision
c2ecfd2d
- Proposed Fix:
- Pass the buffer length to each response helper function and utilize bounded append primitives (e.g.,
snprintf, strncat).
- Implement checks to stop parsing and reject the request if the response exceeds the buffer capacity.
- Correct the erroneous
memset(response, 0, sizeof(&response)) call, which currently clears only pointer-sized bytes rather than the full buffer when response is passed as a pointer.
Board: STM32F769I_EVAL
Compiler: arm-none-eabi-gcc v13
Describe the bug
A buffer overflow occurs in the RTSP server response construction. The server builds responses using repeated
sprintf,strcat, andstrlenappends without tracking the destination buffer's capacity. Additionally, the unsupportedRequire-header path copies unbounded request data until a Carriage Return (CR) character is encountered.How To Reproduce
Indicate the global behavior of your application project:
RTSP Streaming Server via LwIP.
The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...):
Middleware/Application:
LwIP_StreamingServerFile:
Projects/STM32F769I_EVAL/Applications/LwIP/LwIP_StreamingServer/Src/rtsp_protocol.cThe use case that generates the problem:
Receiving a remote RTSP request containing a highly expanded header field, specifically an overly long
Requirevalue.How we can reproduce the problem:
Requirevalue that does not containimplicit-play, or include other fields that expand the response construction.response + strlen(response)until a CRLF sequence is reached, performing no checks against the remaining buffer capacity.Additional context
c2ecfd2dsnprintf,strncat).memset(response, 0, sizeof(&response))call, which currently clears only pointer-sized bytes rather than the full buffer whenresponseis passed as a pointer.