CVE-2024-1631
📋 TL;DR
This vulnerability in the @dfinity/identity library allows attackers to compromise ed25519 key pairs when no seed value is provided, using predictable/insecure randomness instead of secure cryptographic randomness. This affects applications using the Ed25519KeyIdentity.generate() function without a seed parameter, potentially leading to loss of funds or access to canisters on the Internet Computer blockchain.
💻 Affected Systems
- @dfinity/identity
📦 What is this software?
Icp Js Core by Dfinity
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of blockchain identities, loss of all funds associated with vulnerable principals, and permanent loss of control over canisters where vulnerable principals are controllers.
Likely Case
Attackers generate predictable private keys to steal funds from vulnerable blockchain accounts or take control of canisters.
If Mitigated
No impact if using secure seed values or patched versions, or if vulnerable function isn't used.
🎯 Exploit Status
The vulnerability is in the library itself - attackers can generate the same predictable keys as legitimate users.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.0.1
Vendor Advisory: https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3
Restart Required: No
Instructions:
1. Update @dfinity/identity to version 1.0.1 or later. 2. Run 'npm update @dfinity/identity' or 'yarn upgrade @dfinity/identity'. 3. Rebuild and redeploy affected applications.
🔧 Temporary Workarounds
Provide secure seed parameter
allAlways provide a cryptographically secure 32-byte seed when calling Ed25519KeyIdentity.generate()
🧯 If You Can't Patch
- Immediately rotate all keys generated with vulnerable versions and move funds to new secure identities
- Stop using Ed25519KeyIdentity.generate() without secure seed parameters in all applications
🔍 How to Verify
Check if Vulnerable:
Check package.json for @dfinity/identity version <1.0.1 and review code for calls to Ed25519KeyIdentity.generate() without seed parameter.
Check Version:
npm list @dfinity/identity or check package.json
Verify Fix Applied:
Confirm @dfinity/identity version is 1.0.1 or higher in package.json and package-lock.json/yarn.lock
📡 Detection & Monitoring
Log Indicators:
- Failed authentication attempts with predictable keys
- Unexpected principal/identity changes
Network Indicators:
- Unusual blockchain transactions from vulnerable principals
SIEM Query:
Search for application logs containing 'Ed25519KeyIdentity.generate' calls without seed parameters
🔗 References
- https://agent-js.icp.xyz/identity/index.html
- https://github.com/dfinity/agent-js
- https://github.com/dfinity/agent-js/pull/851
- https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3
- https://www.npmjs.com/package/@dfinity/identity/v/1.0.1
- https://agent-js.icp.xyz/identity/index.html
- https://github.com/dfinity/agent-js
- https://github.com/dfinity/agent-js/pull/851
- https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3
- https://www.npmjs.com/package/@dfinity/identity/v/1.0.1