CVE-2024-48930: secp256k1 Vulnerability Allows Private Key Extraction Over ECDH
Summary
CVE-2024-48930: secp256k1-node allows private key extraction over ECDH. Affects secp256k1 across 3 version ranges.
< 3.8.1
>= 4.0.0, < 4.0.4
>= 5.0.0, < 5.0.1
Fixed in 3.8.1, 4.0.4 or 5.0.1, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
secp256k1 is a widely used cryptographic library that implements the secp256k1 elliptic curve, primarily for Bitcoin and other cryptocurrencies. It provides functionalities for key generation, signing, and verification of transactions. The library is crucial for ensuring secure communications and transactions in blockchain technology. However, a vulnerability has been identified in specific versions of this library, which could allow attackers to extract private keys under certain conditions.
Vulnerability Detail
The vulnerability arises from the improper handling of compressed public keys in the elliptic-based version of the secp256k1 library. Specifically, the function 'loadCompressedPublicKey' lacks a crucial check to ensure that the public key is valid and lies on the elliptic curve. This oversight allows attackers to use public keys from low-cardinality curves to extract enough information to reconstruct the private key after conducting as few as 11 ECDH sessions. The implications of this vulnerability are severe, as it compromises the security of cryptographic operations, potentially leading to unauthorized access to sensitive information.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 3.8.13.8.1npm install secp256k1@3.8.1 -
>= 4.0.0, < 4.0.44.0.4npm install secp256k1@4.0.4 -
>= 5.0.0, < 5.0.15.0.1npm install secp256k1@5.0.1
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary workaround, users should avoid using the elliptic version of the secp256k1 library until they can update to a patched version. Additionally, users can implement input validation to ensure that only valid public keys are processed.
Conclusion
The secp256k1 vulnerability CVE-2024-48930 poses a significant risk to applications relying on this library for cryptographic operations. It is crucial for developers to update to the latest patched versions and implement necessary workarounds to safeguard their applications against potential attacks.
See every vulnerability recorded for secp256k1 →
FAQ
CVE-2024-48930 is a vulnerability in the secp256k1 library that allows attackers to extract private keys through improper handling of compressed public keys.
Versions of secp256k1 prior to 5.0.1, 4.0.4, and 3.8.1 are affected by this vulnerability.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. By analyzing your package-lock.json file, Vulert can identify if your application is affected by this vulnerability.
If you cannot update the package right away, avoid using the elliptic version of the secp256k1 library and implement input validation to filter out invalid public keys.
This vulnerability can lead to unauthorized access to sensitive data by allowing attackers to reconstruct private keys, thereby compromising the security of cryptographic operations.
References
Related vulnerabilities
Recent vulnerabilities recorded for secp256k1.