GHSA-vp2j-gqfm-r3cf: secp256k1-native: Compiler-reconstructed secret-dependent branch in native scalar multiplication

Published Oct 30, 2026
·
Updated

secp256k1-native is a native C secp256k1 implementation for Ruby. In affected native builds, native constant-time scalar multiplication through Point#mul or scalarmultiplyct can leak timing information about a secret scalar when compiled by a toolchain that reconstructs branchless selection into a branch. The Montgomery ladder uses uint256select 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 jpaddinternal 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.

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade secp256k1-native to a version that resolves this vulnerability.

    Fixed in 0.18.0

Event History

Oct 30, 2026
CVE Published
via OSV·10:48 PM
Data Sourced
via OSV·10:48 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are realistically exposed?

Exposure requires the native extension to be built with a toolchain that reconstructs the branchless selection into a branch, and for the application to multiply a secret private key or nonce while an attacker can observe timing. Builds using GCC 14.3.0, 15.1.0, and 15.2.0 reproduced the issue; extconf.rb appends -O2.

2

What does an attacker need to exploit this?

The attacker does not need privileges or user interaction, but must obtain repeated timing measurements of secret-scalar multiplication. Those measurements can be used statistically to recover bits of the secret scalar.

3

How can I assess a deployed native build?

Assess the compiled binary rather than relying only on source review or ctgrind results from another toolchain. The relevant indicator is secret-dependent je or jne jumps emitted around the selection used by the Montgomery ladder; tested GCC versions through 12.4.0 used bitwise operations, while GCC 13.3.0 used constant-time cmov.

4

What can be done if the affected native build cannot be replaced immediately?

Avoid performing secret private-key or nonce multiplication in contexts where an attacker can collect timing observations. The pure-Ruby path is not affected by this specific compiler-induced flaw.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203