Skip to content

fix extension length underflow in sniffer hello parsers#10643

Open
netliomax25-code wants to merge 1 commit into
wolfSSL:masterfrom
netliomax25-code:sniffer-hello-ext-len-underflow
Open

fix extension length underflow in sniffer hello parsers#10643
netliomax25-code wants to merge 1 commit into
wolfSSL:masterfrom
netliomax25-code:sniffer-hello-ext-len-underflow

Conversation

@netliomax25-code

Copy link
Copy Markdown
  1. ProcessServerHello and ProcessClientHello walk the extension list with a word16 len taken from the 2-byte extensions length, but the per-extension guard only checks extLen > *sslBytes (bytes left in the capture), not the remaining len.
  2. With trailing capture data past the extensions block, an extLen above the remaining len but still under *sslBytes passes that guard, so len -= extLen + EXT_TYPE_SZ + LENGTH_SZ wraps and the loop keeps reading extension headers past the end of the frame.
  3. Bounded extLen against the remaining len at both sites so the subtraction cannot underflow.

Validated against an ASAN build of the loop: a ServerHello declaring an extensions length of 4 in a frame with 6 captured bytes and one extension of extLen 2 reads 2 bytes past the buffer before the change, and returns an input error cleanly after it.

@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

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.

3 participants