CVE-2024-1631 agent-js: Insecure Key Generation in `Ed25519KeyIdentity.generate`
Insecure key generation in agent-js allows attackers to compromise private keys, leading to loss of funds or canister control.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-1631?
CVE-2024-1631 is a critical vulnerability in Internet Computer agent-js, published on 21 Feb 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Impact: The library offers a function to generate an ed25519 key pair via Ed25519KeyIdentity.generate with an optional param to provide a 32 byte seed value, which will then be used as the secret key. When no seed value is provided, it is expected that the library generates the secret key using secure randomness. However, a recent change broke this guarantee and uses an insecure seed for key pair generation. Since the private key of this identity (535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe) is compromised, one could lose funds associated with the principal on ledgers or lose access to a canister where this principal is the controller.
Which versions are affected by CVE-2024-1631?
4 open source packages ship an affected version, including @dfinity/auth-client and @dfinity/identity. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
@dfinity/auth-client npm | From 0.20.0-beta.0 | 1.0.1 |
@dfinity/auth-client npm | From 0.20.0-beta.0 | 1.0.1 |
@dfinity/identity npm | From 0.20.0-beta.0 | 1.0.1 |
@dfinity/identity npm | From 0.20.0-beta.0 | 1.0.1 |
Products include Dfinity Icp-Js-Core.
How do I fix CVE-2024-1631?
Upgrade @dfinity/auth-client to 1.0.1 or later.
Is CVE-2024-1631 being exploited?
There is no known exploitation of CVE-2024-1631 in the wild and no public exploit code.
Sources
Also known as CVE-2024-27084, GHSA-c9vv-fhgv-cjc3.