ghsa-q7pg-9pr4-mrp2
Vulnerability from github
Published
2025-09-12 21:11
Modified
2025-09-12 21:11
Severity ?
VLAI Severity ?
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 (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:
rust
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.
{ "affected": [ { "package": { "ecosystem": "crates.io", "name": "httpsig" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "0.0.19" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2025-59058" ], "database_specific": { "cwe_ids": [ "CWE-208" ], "github_reviewed": true, "github_reviewed_at": "2025-09-12T21:11:13Z", "nvd_published_at": "2025-09-12T14:15:41Z", "severity": "MODERATE" }, "details": "### Summary\nHMAC signature comparison is not timing-safe and is vulnerable to timing attacks.\n\n### Details\n`SharedKey::sign()` returns a `Vec\u003cu8\u003e` which has a non-constant-time equality implementation.\n\n`Hmac::finalize()` returns a constant-time wrapper ([`CtOutput`](https://docs.rs/digest/0.10.7/digest/struct.CtOutput.html)) which was discarded. Alternatively, `Hmac` has a constant-time `verify()` method.\n\nThe problem reported here is due to the following lines in `SharedKey::sign()` of the previous code:\n```rust\nlet mut mac = HmacSha256::new_from_slice(key).unwrap();\nmac.update(data);\nOk(mac.finalize().into_bytes().to_vec())\n```\nand the merged update changes the third line to directly verify with `verify_slice`.\n\n### Impact\n\nAnyone who uses HS256 signature verification is vulnerably to Timing Attack that allows the attacker to forge a signature.", "id": "GHSA-q7pg-9pr4-mrp2", "modified": "2025-09-12T21:11:13Z", "published": "2025-09-12T21:11:13Z", "references": [ { "type": "WEB", "url": "https://github.com/junkurihara/httpsig-rs/security/advisories/GHSA-q7pg-9pr4-mrp2" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-59058" }, { "type": "WEB", "url": "https://github.com/junkurihara/httpsig-rs/commit/fc095b6ce6043bb808f5d9c4379cf697899cb458" }, { "type": "PACKAGE", "url": "https://github.com/junkurihara/httpsig-rs" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N", "type": "CVSS_V3" } ], "summary": "httpsig-rs: HMAC verification is vulnerable to timing attack" }
Loading…
Loading…
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.
Loading…