Skip to content

fix(carbonio): validate machoNet oob length against payload size#15

Open
Rakdos8 wants to merge 1 commit into
carbonengine:mainfrom
Rakdos8:fix/machonet-oob-bounds
Open

fix(carbonio): validate machoNet oob length against payload size#15
Rakdos8 wants to merge 1 commit into
carbonengine:mainfrom
Rakdos8:fix/machonet-oob-bounds

Conversation

@Rakdos8
Copy link
Copy Markdown

@Rakdos8 Rakdos8 commented May 15, 2026

Summary

Closes a network-reachable heap over-read in the machoNet stream packet parser.

Problem

m_oobDataLen is read from the wire (attacker-controlled out-of-band length
prefix). It was only bounded by maxPacketSize, never by the payload actually
received. A hostile peer could announce an m_oobDataLen larger than the
received buffer, causing m_payload to advance past m_data, the
payloadLen() - m_oobDataLen computation to underflow, and adjacent heap
memory to be handed to the oob callbacks / returned to Python.

Fix

After the existing maxPacketSize guard, reject any packet whose oob block
plus its 4-byte length prefix exceeds payloadLen(). Same style as the
sibling 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).

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().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant