Description
secp256k1-native is a native C secp256k1 implementation for Ruby. In affected native builds, native constant-time scalar multiplication through `Point#mul` or `scalar_multiply_ct` can leak timing information about a secret scalar when compiled by a toolchain that reconstructs branchless selection into a branch. The `Montgomery ladder` uses `uint256_select` with an all-zeros or all-ones mask, but affected GCC builds at `-O2` recover the original condition and emit secret-dependent `je` or `jne` jumps whose timing correlates with scalar bits. This defeats the assumption behind the 0.17.0 `jp_add_internal` infinity-branch fix. A consumer must multiply a secret private key or nonce in a context where an attacker can observe timing; repeated measurements can statistically recover scalar bits. The defect is in the compiled binary, so source review or `ctgrind` on a non-reconstructing toolchain may miss it. GCC 14.3.0, 15.1.0, and 15.2.0 reproduced the branch reconstruction, and `extconf.rb` appends `-O2`. Tested GCC versions through 12.4.0 used bitwise operations and GCC 13.3.0 used constant-time `cmov`; the pure-Ruby path is not affected by this flaw and separately makes no constant-time claim. GCC 16 and clang were untested, and point releases, targets, and flag combinations were not exhaustively bisected. `Earlier pre-0.17.0 versions had different constant-time issues rather than this introduced select idiom.` Version 0.18.0 contains the verified fix. The advisory's broad pre-0.18.0 guidance also covers earlier, different constant-time issues; whether this CVE groups those issues or only the select idiom introduced in 0.17.0 remains unresolved.
Published: 2026-10-30
Score: 5.9 Medium
EPSS: n/a
KEV: No
Impact: Timing side‑channel leakage
Action: Upgrade
AI Analysis

Impact

The vulnerability occurs when a compiler rewrites a branchless selection used in the Montgomery ladder into a secret‑dependent branch during scalar multiplication in secp256k1-native. This introduces timing differences that correlate with bits of the scalar. An attacker who can measure the elapsed time of `Point#mul` or `scalar_multiply_ct` executions may recover each secret bit after many measurements, ultimately revealing a private key or nonce. The underlying weakness is a timing side‑channel (CWE‑1255) that breaks the constant‑time claim of the library (CWE‑208). The flaw does not affect the pure‑Ruby implementation, so the leak is limited to binaries compiled with GCC versions 14+ and 15+ at the default –O2 optimisation level.

Affected Systems

The flaw affects the sgbett:secp256k1-native library used by Ruby applications. Versions released before 0.18.0, in particular 0.17.x and earlier, build with the extconf.rb script that appends –O2 and are susceptible when compiled with certain GCC toolchains. Systems that employ these libraries to perform cryptographic signing, key generation, or nonce multiplication in environments where an attacker can observe timing are at risk. Users relying on the pure‑Ruby path or on newer GCC versions that preserve constant‑time semantics are not impacted.

Risk and Exploitability

The CVSS score of 5.9 ranks the issue as medium severity. EPSS is not available, and the vulnerability is not listed in CISA KEV, suggesting limited public exploitation at this time. However, the flaw requires an environment that allows precise timing measurements; an attacker who can trigger the scalar multiplication repeatedly, perhaps in a networked service or a client‑side application, could statistically recover the secret bits. Because the compromise hinges on observable timing, it is harder to exploit than a direct code execution bug, but the information disclosed can lead to full key compromise. The risk level is moderate, with a likelihood that depends on the attacker’s ability to perform repeated measurements and subtle timing differences.

Generated by OpenCVE AI on October 31, 2026 at 00:20 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade to secp256k1-native v0.18.0 or later to receive the verified fix.
  • If an upgrade is not possible, rebuild the library with a compiler that does not perform branch reconstruction such as GCC 13.3 or clang, or adjust optimization flags to avoid –O2 that triggers the issue.
  • Alternatively, switch to the pure‑Ruby implementation for scalar multiplication, which does not claim constant‑time behavior and is not affected by this flaw.

Generated by OpenCVE AI on October 31, 2026 at 00:20 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 30 Oct 2026 23:00:00 +0000

Type Values Removed Values Added
Description secp256k1-native is a native C secp256k1 implementation for Ruby. In affected native builds, native constant-time scalar multiplication through `Point#mul` or `scalar_multiply_ct` can leak timing information about a secret scalar when compiled by a toolchain that reconstructs branchless selection into a branch. The `Montgomery ladder` uses `uint256_select` with an all-zeros or all-ones mask, but affected GCC builds at `-O2` recover the original condition and emit secret-dependent `je` or `jne` jumps whose timing correlates with scalar bits. This defeats the assumption behind the 0.17.0 `jp_add_internal` infinity-branch fix. A consumer must multiply a secret private key or nonce in a context where an attacker can observe timing; repeated measurements can statistically recover scalar bits. The defect is in the compiled binary, so source review or `ctgrind` on a non-reconstructing toolchain may miss it. GCC 14.3.0, 15.1.0, and 15.2.0 reproduced the branch reconstruction, and `extconf.rb` appends `-O2`. Tested GCC versions through 12.4.0 used bitwise operations and GCC 13.3.0 used constant-time `cmov`; the pure-Ruby path is not affected by this flaw and separately makes no constant-time claim. GCC 16 and clang were untested, and point releases, targets, and flag combinations were not exhaustively bisected. `Earlier pre-0.17.0 versions had different constant-time issues rather than this introduced select idiom.` Version 0.18.0 contains the verified fix. The advisory's broad pre-0.18.0 guidance also covers earlier, different constant-time issues; whether this CVE groups those issues or only the select idiom introduced in 0.17.0 remains unresolved.
Title secp256k1-native: Compiler-reconstructed secret-dependent branch in native scalar multiplication
Weaknesses CWE-1255
CWE-208
References
Metrics cvssV3_1

{'score': 5.9, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N'}


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-30T22:48:09.173Z

Reserved: 2026-07-16T19:20:28.987Z

Link: CVE-2026-63410

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-10-30T23:17:15.547

Modified: 2026-10-30T23:17:15.547

Link: CVE-2026-63410

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-31T00:30:14Z

Weaknesses
  • CWE-1255

    Comparison Logic is Vulnerable to Power Side-Channel Attacks

  • CWE-208

    Observable Timing Discrepancy