IntelligenceFindingsNMN-2026-0001
secp256k1-node allows private key extraction over ECDH
CandidateMachine- or researcher-generated; not independently verified.
In short
What to know.
- Package
- secp256k1 npmsecp256k1: from 5.0.0 before 5.0.1; listed versions 5.0.0. secp256k1: from 4.0.0 before 4.0.4. secp256k1: before 3.8.1
- What to do
- Upgrade secp256k1 to 5.0.1 or later. Upgrade secp256k1 to 4.0.4 or later. Upgrade secp256k1 to 3.8.1 or later.
- Severity
- HighRated by the source advisory.
- Confidence
- HighThe affected range comes from the advisory; no system that uses the component has been assessed.
Verification
Where it stands.
- Candidate
- In review
- Reproduced
- Confirmed
- Resolved
- Disputed
- Withdrawn
9 listed
Sources
- OSV record GHSA-584q-6j8j-r5pmosv.devRetrieved 3 December 2026
- web reference for GHSA-584q-6j8j-r5pmgithub.comRetrieved 3 December 2026
- advisory reference for GHSA-584q-6j8j-r5pmnvd.nist.govRetrieved 3 December 2026
- web reference for GHSA-584q-6j8j-r5pmgithub.comRetrieved 3 December 2026
- web reference for GHSA-584q-6j8j-r5pmgithub.comRetrieved 3 December 2026
- web reference for GHSA-584q-6j8j-r5pmgithub.comRetrieved 3 December 2026
- package reference for GHSA-584q-6j8j-r5pmgithub.comRetrieved 3 December 2026
- web reference for GHSA-584q-6j8j-r5pmgithub.comRetrieved 3 December 2026
- web reference for GHSA-584q-6j8j-r5pmgithub.comRetrieved 3 December 2026
Full record
- Finding
- NMN-2026-0001
- Category
- vulnerability
- Component
- secp256k1 (npm)secp256k1: from 5.0.0 before 5.0.1; listed versions 5.0.0. secp256k1: from 4.0.0 before 4.0.4. secp256k1: before 3.8.1
- Severity
- High. Rated by the source advisory.Severity as labelled by the source advisory GHSA-584q-6j8j-r5pm. CVSS as given: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N. Noumen has not assessed it.
- Confidence
- High.The affected range comes from the advisory; no system that uses the component has been assessed.
- State
- Candidate. Machine- or researcher-generated; not independently verified.
- Disclosure
- Public
- Mitigation
- Upgrade secp256k1 to 5.0.1 or later. Upgrade secp256k1 to 4.0.4 or later. Upgrade secp256k1 to 3.8.1 or later.
- Discovery method
- imported from a public advisory by the Advisory Monitor (1.0.0)Machine-generated by the agent advisory-monitor@1.0.0.
- Reproduction
- No reproduction steps recorded.
- Related advisories
- GHSA-584q-6j8j-r5pmCVE-2024-48930
- Affected systems
- None listed. A link to a system needs its own evidence.
- Attribution
- Researcher: advisory-monitor@1.0.0 (agent, machine-generated)Validators: None yet
- Assigned reviewer
- Nobody yet
- Dates
- Created 3 December 2026, 16:47 UTCUpdated 3 December 2026, 16:47 UTC
Summary, as published by the source advisory
### Summary
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 satisfying `Y^2 = X^3 + 7` for a given `X`, the same code calculates a solution for `-Y^2 = X^3 + 7`, and that solution also satisfies some other equation `Y^2 = X^3 + D`, where `D` is not equal to 7 and might be on a curve with factorizable cardinality, so `(X,Y)` might be a low-order point on that curve, lowering the number of possible ECDH output values to bruteforcable
Those output values correspond to remainders which can be then combined with Chinese remainder theorem to restore the original value
Endomorphism-based multiplication only slightly hinders restoration and does not affect the fact that the result is low-order
10 different malicious X values could be chosen so that the overall extracted information is 238.4 bits out of 256 bit private key, and the rest is trivially bruteforcable with an additional 11th public key (which might be valid or not -- not significant)
The attacker does not need to _receive_ the ECDH value, they only need to be able to confirm it against a list of possible candidates, e.g. check if using it to decipher block/stream cipher would work -- and that could all be done locally on the attacker side
### PoC
#### Example public key
This key has order 39
One of the possible outcomes for it is a throw, 38 are predictable ECDH values
Keys used in full attack have higher order (starting from ~20000), so are very unlikely to cause an error
```js
import secp256k1 from 'secp256k1/elliptic.js'
import { randomBytes } from 'crypto'
const pub = Buffer.from('028ac57f9c6399282773c116ef21f7394890b6140aa6f25c181e9a91e2a9e3da45', 'hex')
const seen = new Set()
for (let i = 0; i < 1000; i++) {
try {
seen.add(Buffer.from(secp256k1.ecdh(pub, randomBytes(32))).toString('hex'))
} catch {
seen.add('failure also is an outcome')
}
}
console.log(seen.size) // 39
```
#### Full attack
This PoC doesn't list the exact public keys or the code for `solver.js` intentionally, but this exact code works, on arbitrary random private keys:
```js
// Only the elliptic version is affected, gyp one isn't
// Node.js can use both, Web/RN/bundles always use the elliptic version
import secp256k1 from 'secp256k1/elliptic.js'
import { randomBytes } from 'node:crypto'
import assert from 'node:assert/strict'
import { Solver } from './solver.js'
const privateKey = randomBytes(32)
// The full dataset is precomputed on a single MacBook Air in a few days and can be reused for any private key
const solver = new Solver
// We need to run on 10 specially crafted public keys for this
// Lower than 10 is possible but requires more compute
for (let i = 0; i < 10; i++) {
const letMeIn = solver.ping() // this is a normal 33-byte Uint8Array, a 02/03-prefixed compressed public key
assert(letMeIn instanceof Uint8Array) // true
assert(secp256k1.publicKeyVerify(letMeIn)) // true
// Returning ecdh value is not necessary but is used in this demo for simplicity
// Solver needs to _confirm_ an ecdh value against
1 event, oldest first
History
History verified: 1 eventLatest hashafe2e8cb9ce8afe2e8cb9ce8f6171c0da1c960409806cb2dfef180f1ed7d6ee77ccd9da9ab6d
Record createdMachine-generated
By advisory-monitor@1.0.0 (agent, machine-generated)
Reason: Imported from public advisory GHSA-584q-6j8j-r5pm.
Entered the record in the state Candidate.
Event 1 hashafe2e8cb9ce8afe2e8cb9ce8f6171c0da1c960409806cb2dfef180f1ed7d6ee77ccd9da9ab6d
About this record
Severity and confidence are rated separately, each with its own reason.
History events are never edited or deleted. Each stores the hash of the one before, so a later change breaks the chain.
Corrections keep the value before and after.