GHSA-q7pg-9pr4-mrp2

Suggest an improvement
Source
https://github.com/advisories/GHSA-q7pg-9pr4-mrp2
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/09/GHSA-q7pg-9pr4-mrp2/GHSA-q7pg-9pr4-mrp2.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-q7pg-9pr4-mrp2
Aliases
Published
2025-09-12T21:11:13Z
Modified
2025-09-12T21:57:19.184786Z
Severity
  • 5.9 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N CVSS Calculator
Summary
httpsig-rs: HMAC verification is vulnerable to timing attack
Details

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 (<code>CtOutput</code>) 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.

Database specific
{
    "github_reviewed": true,
    "severity": "MODERATE",
    "nvd_published_at": "2025-09-12T14:15:41Z",
    "cwe_ids": [
        "CWE-208"
    ],
    "github_reviewed_at": "2025-09-12T21:11:13Z"
}
References

Affected packages

crates.io / httpsig

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.0.19