The vulnerability is a protocol compliance issue in the clatter library, where certain handshake patterns involving pre-shared keys (PSKs) violated the PSK validity rule from the Noise Protocol Framework. This could allow an attacker to weaken the security guarantees of the handshake, potentially leading to key reuse.
The analysis of the patch commit b65ae6e9b8019bed5407771e21f89ddff17c5a71 shows the vulnerability had two root causes:
-
Lack of Pattern Validation: The HandshakePattern::new constructor and the HandshakePattern::add_psks helper function did not validate that the created handshake patterns adhered to the PSK validity rule. This allowed insecure patterns to be created. The patch addresses this by introducing validation logic in a new try_new function that is used by both new and add_psks.
-
Missing Runtime Enforcement: The write_message methods in NqHandshakeCore, PqHandshakeCore, and HybridHandshakeCore would process these invalid patterns without any checks. This is where the vulnerability would manifest at runtime, as these functions would proceed to use PSK-derived keys for encryption without the required randomization from a self-chosen ephemeral key. The patch adds runtime checks to these functions to detect and prevent this insecure state, returning a PskValidityViolation error.
Additionally, the library itself provided several vulnerable patterns (e.g., noise_pqkk_psk0, noise_hybrid_nk_psk0), which were removed in the patch. An exploit would involve an application using one of these vulnerable patterns (or a custom-defined one) and then calling the write_message function, which would appear in a runtime profile or stack trace.