CVE-2024-1631 agent-js: Insecure Key Generation in `Ed25519KeyIdentity.generate`

Critical 9.1 Published Updated

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.

Weakness: CWE-330, CWE-321

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.

PackageAffectedFixed in
@dfinity/auth-client npmFrom 0.20.0-beta.01.0.1
@dfinity/auth-client npmFrom 0.20.0-beta.01.0.1
@dfinity/identity npmFrom 0.20.0-beta.01.0.1
@dfinity/identity npmFrom 0.20.0-beta.01.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.

Is CVE-2024-1631 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free