Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🦀 crates.io
Not in CISA KEV

GHSA-753p-wrj5-g8fj pqcrypto-hqc

Fix: PQClean/PQClean#578

GHSA-753p-wrj5-g8fj is a security vulnerability in pqcrypto-hqc. A fix is available for pqcrypto-hqc — see the affected versions and patch details below.

PQClean has a correctness error in HQC decapsulation

Published
Dec 11, 2024
Updated
Dec 11, 2024
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Dec 11, 2024 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected
🦀pqcrypto-hqc

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.

Description

Impact

A correctness error has been identified in the reference implementation of the HQC key encapsulation mechanism. Due to an indexing error, part of the secret key is incorrectly treated as non-secret data. This results in an incorrect shared secret value being returned when the decapsulation function is called with a malformed ciphertext.

No concrete attack exploiting the error has been identified at this point. However, the error involves mishandling of the secret key, and in principle this presents a security vulnerability.

Patches

PQClean does not have a release process, as it is a collection of implementations. If you obtained a HQC implementation from PQClean, please update to a version that includes the fixes proposed in https://github.com/PQClean/PQClean/pull/578.

Please also refer to our security policy.

Workarounds

Manually patching is always possible

Further details

In the 2023/04/30 version of the HQC specification and reference implementation, an extra field (sigma) was added to the secret key structure to enable implicit rejection of malformed ciphertexts. The logic to retrieve the public key from the secret key in the decapsulation function was not updated accordingly. As a result, sigma is treated as part of the public key. Later in the decapsulation call, a incorrectly constructed comparison check allows this error to go through undetected. Due to how these two bugs interfere with each other, the decapsulation function never uses sigma to perform implicit rejection; instead, it accepts malformed ciphertexts and returns shared secrets based on their decryptions.

References

This issue was first reported in OQS https://github.com/open-quantum-safe/liboqs/security/advisories/GHSA-gpf4-vrrw-r8v7. The vulnerability was identified by Célian Glénaz and Dahmun Goudarzi (Quarkslab).

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🦀crates.iopqcrypto-hqcall versions0.2.1cargo update -p pqcrypto-hqc --precise 0.2.1

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for pqcrypto-hqc, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update pqcrypto-hqc to 0.2.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-753p-wrj5-g8fj is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-753p-wrj5-g8fj can be triaged on real exposure rather than presence alone.

Tailored to GHSA-753p-wrj5-g8fj. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### Impact A correctness error has been identified in the reference implementation of the HQC key encapsulation mechanism. Due to an indexing error, part of the secret key is incorrectly treated as non-secret data. This results in an incorrect shared secret value being returned when the decapsulation function is called with a malformed ciphertext. No concrete attack exploiting the error has been identified at this point. However, the error involves mishandling of the secret key, and in principle this presents a security vulnerability. ### Patches PQClean does not have a release process, as
O3 Security · Impact-Aware SCA

Is GHSA-753p-wrj5-g8fj in your dependencies?

O3 Security finds GHSA-753p-wrj5-g8fj across crates.io dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-753p-wrj5-g8fj: pqcrypto-hqc | O3 Security