Project

General

Profile

Actions

Bug #9508

open
LL

tls: JA4_c hash includes a spurious underscore when signature_algorithms is absent, diverging from FoxIO JA4 v1.0.1

Bug #9508: tls: JA4_c hash includes a spurious underscore when signature_algorithms is absent, diverging from FoxIO JA4 v1.0.1

Added by L L4wli3t 3 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Affected Versions:
Effort:
Difficulty:
Label:
Protocol, Rust

Description

Summary
-------
Suricata's JA4 client fingerprint (tls.ja4 in EVE) does not match the
FoxIO JA4 v1.0.1 specification when the ClientHello omits the
signature_algorithms extension (0x000d). Suricata appends an extra
underscore before hashing the extension-ID list, producing a JA4_c value
that differs from a spec-correct implementation (verified against
Wireshark/TShark 4.4.9) for every ClientHello of this shape.

Where
-----
rust/src/ja4.rs, JA4::try_new (suricata-8.0.4, commit 6af634b19b36)

Spec (FoxIO JA4 v1.0.1, "Extension Hash"):
https://github.com/FoxIO-LLC/ja4/blob/v1.0.1/technical_details/JA4.md#extension-hash
"Form a comma-separated list of sorted four-digit lowercase extension
IDs... Append an underscore and the signature algorithms in offered
order ONLY when the signature list has entries. With no signatures,
hash the extension-ID text alone."

Suricata's current behaviour always places an underscore between the
extension-ID list and the signature-algorithm list, even when the
signature list is empty, before hashing.

Reproduction
------------
Capture: any ClientHello without extension 0x000d. Verified on 418/418
such ClientHellos from a real device capture (TP-Link smart plug,
UNSW-IoTraffic dataset, publicly available).

Extracted extension-ID list for one such ClientHello: 000a,000b,000f,0023

FoxIO-spec / TShark 4.4.9 input:   "000a,000b,000f,0023"      (19 bytes)
sha256(...)[:12] = 282f11336259
Suricata 8.0.4 input:             "000a,000b,000f,0023_"     (20 bytes)
sha256(...)[:12] = e190e6f68b9b

TShark 4.4.9's tls.handshake.ja4 for this packet matches the FoxIO-spec
value above (282f11336259). Suricata's tls.ja4 for the same packet

Control case (confirms the bug is specifically the empty-signature-list
branch): a ClientHello that DOES carry signature_algorithms produces
identical JA4 values in both TShark and Suricata, 80/80 streams checked
(HelloBarbie device, same dataset). The underscore + signature-list
suffix is correct and matches between both tools whenever the signature
list is non-empty.

Both tools' input:   "000d,0023_0403,0203,0401,0201"   (29 bytes)
sha256(...)[:12] = a14e6f3f51d5 (matches on both tools)

Expected
--------
When the retained/filtered extension-ID list is non-empty and the
signature-algorithms list is empty, hash the extension-ID list alone,
with no trailing underscore, per the FoxIO v1.0.1 spec.

Actual
------
Suricata always inserts an underscore between the two lists before
hashing, regardless of whether the signature list is empty, producing a
JA4_c (and therefore full JA4) that does not match a spec-compliant
implementation or other tools (TShark/Wireshark) for any ClientHello
that omits signature_algorithms.

Impact
------
This is a correctness/spec-compliance issue, not a crash or security
vulnerability. Affects interoperability: a Suricata-produced JA4 for
this (common, especially on simpler/older TLS clients such as IoT
devices) ClientHello shape will not match JA4 values computed by other
spec-compliant tools or published in external JA4-keyed threat-intel
feeds for the same real-world client, producing false negatives on any
JA4-based correlation that crosses tool boundaries.

Suggested fix
-------------
In JA4::try_new (rust/src/ja4.rs), only emit the separating underscore
and append the signature-algorithm list when that list is non-empty;
otherwise hash the extension-ID list alone, matching the branch TShark
already implements in epan/dissectors/packet-tls-utils.c
(ssl_dissect_hnd_cli_hello, gated on sighash_list count).

Happy to share full reproduction script and raw packet/EVE evidence if
useful.

No data to display

Actions

Also available in: PDF Atom