{"id":"CVE-2024-58262","aliases":["CVE-2024-58262","GHSA-x4gp-pqpj-f43q","RUSTSEC-2024-0344"],"related":[],"kind":"vulnerability","state":"published","title":"curve25519-dalek has timing variability in `curve25519-dalek`'s `Scalar29::sub`/`Scalar52::sub`","summary":"The curve25519-dalek crate before 4.1.3 for Rust has a constant-time operation on elliptic curve scalars that is removed by LLVM.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"The curve25519-dalek crate before 4.1.3 for Rust has a constant-time operation on elliptic curve scalars that is removed by LLVM.","source":"cvelist"},{"lang":"en","text":"Timing variability of any kind is problematic when working with  potentially secret values such as elliptic curve scalars, and such issues can potentially leak private keys and other secrets. Such a problem was recently discovered in `curve25519-dalek`.\n\nThe `Scalar29::sub` (32-bit) and `Scalar52::sub` (64-bit) functions contained usage of a mask value inside a loop where LLVM saw an opportunity to insert a branch instruction (`jns` on x86) to conditionally bypass this code section when the mask value is set to zero as can be seen in godbolt:\n\n- 32-bit (see L106): https://godbolt.org/z/zvaWxzvqv\n- 64-bit (see L48): https://godbolt.org/z/PczYj7Pda\n\nA similar problem was recently discovered in the Kyber reference implementation:\n\nhttps://groups.google.com/a/list.nist.gov/g/pqc-forum/c/hqbtIGFKIpU/m/cnE3pbueBgAJ\n\nAs discussed on that thread, one portable solution, which is also used in this PR, is to introduce a volatile read as an optimization barrier, which prevents the compiler from optimizing it away.\n\nThe fix can be validated in godbolt here:\n\n- 32-bit: https://godbolt.org/z/jc9j7eb8E\n- 64-bit: https://godbolt.org/z/x8d46Yfah\n\nThe problem was discovered and the solution independently verified by Alexander Wagner <alexander.wagner@aisec.fraunhofer.de> and Lea Themint <lea.thiemt@tum.de> using their DATA tool:\n\nhttps://github.com/Fraunhofer-AISEC/DATA","format":"markdown","source":"ghsa"},{"lang":"en","text":"Timing variability of any kind is problematic when working with  potentially secret values such as\nelliptic curve scalars, and such issues can potentially leak private keys and other secrets. Such a\nproblem was recently discovered in `curve25519-dalek`.\n\nThe `Scalar29::sub` (32-bit) and `Scalar52::sub` (64-bit) functions contained usage of a mask value\ninside a loop where LLVM saw an opportunity to insert a branch instruction (`jns` on x86) to\nconditionally bypass this code section when the mask value is set to zero as can be seen in godbolt:\n\n- 32-bit (see L106): <https://godbolt.org/z/zvaWxzvqv>\n- 64-bit (see L48): <https://godbolt.org/z/PczYj7Pda>\n\nA similar problem was recently discovered in the Kyber reference implementation:\n\n<https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/hqbtIGFKIpU/m/cnE3pbueBgAJ>\n\nAs discussed on that thread, one portable solution, which is also used in this PR, is to introduce a\nvolatile read as an optimization barrier, which prevents the compiler from optimizing it away.\n\nThe fix can be validated in godbolt here:\n\n- 32-bit: <https://godbolt.org/z/jc9j7eb8E>\n- 64-bit: <https://godbolt.org/z/x8d46Yfah>\n\nThe problem was discovered and the solution independently verified by \nAlexander Wagner <alexander.wagner@aisec.fraunhofer.de> and Lea Themint <lea.thiemt@tum.de> using\ntheir DATA tool:\n\n<https://github.com/Fraunhofer-AISEC/DATA>","format":"markdown","source":"rustsec"},{"lang":"es","text":"El paquete curve25519-dalek para Rust anterior a 4.1.3 tiene una operación de tiempo constante en escalares de curva elíptica que es eliminada por LLVM.","source":"nvd"}],"published":"2024-06-18T12:00:00.000Z","modified":"2026-09-10T03:50:15.886Z","severity":{"scorer":"mitre","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","score":2.9,"rating":"LOW"},"severities":[{"scorer":"mitre","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","score":2.9,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","score":2.9,"rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.1,"rating":"MEDIUM"}],"cwes":["CWE-203","CWE-733"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"4.1.3","status":"affected"}],"vendor":"dalek-cryptography","product":"curve25519-dalek","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.1.3"}],"ecosystem":"crates.io","package":"curve25519-dalek","purl":"pkg:cargo/curve25519-dalek","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"4.1.3"}],"ecosystem":"crates.io","package":"curve25519-dalek","purl":"pkg:cargo/curve25519-dalek","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"4.1.3"}],"vendor":"dalek","product":"curve25519-dalek","cpe":"cpe:2.3:a:dalek:curve25519-dalek:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2024-0344.html","tags":["advisory","third-party-advisory","web"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://github.com/dalek-cryptography/curve25519-dalek/pull/659","tags":["issue-tracking","patch","web"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://crates.io/crates/curve25519-dalek","tags":["package","product"],"sources":["cvelist","rustsec","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-58262","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/dalek-cryptography/curve25519-dalek/commit/415892acf1cdf9161bd6a4c99bc2f4cb8fae5e6a","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/dalek-cryptography/curve25519-dalek","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"mitre","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-07-28T15:25:33.472Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-58262","url":"https://www.cve.org/CVERecord?id=CVE-2024-58262","licence":"CVE Terms of Use","modified":"2025-07-28T18:55:22.149Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-x4gp-pqpj-f43q","url":"https://github.com/advisories/GHSA-x4gp-pqpj-f43q","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:15.886Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2024-0344","url":"https://rustsec.org/advisories/RUSTSEC-2024-0344.html","licence":"CC0-1.0","modified":"2025-10-28T06:29:09.774Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-58262","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-58262","licence":"Public domain","modified":"2026-06-17T08:14:44.117Z"}],"updatedAt":"2026-11-25T22:58:52.829Z","epss":{"score":0.0018,"percentile":0.07958,"date":"2026-12-01T12:00:22.000Z"}}