A peer's key goes into X25519 agreement with no length or low-order check. Some implementations don't reject bad points, and a low-order key can force a predictable secret.
What goes wrong
X25519 has a reputation for being safe by default, and that reputation is doing damage here. The peer's key is accepted from the caller, wrapped into a curve key, and fed to agreement with no length check and no test for low-order points. The assumption is that the underlying library rejects bad input. Some versions do. Some do not.
Low-order points are the classic problem. Feed one in and the shared secret collapses to a small set of known values, sometimes all zeros. If your code never checks for a zero shared secret, you will derive keys from it and never notice. Validate the key length up front and reject an all-zero result, rather than trusting that every version of every dependency in your build runs the check for you.
The pattern
function deriveShared(peerKeyBytes):
// length never checked
peerKey = toCurveKey(peerKeyBytes)
// low-order points not rejected here
secret = x25519(myPrivate, peerKey)
return secretfunction deriveShared(peerKeyBytes):
if (peerKeyBytes.length != 32):
throw InvalidKey()
peerKey = toCurveKey(peerKeyBytes)
secret = x25519(myPrivate, peerKey)
if (isAllZero(secret)): // low-order point produced this
throw InvalidKey()
return secretGrounding and reachability were confirmed. The exploit-path gate would not conclude without the calling code, so the finding was held and an evidence request was raised instead of being reported as fact.
Why it matters to you
"The library handles it" is a version-dependent promise. Upgrade, downgrade, or swap the dependency and a check you never wrote can quietly vanish. An all-zero shared secret means an attacker picked your key material for you. Put the length and zero-result checks in your own code so the guarantee does not ride on a transitive dependency's patch level.
Check your own code
- Locate X25519 or other Diffie-Hellman agreements that use a peer-supplied key.
- Validate the key length before converting it to a curve point.
- Reject an all-zero shared secret instead of deriving keys from it.
- Write down which dependency version you rely on for point validation, then stop relying on it.