GHSA-4hff-hh47-7788: Duplicate Advisory: curve25519-dalek has timing variability in `curve25519-dalek`'s `Scalar29::sub`/`Scalar52::sub`
2.9
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
curve25519-dalek | rust | < 4.1.3 | 4.1.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability, identified as GHSA-4hff-hh47-7788, is a timing side-channel issue in the curve25519-dalek
crate. The root cause is a compiler optimization in LLVM that introduces a data-dependent branch in the scalar subtraction functions, specifically Scalar52::sub
and, as mentioned in the advisory, Scalar29::sub
. This timing variability could allow an attacker to leak secret information. The analysis of the provided patch 8f38163e5cd6ddb048b0bd5a3737927b79e6d80f
confirms the vulnerability in Scalar52::sub
located in curve25519-dalek/src/backend/serial/u64/scalar.rs
. The patch mitigates this by introducing a black_box
function using a volatile read, which acts as an optimization barrier and prevents the compiler from introducing the vulnerable branch. While the advisory also mentions Scalar29::sub
, the provided commit only contains the fix for Scalar52::sub
. A security engineer should ensure that all instances of this pattern are patched in their environment, as other scalar sizes might be affected as well.
Vulnerable functions
Scalar52::sub
curve25519-dalek/src/backend/serial/u64/scalar.rs