# CVE-2024-48930: secp256k1-node vulnerable to private key extraction over ECDH

> An attacker can extract private keys by exploiting missing curve validation in compressed public key loading during ECDH sessions.

- **Severity:** High 8.7 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Oct 2024
- **Updated:** 21 Oct 2024
- **Also known as:** GHSA-584q-6j8j-r5pm

## What is CVE-2024-48930?

CVE-2024-48930 is a high-severity vulnerability in cryptocoinjs secp256k1-node, published on 21 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official 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.

Weakness: CWE-354 (Improper Validation of Integrity Check Value)

## Which versions are affected by CVE-2024-48930?

6 open source packages ship an affected version, including secp256k1.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `secp256k1` | npm | All versions | 3.8.1 |
| `secp256k1` | npm | All versions | 3.8.1 |
| `secp256k1` | npm | From 4.0.0 | 4.0.4 |
| `secp256k1` | npm | From 4.0.0 | 4.0.4 |
| `secp256k1` | npm | From 5.0.0 | 5.0.1 |
| `secp256k1` | npm | From 5.0.0 | 5.0.1 |

## How do I fix CVE-2024-48930?

Upgrade secp256k1 to a fixed version for your release line: 3.8.1, 4.0.4 or 5.0.1.

## Is CVE-2024-48930 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-48930 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-48930 and fix it if it is affected.

What it is: CVE-2024-48930 is a high-severity vulnerability in cryptocoinjs secp256k1-node, published on 21 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-48930 exists.

Affected packages and fixed versions:
- secp256k1 (npm): affected all versions; fixed in 3.8.1
- secp256k1 (npm): affected all versions; fixed in 3.8.1
- secp256k1 (npm): affected from 4.0.0; fixed in 4.0.4
- secp256k1 (npm): affected from 4.0.0; fixed in 4.0.4
- secp256k1 (npm): affected from 5.0.0; fixed in 5.0.1
- secp256k1 (npm): affected from 5.0.0; fixed in 5.0.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-48930/ (Markdown: https://insights.sbomify.com/CVE-2024-48930/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-48930
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-48930
- OSV: https://osv.dev/vulnerability/CVE-2024-48930

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-48930/
Summaries are generated and may contain mistakes; the official description above is the record.
