Skip to content

httpsig-rs: HMAC verification is vulnerable to timing attack

Moderate severity GitHub Reviewed Published Sep 12, 2025 in junkurihara/httpsig-rs

Package

cargo httpsig (Rust)

Affected versions

< 0.0.19

Patched versions

0.0.19

Description

Summary

HMAC signature comparison is not timing-safe and is vulnerable to timing attacks.

Details

SharedKey::sign() returns a Vec<u8> which has a non-constant-time equality implementation.

Hmac::finalize() returns a constant-time wrapper (CtOutput) which was discarded. Alternatively, Hmac has a constant-time verify() method.

The problem reported here is due to the following lines in SharedKey::sign() of the previous code:

let mut mac = HmacSha256::new_from_slice(key).unwrap();
mac.update(data);
Ok(mac.finalize().into_bytes().to_vec())

and the merged update changes the third line to directly verify with verify_slice.

Impact

Anyone who uses HS256 signature verification is vulnerably to Timing Attack that allows the attacker to forge a signature.

References

@junkurihara junkurihara published to junkurihara/httpsig-rs Sep 12, 2025
Published by the National Vulnerability Database Sep 12, 2025
Published to the GitHub Advisory Database Sep 12, 2025
Reviewed Sep 12, 2025

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N

EPSS score

Weaknesses

Observable Timing Discrepancy

Two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not. Learn more on MITRE.

CVE ID

CVE-2025-59058

GHSA ID

GHSA-q7pg-9pr4-mrp2

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.