VYPR
High severityNVD Advisory· Published Oct 21, 2024· Updated Apr 15, 2026

CVE-2024-48930

CVE-2024-48930

Description

secp256k1-node is a Node.js binding for an Optimized C library for EC operations on curve secp256k1. In elliptic-based version, loadUncompressedPublicKey has a check that the public key is on the curve. Prior to versions 5.0.1, 4.0.4, and 3.8.1, however, loadCompressedPublicKey is missing that check. 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. Versions 5.0.1, 4.0.4, and 3.8.1 contain a fix for the issue.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
secp256k1npm
>= 5.0.0, < 5.0.15.0.1
secp256k1npm
>= 4.0.0, < 4.0.44.0.4
secp256k1npm
< 3.8.13.8.1

Patches

3
8bd6446e000f

elliptic: fix key verification in loadCompressedPublicKey

https://github.com/cryptocoinjs/secp256k1-nodeNikita SkovorodaOct 18, 2024via ghsa
3 files changed · +11 1
  • lib/elliptic.js+4 0 modified
    @@ -18,6 +18,10 @@ function loadCompressedPublicKey (first, xbuf) {
       let y = x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt()
       if ((first === 0x03) !== y.isOdd()) y = y.redNeg()
     
    +  // x*x*x + b = y*y
    +  const x3 = x.redSqr().redIMul(x)
    +  if (!y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()) return null
    +
       return ec.keyPair({ pub: { x: x, y: y } })
     }
     
    
  • package.json+1 1 modified
    @@ -40,7 +40,7 @@
         "node-gyp": "=10.1.0",
         "nyc": "^15.0.0",
         "prebuildify": "^6.0.1",
    -    "prebuildify-cross": "github:fanatid/prebuildify-cross#9f7af67698f06e07d42304d9813a6f19aee5812c",
    +    "prebuildify-cross": "^5.1.1",
         "standard": "^14.3.1",
         "tap-dot": "^2.0.0",
         "tape": "^4.10.1",
    
  • test/publickey.js+6 0 modified
    @@ -32,6 +32,12 @@ module.exports = (t, secp256k1) => {
           invalidLength[0] = publicKey.compressed[0]
           t.false(secp256k1.publicKeyVerify(invalidLength), 'invalid length')
     
    +      const zeroUncompressed = Buffer.concat([Buffer.from([0x04]), Buffer.alloc(64)])
    +      t.false(secp256k1.publicKeyVerify(zeroUncompressed), 'zero uncompressed')
    +
    +      const zeroCompressed = Buffer.concat([Buffer.from([0x02]), Buffer.alloc(32)])
    +      t.false(secp256k1.publicKeyVerify(zeroCompressed), 'zero compressed')
    +
           t.end()
         })
     
    
e256905ee649

elliptic: fix key verification in loadCompressedPublicKey

https://github.com/cryptocoinjs/secp256k1-nodeNikita SkovorodaOct 18, 2024via ghsa
2 files changed · +14 0
  • lib/elliptic/index.js+4 0 modified
    @@ -20,6 +20,10 @@ function loadCompressedPublicKey (first, xBuffer) {
       var y = x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt()
       if ((first === 0x03) !== y.isOdd()) y = y.redNeg()
     
    +  // x*x*x + b = y*y
    +  const x3 = x.redSqr().redIMul(x)
    +  if (!y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()) return null
    +
       return ec.keyPair({ pub: { x: x, y: y } })
     }
     
    
  • test/publickey.js+10 0 modified
    @@ -171,6 +171,16 @@ module.exports = function (t, secp256k1) {
           t.end()
         })
     
    +    t.test('zero key', function (t) {
    +      const zeroUncompressed = Buffer.concat([Buffer.from([0x04]), Buffer.alloc(64)])
    +      t.false(secp256k1.publicKeyVerify(zeroUncompressed), 'zero uncompressed')
    +
    +      const zeroCompressed = Buffer.concat([Buffer.from([0x02]), Buffer.alloc(32)])
    +      t.false(secp256k1.publicKeyVerify(zeroCompressed), 'zero compressed')
    +
    +      t.end();
    +    })
    +
         util.repeat(t, 'random tests', util.env.repeat, function (t) {
           var privateKey = util.getPrivateKey()
           var publicKey = util.getPublicKey(privateKey)
    
9a15fff274f8

elliptic: fix key verification in loadCompressedPublicKey

https://github.com/cryptocoinjs/secp256k1-nodeNikita SkovorodaOct 18, 2024via ghsa
3 files changed · +11 1
  • lib/elliptic.js+4 0 modified
    @@ -18,6 +18,10 @@ function loadCompressedPublicKey (first, xbuf) {
       let y = x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt()
       if ((first === 0x03) !== y.isOdd()) y = y.redNeg()
     
    +  // x*x*x + b = y*y
    +  const x3 = x.redSqr().redIMul(x)
    +  if (!y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()) return null
    +
       return ec.keyPair({ pub: { x: x, y: y } })
     }
     
    
  • package.json+1 1 modified
    @@ -40,7 +40,7 @@
         "node-gyp": "=10.1.0",
         "nyc": "^15.0.0",
         "prebuildify": "^6.0.1",
    -    "prebuildify-cross": "github:fanatid/prebuildify-cross#9f7af67698f06e07d42304d9813a6f19aee5812c",
    +    "prebuildify-cross": "^5.1.1",
         "standard": "^14.3.1",
         "tap-dot": "^2.0.0",
         "tape": "^4.10.1",
    
  • test/publickey.js+6 0 modified
    @@ -32,6 +32,12 @@ module.exports = (t, secp256k1) => {
           invalidLength[0] = publicKey.compressed[0]
           t.false(secp256k1.publicKeyVerify(invalidLength), 'invalid length')
     
    +      const zeroUncompressed = Buffer.concat([Buffer.from([0x04]), Buffer.alloc(64)])
    +      t.false(secp256k1.publicKeyVerify(zeroUncompressed), 'zero uncompressed')
    +
    +      const zeroCompressed = Buffer.concat([Buffer.from([0x02]), Buffer.alloc(32)])
    +      t.false(secp256k1.publicKeyVerify(zeroCompressed), 'zero compressed')
    +
           t.end()
         })
     
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

8

News mentions

0

No linked articles in our index yet.