CVE-2025-52473
Executive Summary
CVE-2025-52473 is a vulnerability in the liboqs cryptographic library, specifically within the reference implementation of the HQC (Hamming Quasi-Cyclic) key encapsulation mechanism. The flaw involves secret-dependent branches that become exploitable when the code is compiled with Clang at optimization levels higher than -O0 (e.g., -O1, -O2). A local attacker can leverage this side-channel to recover the entire secret key. The vulnerability has been fixed in liboqs version 0.14.0.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the liboqs library, which is a C-language cryptographic library providing post-quantum cryptography implementations. It is distributed as source code and integrated into various projects. The library is not typically distributed via package managers like NPM, PyPI, Go, or Ruby, but it is a critical component in the post-quantum cryptography supply chain. Users must update to version 0.14.0 or later to mitigate the risk.
CVSS Breakdown & Threat Level
- CVSS Score: 5.9 (Medium)
- Attack Vector: Local (AV:L)
- Attack Complexity: Low (AC:L)
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity Impact: None (I:N)
- Availability Impact: None (A:N)
The threat level is Medium due to the local attack vector and the requirement for specific compiler optimizations. However, the potential for full secret key recovery makes it a significant concern for systems using HQC in security-critical environments.
Deep Dive & Mechanics
The vulnerability arises from secret-dependent branches in the reference implementation of the HQC key encapsulation mechanism. When compiled with Clang at optimization levels above -O0, the compiler may introduce timing variations or other side-channel signals based on the secret key material. This allows a local attacker to perform a side-channel attack to recover the entire secret key.
The issue is specifically in the reference implementation, which is not optimized for constant-time execution. The fix in version 0.14.0 addresses these branches to ensure that the code runs in constant time, regardless of the secret key values.
Vulnerable vs. Patched Code
The vulnerable code involves conditional branches that depend on secret key bits. For example, a vulnerable snippet might look like:
if (secret_bit) {
// operation A
} else {
// operation B
}
The patched code replaces such branches with constant-time operations, such as using bitwise operations or conditional moves:
result = (secret_bit * operation_A) | ((1 - secret_bit) * operation_B);
This ensures that the execution path does not depend on the secret key, preventing side-channel leakage.
Exploitation & Lab Setup
Red Team
To exploit this vulnerability, an attacker needs local access to the target system and the ability to run code compiled with Clang at optimization levels above -O0. The attack involves:
- Setup: Compile the vulnerable liboqs version with Clang and optimization level
-O1or higher. - Execution: Run the HQC key generation or encapsulation routine while monitoring side-channel signals (e.g., timing, power consumption, or electromagnetic emissions).
- Analysis: Use statistical analysis to correlate the side-channel signals with the secret key bits.
- Recovery: Reconstruct the entire secret key from the collected data.
A proof-of-concept exploit is publicly available, demonstrating the attack on a local machine.
Blue Team
To defend against this vulnerability:
- Update: Immediately update liboqs to version 0.14.0 or later.
- Compilation: If updating is not possible, compile liboqs with
-O0optimization level to mitigate the side-channel leakage. - Monitoring: Monitor for unusual local processes that may be performing side-channel analysis (e.g., repeated execution of cryptographic routines with high precision timing).
- Access Control: Restrict local access to systems running HQC to trusted users only.
Indicators of Compromise (IOCs)
- File Hashes: SHA256 of vulnerable liboqs versions (e.g., 0.13.0).
- Process Names: Processes running HQC key generation or encapsulation with high CPU usage.
- Network Traffic: Unusual patterns of HQC-related network traffic (if used in a network protocol).
- System Logs: Logs indicating repeated execution of cryptographic operations with abnormal timing.
Detection Engineering
YARA Rule
rule CVE_2025_52473_liboqs_HQC_sidechannel {
meta:
description = "Detects vulnerable liboqs HQC implementation with secret-dependent branches"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-52473"
strings:
$secret_branch = { 0F 84 ?? ?? ?? ?? 48 8B ?? ?? ?? ?? ?? 48 85 ?? 0F 85 ?? ?? ?? ?? } // Example pattern for conditional jump
condition:
$secret_branch
}
Sigma Rule
title: CVE-2025-52473 - liboqs HQC Side-Channel Attack
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects potential exploitation of CVE-2025-52473 via side-channel analysis
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/hqc_keygen'
CommandLine|contains: '-O1'
condition: selection
falsepositives:
- Legitimate use of HQC with optimization
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-52473 - liboqs HQC Side-Channel Attack"; flow:to_server; content:"|48 8B 05|"; distance:0; within:4; reference:cve,2025-52473; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Update liboqs to version 0.14.0 or later.
- Compilation Workaround: If immediate update is not possible, compile liboqs with
-O0optimization level. - Monitoring: Implement monitoring for side-channel attack indicators.
- Access Control: Restrict local access to systems running HQC.
- Vendor Notification: Ensure all systems using liboqs are notified and updated.
Valters IT
DevSecOps & Cyber Threat Intelligence Expert