Latent (?) overflow in RTCPPacketInformation::AddApplicationData() could cause buffer overrun
- Fixed in 5 days
- Paid in 5 days
- Disclosed after 5 days
RTCPPacketInformation::AddApplicationData() (media\webrtc\trunk\webrtc\modules\rtp_rtcp\source\rtcp_receiver_help.cc) can experience an integer overflow. If it does, it allocates a buffer too short for the data that it writes into it. The data written is attacker-defined.
The bug appears to be latent because it appears that UDP is the only currently-used transport for RTCP packets, and the maximum theoretical size of a UDP packet (65507; see https://support.microsoft.com/en-us/kb/822061 ) is too small to cause the overflow. [1] The bug probably can be manifested if FF were to use TCP for RTCP packets, since then the practical maximum size of a compound RTCP packet would be >> 65536.
The bug is in line 66:
55: void RTCPPacketInformation::AddApplicationData(const uint8_t* data,
56: const uint16_t size) {
57: uint8_t* oldData = applicationData;
58: uint16_t oldLength = applicationLength;
59:
60: // Don't copy more than kRtcpAppCode_DATA_SIZE bytes.
61: uint16_t copySize = size;
62: if (size > kRtcpAppCode_DATA_SIZE) {
63: copySize = kRtcpAppCode_DATA_SIZE;
64: }
65:
66: applicationLength += copySize;
|applicationLength| is declared as a |uint16_t| in rtcp_receiver_help.h. Thus, a compound RTCP packet containing many sufficiently-large AppItem packets (e.g., 65536/kRtcpAppCode_DATA_SIZE) will cause |applicationLength| to overflow, which will cause line 67:
67: applicationData = new uint8_t[applicationLength];
to allocate a buffer that is too small to contain the accumulated data. Lines 69-74:
68:
69: if (oldData)
70: {
71: memcpy(applicationData, oldData, oldLength);
72: memcpy(applicationData+oldLength, data, copySize);
73: delete [] oldData;
74: } else
will then copy the accumlated data, of length e.g., 65536 bytes, into the buffer, overwriting whatever's beyond it in the heap.
75: {
76: memcpy(applicationData, data, copySize);
77: }
78: }
[1] And, in any case, the internet MTU for UDP packets is much smaller than 65507.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A low-severity memory corruption bug in WebRTC: Networking. Mozilla made it public on 30 August 2016.
About Memory corruption
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.