-
Notifications
You must be signed in to change notification settings - Fork 209
Open
Description
Description
The fix for CVE-2024-35434 (commit da80ced) checks header size but the while loop uses attacker-controlled hdr_xr.len without validating each iteration stays in bounds.
To Reproduce
// Vulnerable pattern
if (size < sizeof(struct rtcp_hdr_xr))
return; // Header check OK
// But loop uses attacker-controlled len:
while (bsize < (ntohs(hdr_xr.len) + 1) * 4) {
// No check: bsize + sizeof(blk_xr) <= size
memcpy(&blk_xr, data + bsize, sizeof(blk_xr)); // OOB
}Send RTCP XR packet: 8 bytes actual, hdr_xr.len claims 44 bytes.
gcc -fsanitize=address -g -o poc poc.c && ./pocASan Output
==25354==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x502000000018
READ of size 4 at 0x502000000018 thread T0
#0 in process_rtcp_xr_VULNERABLE
0x502000000018 is located 0 bytes to the right of 8-byte region
SUMMARY: AddressSanitizer: heap-buffer-overflow in process_rtcp_xr_VULNERABLE
Fix
while (bsize < (ntohs(hdr_xr.len) + 1) * 4) {
if (bsize + sizeof(blk_xr) > size)
break;
memcpy(&blk_xr, data + bsize, sizeof(blk_xr));
}References
- Bug commit: da80ced
Reactions are currently unavailable