Latent missing check and truncation in RtpHeaderParser::ParseRtcp could cause memory-safety bug
- Fixed in 59 days
- Paid in 39 days
- Disclosed after 59 days
RtpHeaderParser::ParseRtcp (media\webrtc\trunk\webrtc\modules\rtp_rtcp\source\rtp_utility.cc) does not check whether the header specified by the packet actually lies within the memory that contains the packet. This bug could cause a caller to read memory to which it has no right, and possibly to do other insecure things in consequence. This function also can truncate a result, with unclear consequences.
These bugs are latent because ParseRtcp's only current caller is test code (ReadPacket in media\webrtc\trunk\webrtc\test\rtp_file_reader.cc and media\webrtc\trunk\webrtc\video_engine\test\auto_test\automated/vie_network_test.cc)
Details
-------
The first bug is the lack of a test against |_ptrRTPDataEnd| following line 299. The second bug is that line 299 can truncate the assignment of the RHS to the uint16_t |header->headerLength|.
275: bool RtpHeaderParser::ParseRtcp(RTPHeader* header) const {
276: assert(header != NULL);
277:
278: const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin;
279: if (length < kRtcpMinParseLength) {
280: return false;
281: }
282:
283: const uint8_t V = _ptrRTPDataBegin[0] >> 6;
284: if (V != kRtcpExpectedVersion) {
285: return false;
286: }
287:
288: const uint8_t PT = _ptrRTPDataBegin[1];
289: const uint16_t len = (_ptrRTPDataBegin[2] << 8) + _ptrRTPDataBegin[3];
290: const uint8_t* ptr = &_ptrRTPDataBegin[4];
291:
292: uint32_t SSRC = *ptr++ << 24;
293: SSRC += *ptr++ << 16;
294: SSRC += *ptr++ << 8;
295: SSRC += *ptr++;
296:
297: header->payloadType = PT;
298: header->ssrc = SSRC;
299: header->headerLength = 4 + (len << 2);
300:
301: return true;
302: }
Ironically, the function does check against |_ptrRTPDataEnd| on lines 278-9.
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 17 January 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.