fix(carbonio): validate machoNet oob length against payload size#15
fix(carbonio): validate machoNet oob length against payload size#15Rakdos8 wants to merge 1 commit into
Conversation
|
Hi @Rakdos8 Thank you for the PR and apologies for the late response. We are still in the process of sorting out some details around contribution guidelines and PR templates. This does indeed look like a real issue. Could you please add a test case in |
A hostile peer controls m_oobDataLen via the packet's out-of-band length prefix. It was only bounded by maxPacketSize, never by the payload actually received, so m_payload could be advanced past m_data, payloadLen() - m_oobDataLen could underflow, and adjacent heap memory was disclosed to the oob callbacks. Reject packets whose oob block plus its length prefix exceeds payloadLen().
21feb47 to
8d9f54e
Compare
No worries about the delay : I can imagine open-sourcing a project isn't easy, especially sorting out contribution guidelines and templates along the way 😉 Done : added |
Summary
Closes a network-reachable heap over-read in the machoNet stream packet parser.
Problem
m_oobDataLenis read from the wire (attacker-controlled out-of-band lengthprefix). It was only bounded by
maxPacketSize, never by the payload actuallyreceived. A hostile peer could announce an
m_oobDataLenlarger than thereceived buffer, causing
m_payloadto advance pastm_data, thepayloadLen() - m_oobDataLencomputation to underflow, and adjacent heapmemory to be handed to the oob callbacks / returned to Python.
Fix
After the existing
maxPacketSizeguard, reject any packet whose oob blockplus its 4-byte length prefix exceeds
payloadLen(). Same style as thesibling check (PyErr_Format + return false), no behavioural change for
well-formed packets.
Type
Security — remote heap over-read / information disclosure (Critical).
Testing
Manual review; behaviour for valid packets unchanged (guard only rejects
malformed oversized oob lengths).