OOB heap read/write in dcSCTP NackBetweenAckBlocks via crafted SACK chunks
A function in the dcSCTP code used by Firefox's WebRTC DataChannel handling iterates over attacker-controlled gap block values with only debug-only assertions, so a malicious peer can cause out-of-bounds heap reads and writes. This gives a remote peer a memory corruption primitive during fast recovery.
Originally disclosed on Mozilla
- Fixed in 5 days
- Paid in 25 days
- Disclosed after 5 days
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Steps to reproduce:
Manual source code review of third_party/libwebrtc/net/dcsctp/tx/outstanding_data.cc identified that NackBetweenAckBlocks() iterates TSNs up to an attacker-controlled gap_ack_blocks end value with only RTC_DCHECK bounds checking — compiled out in release Firefox. Critical asymmetry: sibling function AckGapBlocks() in the same file HAS runtime bounds checks, NackBetweenAckBlocks() does not. Missing upstream fix commit fd2e7ea (webrtc:495700476).
Actual results:
A malicious WebRTC DataChannel peer can send crafted SACK chunks with gap block end=60000 during fast recovery (trivially triggered by inducing packet loss). NackBetweenAckBlocks iterates ~59,993 TSNs beyond the deque boundary, each iteration calling GetItem() which reads AND writes 3 heap fields (nack_count_, ack_state_, lifecycle_) plus 5 global counters. This provides an OOB heap read/write primitive. The file has 23 RTC_DCHECK and 0 RTC_CHECK — zero runtime bounds protection in release Firefox.
Expected results:
NackBetweenAckBlocks should have the same runtime bounds checks as its sibling function AckGapBlocks. The upstream fix (commit fd2e7ea, webrtc:495700476) adds these checks. Firefox should import this fix.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the NackBetweenAckBlocks() function relies only on RTC_DCHECK assertions, which are removed in release builds, instead of runtime bounds checks like its sibling AckGapBlocks().
Impact
A malicious WebRTC DataChannel peer could achieve out-of-bounds heap reads and writes in the victim's browser, potentially leading to memory corruption.
What the attacker needed
Victim connects to a malicious WebRTC peer; packet loss to enter fast recovery
The fix
The function should have the same runtime bounds checks as AckGapBlocks(), and Firefox should import the upstream fix commit.
How it was found
- Review outstanding_data.cc and note the missing runtime bounds check in NackBetweenAckBlocks().
- As a malicious DataChannel peer, induce packet loss to enter fast recovery.
- Send crafted SACK chunks with a large gap block end value.
- Observe the function iterating far beyond the deque boundary, reading and writing heap fields.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When two browsers talk over a WebRTC data channel, they acknowledge received packets using a list of ranges. One function that processes those ranges trusts a number supplied by the other side and walks past the end of an internal list, touching memory it should not. A malicious peer could use this to read or corrupt memory in the victim's browser.
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.