Summary
Parsec's libparsec_crypto component on the 3.x branch prior to 3.6.0 fails to reject weak-order Curve25519 points when built with the RustCrypto backend.
In Parsec Web deployments, a man-in-the-middle attacker can inject weak points into the Diffie–Hellman key exchange so that both parties derive the same shared key as the attacker, enabling a fraudulent but successful SAS code verification and undetected session interception.
Affected context
This vulnerability appears in Parsec environments where:
- The 3.x branch of Parsec prior to 3.6.0 is used, and
libparsec_cryptois compiled with the RustCrypto backend (not libsodium), and- Curve25519 is used for Diffie–Hellman key exchange and SAS (Short Authentication String) verification.
It primarily impacts Parsec Web, where ephemeral key exchanges are performed over networks potentially exposed to active man-in-the-middle attackers. Desktop clients using the libsodium backend are not affected by this specific flaw.
Exploit preconditions
- Attack surface: Network path between Parsec Web clients participating in a cryptographic key exchange.
- Required access: Ability to perform an active man-in-the-middle attack (e.g., on-path control, compromised router, malicious Wi‑Fi AP).
- Trigger point: The Diffie–Hellman key exchange on Curve25519 when the Parsec Web client uses
libparsec_cryptowith the RustCrypto backend. - Why exploitation is possible:
- The implementation does not verify that peer public keys lie in the correct prime-order subgroup on Curve25519.
- An attacker can supply specially crafted weak-order points to both parties.
- Due to missing subgroup/point validation (CWE-1240), both sides may derive a shared key that is predictable and also known to the attacker, yet still produce matching SAS codes.
Why this happens
The core issue stems from insufficient validation of elliptic-curve public keys during Diffie–Hellman exchanges.
In secure Curve25519 implementations, received public points must be checked to ensure they belong to the correct prime-order subgroup and are not low- or mixed-order points. When built with the RustCrypto backend, libparsec_crypto omitted these checks, accepting weak-order points as valid inputs.
This maps to CWE-327: Use of a Broken or Risky Cryptographic Algorithm and CWE-1240: Use of a Cryptographic Primitive with a Risky Implementation, because the algorithm is used without enforcing the required group invariants, undermining the security guarantees of the key exchange and SAS verification.
Potential impact
- An on-path attacker could successfully perform an undetected man-in-the-middle attack.
- Both parties may derive a shared key that is also known to the attacker.
- SAS (Short Authentication String) verification may incorrectly signal a secure, MITM-free channel.
- Confidentiality of exchanged data can be compromised, as traffic may be decrypted in real time.
- Integrity of communications can be subverted, with the attacker altering messages while remaining invisible to users.
General mitigation guidance
Effective mitigation focuses on enforcing robust elliptic-curve validation and hardening the cryptographic implementation:
- Ensure all Curve25519 public keys are validated, including checks for low-order points, small subgroup elements, and other invalid points before use in key agreement.
- Prefer well-reviewed, constant-time cryptographic backends that provide built-in subgroup and point validation for Curve25519.
- Treat cryptographic backends as part of the trusted computing base and subject them to independent review, with explicit checks for known class issues such as weak public key validation.
- Implement defense-in-depth at the protocol layer by designing SAS and authentication flows that assume key agreement failures are possible and explicitly handle suspicious or repeated verification scenarios.
- Apply least-privilege and separation of concerns so that compromise of a single cryptographic operation does not automatically expose broader secrets or long-term keys.
How teams detect issues like this
Detection efforts can target both code and runtime behavior:
- Static analysis and review:
- Search for Curve25519/RustCrypto Diffie–Hellman usage lacking explicit point or subgroup validation checks.
- Review cryptographic wrappers and abstractions to confirm they validate public keys before invoking low-level primitives.
- Use security-focused linters or custom rules that flag elliptic-curve operations where inputs come directly from the network without validation.
- Code review signals:
- Key agreement code that assumes all received public keys are valid without checks.
- Custom or hand-rolled cryptographic glue code around third-party libraries.
- Policy and CI/CD:
- Enforce policies requiring third-party crypto libraries to meet specific validation guarantees.
- Integrate automated dependency and configuration checks to ensure safe backends are used consistently in production builds.
- Runtime and testing:
- Include negative test cases where weak-order or malformed points are injected to verify that the implementation rejects them.
- Perform protocol-level penetration tests simulating MITM scenarios to confirm that SAS and key verification logic behaves correctly.

