title: 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.
problem types: CWE-321: Use of Hard-coded Cryptographic Key
affected:
{
defaultStatus: unaffected
product: agent-js
programFiles: https://github.com/dfinity/agent-js/blob/main/packages/identity/src/identity/ed25519.ts
vendor: Internet Computer
versions:
lessThan: v1.0.1, status: affected, version: v0.20.0-beta.0, versionType: 1.0.1
}
metrics:
cvssV3_1: [
attackComplexity: LOW
attackVector: NETWORK
availabilityImpact: NONE
baseScore: 9.1
baseSeverity: CRITICAL
confidentialityImpact: HIGH
integrityImpact: HIGH
privilegesRequired: NONE
scope: UNCHANGED
userInteraction: NONE
vectorString: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
version: 3.1
]
format: CVSS
scenarios: GENERAL