From: Yeonggi Kim <[email protected]>

ssl_sock_parse_clienthello() walks the extensions while
"msg + 4 < extensions_end". When the last extension has an empty body
(extended_master_secret, signed_certificate_timestamp,
post_handshake_auth, ...), its 4-byte header ends exactly at
extensions_end and the extension is not recorded. ssl_fc_extlist_bin
then misses it, and so does a JA3 fingerprint built from it. A
ClientHello whose only extension is empty gives no list at all. The
other captured lists (supported groups, point formats, signature
algorithms, supported versions) never come from an empty extension and
are not affected.

This can be seen with "openssl s_client -tls1_1": such a client sends
no signature_algorithms, so extended_master_secret comes last and
ssl_fc_extlist_bin reports FF01000B000A00230016 instead of
FF01000B000A002300160017.

The loop only needs room for the 4-byte header, so use "<=".

The bug was introduced in 2.5 by commit 769fd2e44 ("MEDIUM: ssl:
Capture more info from Client Hello"). This should be backported to
all stable branches.
---
 src/ssl_sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 90da22762..22bd61675 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -2226,7 +2226,7 @@ static void ssl_sock_parse_clienthello(int write_p, int 
version,
        capture->extensions_offset = offset;
 
        /* Parse each extension */
-       while (msg + 4 < extensions_end) {
+       while (msg + 4 <= extensions_end) {
                /* Add 2 bytes of extension_id */
                if (global_ssl.capture_buffer_size >= offset + 2) {
                        capture->data[offset++] = msg[0];
-- 
2.52.0



Reply via email to