Skip to content

bound capwap decap reads to caplen in dissectPacket#10487

Open
uwezkhan wants to merge 1 commit into
ntop:devfrom
uwezkhan:capwap-decap-caplen
Open

bound capwap decap reads to caplen in dissectPacket#10487
uwezkhan wants to merge 1 commit into
ntop:devfrom
uwezkhan:capwap-decap-caplen

Conversation

@uwezkhan

Copy link
Copy Markdown
Contributor

The CAPWAP UDP tunnel branch in dissectPacket reads the header-length byte at packet[ip_offset + 1] before checking that byte is inside the captured data, then advances ip_offset by that value and compares the result against h->len. h->len is the on-wire frame size, not h->caplen, so on a snaplen-truncated capture (caplen < len) the header-length read and the later packet[ip_offset - 2] and inner IP reads run past the end of the packet buffer. A crafted CAPWAP-data UDP packet triggers it, and tunnel decoding is on by default.

Before, this branch trusted h->len for the bound while every sibling tunnel case (GRE, ERSPAN, GTP, L2TP, 6in4) bounds against h->caplen. After, the header-length byte is guarded against h->caplen first and the advanced offset is compared to h->caplen as well. The tradeoff is that a CAPWAP frame whose header was clipped by the snap length is now dropped instead of parsed from uncaptured bytes, which is how the other decoders already behave.

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