High, CVSS 8.7npmAmendedPublished
secp256k1-node allows private key extraction over ECDH
CVE-2024-48930 · GHSA-584q-6j8j-r5pm
- Affected
- npm secp256k1 >= 5.0.0, <= 5.0.0; >= 4.0.0, < 4.0.4; <= 3.8.0
- Fixed in
- 3.8.15.0.14.0.4· Vendor fix available
- Issue
- In elliptic-based version, loadUncompressedPublicKey has a check that the public key is on the curve: https://github.com/cryptocoinjs/secp256k1-node/blob/6d3474b81d073cc9c8cc8cfadb580c84f8df5248/lib/elliptic.js#L37-L39 loadCompressedPublicKey is, however, missing that check: https://github.com/cryptocoinjs/secp256k1-node/blob/6d3474b81d073cc9c8cc8cfadb580c84f8df5248/lib/elliptic.js#L17-L19 That allows the attacker to use public keys on low-cardinality curves to extract enough information to fully restore the private key from as little as 11 ECDH sessions, and very cheaply on compute power Other operations on public keys are also affected, including e.g. publicKeyVerify() incorrectly returning true on those invalid keys, and e.g. publicKeyTweakMul() also returning predictable outcomes allowing to restore the tweak Details The curve equation is Y^2 = X^3 + 7, and it restores Y from X in loadCompressedPublicKey, using Y = sqrt(X^3 + 7), but when there are no valid Y values…
Recommended action: Upgrade to 5.0.1, 4.0.4 or 3.8.1 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.