bound sessionID read in sniffer ProcessServerHello#10631
bound sessionID read in sniffer ProcessServerHello#10631netliomax25-code wants to merge 2 commits into
Conversation
|
Can one of the admins verify this patch? |
|
src/sniffer.c:ProcessServerHello |
The previous ID_LEN > *sslBytes check rejected a ServerHello with a valid short non-zero session id and no trailing data, marking the flow fatal. Copy the advertised length b instead of a fixed ID_LEN, guarded by b > ID_LEN so the fixed-size buffer can't overflow; the read of b bytes is already bounded by the existing length check. Add a sniffer unit test that drives a short-session-id ServerHello through ssl_DecodePacket.
|
Good catch, you're right that the first version rejected legitimate short session IDs.
Added |
|
Hi @netliomax25-code , can you tell us more about your project and use of the sniffer tool? Is this commercial or accedemic? What tools did you use to find these issues? We do require a signed contributor agreement. If that's something that you'd like to request please email support at wolfssl dot com and include details like your region and your organizational affiliation. We encourage reports like this and thank you for submitting your two PR's. Are you planning to submit further work? Thanks, David Garske, wolfSSL |
|
Hi David, thanks for taking a look. |
ProcessServerHello copies a fixed ID_LEN bytes of session id out of the captured ServerHello when the session-id length byte is non-zero, but the bounds check before it only ensures that length-byte value plus the cipher suite and compression fields are present. A ServerHello whose session id is shorter than 32 bytes, in a record with no trailing data, makes that copy read past the end of the frame buffer. ProcessClientHello already guards the identical copy with an ID_LEN check against the remaining bytes, so add the same check on the server side before the copy.