CVE-2024-1631
agent-js: Insecure Key Generation in `Ed25519KeyIdentity.generate`
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.
INFO
Published Date :
Feb. 21, 2024, 3:15 a.m.
Last Modified :
Dec. 10, 2025, 5:16 p.m.
Remotely Exploit :
Yes !
Source :
6b35d637-e00f-4228-858c-b20ad6e1d07b
CVSS Scores
| Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
|---|---|---|---|---|---|---|
| CVSS 3.1 | CRITICAL | 6b35d637-e00f-4228-858c-b20ad6e1d07b |
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2024-1631.
| URL | Resource |
|---|---|
| https://agent-js.icp.xyz/identity/index.html | Broken Link |
| https://github.com/dfinity/agent-js | Product |
| https://github.com/dfinity/agent-js/pull/851 | Issue Tracking Patch |
| https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3 | Exploit Vendor Advisory |
| https://www.npmjs.com/package/@dfinity/identity/v/1.0.1 | Product |
| https://agent-js.icp.xyz/identity/index.html | Broken Link |
| https://github.com/dfinity/agent-js | Product |
| https://github.com/dfinity/agent-js/pull/851 | Issue Tracking Patch |
| https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3 | Exploit Vendor Advisory |
| https://www.npmjs.com/package/@dfinity/identity/v/1.0.1 | Product |
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2024-1631 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2024-1631
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2024-1631 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2024-1631 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
Initial Analysis by [email protected]
Dec. 10, 2025
Action Type Old Value New Value Added CWE CWE-330 Added CPE Configuration OR *cpe:2.3:a:dfinity:icp-js-core:*:*:*:*:*:node.js:*:* versions from (including) 0.20.0 up to (excluding) 1.0.1 Added Reference Type CVE: https://agent-js.icp.xyz/identity/index.html Types: Broken Link Added Reference Type DFINITY Foundation: https://agent-js.icp.xyz/identity/index.html Types: Broken Link Added Reference Type CVE: https://github.com/dfinity/agent-js Types: Product Added Reference Type DFINITY Foundation: https://github.com/dfinity/agent-js Types: Product Added Reference Type CVE: https://github.com/dfinity/agent-js/pull/851 Types: Issue Tracking, Patch Added Reference Type DFINITY Foundation: https://github.com/dfinity/agent-js/pull/851 Types: Issue Tracking, Patch Added Reference Type CVE: https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3 Types: Exploit, Vendor Advisory Added Reference Type DFINITY Foundation: https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3 Types: Exploit, Vendor Advisory Added Reference Type CVE: https://www.npmjs.com/package/@dfinity/identity/v/1.0.1 Types: Product Added Reference Type DFINITY Foundation: https://www.npmjs.com/package/@dfinity/identity/v/1.0.1 Types: Product -
CVE Modified by af854a3a-2127-422b-91ae-364da2661108
Nov. 21, 2024
Action Type Old Value New Value Added Reference https://agent-js.icp.xyz/identity/index.html Added Reference https://github.com/dfinity/agent-js Added Reference https://github.com/dfinity/agent-js/pull/851 Added Reference https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3 Added Reference https://www.npmjs.com/package/@dfinity/identity/v/1.0.1 -
CVE Modified by 6b35d637-e00f-4228-858c-b20ad6e1d07b
May. 14, 2024
Action Type Old Value New Value -
CVE Modified by 6b35d637-e00f-4228-858c-b20ad6e1d07b
Feb. 21, 2024
Action Type Old Value New Value Changed 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. Users are asked to take proactive measures mentioned below in Workarounds:Users to protect their assets. Patches Patch for the vulnerability is available in v1.0.1 for all the packages listed in the advisory. Please upgrade and deploy your canisters immediately. Workarounds Developers The recommended fix is to upgrade the package to the patched version. If that is not possible, there are couple of workarounds to handle the insecure key generation. * Invoking the function as Ed25519KeyIdentity.generate(null) would fix the broken conditional evaluation and force the function to generate a securely random seed. However, this is not guaranteed to work for future upgrades. * Passing a securely generated randomness as a seed to Ed25519KeyIdentity.generate would force the library to use it as the seed to generate the key pair. Users Removing a controller of a canister if it's the affected principal For all canisters you control, fetch the controllers of the canisters using dfx canister info --ic <CANISTER> If you see the principal 535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe as one of the controllers, follow the steps below dfx identity whoami # record CURRENT_IDENTITY dfx identity new <NEW_IDENTITY_NAME> dfx identity use <NEW_IDENTITY_NAME> dfx identity get-principal <NEW_IDENTITY_NAME> # record NEW_IDENTITY_PRINCIPAL dfx identity use <CURRENT_IDENTITY> dfx canister update-settings --ic <CANISTER> --add-controller <NEW_IDENTITY_PRINCIPAL> dfx canister update-settings --ic <CANISTER> --remove-controller `535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe` For more details on canister management, please visit here https://internetcomputer.org/docs/current/tutorials/developer-journey/level-1/1.6-managing-canisters Checking funds on wallets / ledgers If you have funds on ledgers using a browser wallet, please check if the account principal matches 535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe. If it does, please create a new account and transfer the funds to the new account immediately. 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. Added Reference Dfinity https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3 [No types assigned] -
CVE Received by 6b35d637-e00f-4228-858c-b20ad6e1d07b
Feb. 21, 2024
Action Type Old Value New Value Added 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. Users are asked to take proactive measures mentioned below in Workarounds:Users to protect their assets. Patches Patch for the vulnerability is available in v1.0.1 for all the packages listed in the advisory. Please upgrade and deploy your canisters immediately. Workarounds Developers The recommended fix is to upgrade the package to the patched version. If that is not possible, there are couple of workarounds to handle the insecure key generation. * Invoking the function as Ed25519KeyIdentity.generate(null) would fix the broken conditional evaluation and force the function to generate a securely random seed. However, this is not guaranteed to work for future upgrades. * Passing a securely generated randomness as a seed to Ed25519KeyIdentity.generate would force the library to use it as the seed to generate the key pair. Users Removing a controller of a canister if it's the affected principal For all canisters you control, fetch the controllers of the canisters using dfx canister info --ic <CANISTER> If you see the principal 535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe as one of the controllers, follow the steps below dfx identity whoami # record CURRENT_IDENTITY dfx identity new <NEW_IDENTITY_NAME> dfx identity use <NEW_IDENTITY_NAME> dfx identity get-principal <NEW_IDENTITY_NAME> # record NEW_IDENTITY_PRINCIPAL dfx identity use <CURRENT_IDENTITY> dfx canister update-settings --ic <CANISTER> --add-controller <NEW_IDENTITY_PRINCIPAL> dfx canister update-settings --ic <CANISTER> --remove-controller `535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe` For more details on canister management, please visit here https://internetcomputer.org/docs/current/tutorials/developer-journey/level-1/1.6-managing-canisters Checking funds on wallets / ledgers If you have funds on ledgers using a browser wallet, please check if the account principal matches 535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe. If it does, please create a new account and transfer the funds to the new account immediately. Added Reference Dfinity https://github.com/dfinity/agent-js/pull/851 [No types assigned] Added Reference Dfinity https://www.npmjs.com/package/@dfinity/identity/v/1.0.1 [No types assigned] Added Reference Dfinity https://github.com/dfinity/agent-js [No types assigned] Added Reference Dfinity https://agent-js.icp.xyz/identity/index.html [No types assigned] Added CWE Dfinity CWE-321 Added CWE Dfinity CWE-330 Added CVSS V3.1 Dfinity AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N