Vulnerabilities in pkg:npm/@nfid/embed

PACKAGE
Advisory Summary

GHSA-84c3-j8r2-mcm8 is a CRITICAL (CVSS 9.1) @nfid/embed has compromised private key vulnerability (CWE-321: Use of Hard-coded Cryptographic Key) affecting @nfid/embed libraries in the npm ecosystem. The issue involves @nfid/embed has compromised private key due to @dfinity/auth-client producing insecure session keys. Remediation is available by upgrading affected packages to version 0.10.1-alpha.6.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@nfid/embed

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@nfid/embed. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-84c3-j8r2-mcm8 - CRITICAL @nfid/embed has compromised private key due to @dfinity/auth-client producing insecure session keys

GHSA-84c3-j8r2-mcm8 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-84c3-j8r2-mcm8
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-321: Use of Hard-coded Cryptographic Key
Affected Product @nfid/embed
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-84c3-j8r2-mcm8

To remediate this vulnerability, upgrade all affected @nfid/embed dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@nfid/embed fixed: 0.10.1-alpha.6
npm install @nfid/embed@0.10.1-alpha.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @nfid/embed

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-84c3-j8r2-mcm8, inspect your project dependencies using npm:

npm ls @nfid/embed

Analyze the terminal output to locate any version of @nfid/embed in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.10.1-alpha.6), your application is affected.

Note: The npm ls @nfid/embed command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-321: Use of Hard-coded Cryptographic Key, where the product uses a hard-coded, unchangeable cryptographic key. In @nfid/embed, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Problem User sessions in the @nfid/embed SDK with Ed25519 keys are vulnerable due to a compromised private key `535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe`. This exposes users to potential loss of funds on ledgers and unauthorized access to canisters they control. ### Solution Using version >1.0.1 of @dfinity/auth-client and @dfinity/identity packages, or @nfid/embed >0.10.1-alpha.6 includes patched versions of the issue. User sessions will be automatically fixed when they re-authenticate. ### Why this happened The DFINITY auth client library provides a function, `Ed25519KeyIdentity.generate`, for generating an Ed25519 key pair. This function includes an optional parameter to supply a 32-byte seed value, which will be utilized as the secret key. In cases where no seed value is provided, the library is expected to generate the secret key using secure randomness. However, a recent update of DFINITY libraries has compromised this assurance by employing an insecure seed for key pair generation. ### References [AgentJS CVE ](https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3)

GHSA-84c3-j8r2-mcm8 Affected @nfid/embed Versions

1 component(s)
Fixed Versions:
0.10.1-alpha.6
Product / Package Ecosystem Affected Versions Fixed Version
@nfid/embed
npm
≥ 0.10.0
< 0.10.1-alpha.6
0.10.1-alpha.6

References

Frequently Asked Questions

What is GHSA-84c3-j8r2-mcm8?
GHSA-84c3-j8r2-mcm8 is a security vulnerability in @nfid/embed involving @nfid/embed has compromised private key due to @dfinity/auth-client producing insecure session keys under CWE-321: Use of Hard-coded Cryptographic Key.
Which @nfid/embed versions are affected?
Affected versions include releases prior to 0.10.1-alpha.6 across affected packages: @nfid/embed.
What version fixes GHSA-84c3-j8r2-mcm8?
Upgrading to 0.10.1-alpha.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @nfid/embed affected?
Yes, @nfid/embed is affected in releases prior to 0.10.1-alpha.6. Upgrade your dependency to 0.10.1-alpha.6 or later.
What is the CVSS score of GHSA-84c3-j8r2-mcm8?
GHSA-84c3-j8r2-mcm8 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with GHSA-84c3-j8r2-mcm8?
GHSA-84c3-j8r2-mcm8 is classified under CWE-321: Use of Hard-coded Cryptographic Key (The product uses a hard-coded, unchangeable cryptographic key.).
How can I check npm dependencies for GHSA-84c3-j8r2-mcm8?
Run the dependency tree command: 'npm ls @nfid/embed'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-84c3-j8r2-mcm8",
  "modified" : "2024-02-26T20:10:10Z",
  "published" : "2024-02-26T20:10:10Z",
  "aliases" : [ ],
  "summary" : "@nfid/embed has compromised private key due to @dfinity/auth-client producing insecure session keys",
  "details" : "### Problem\nUser sessions in the @nfid/embed SDK with Ed25519 keys are vulnerable due to a compromised private key `535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe`. This exposes users to potential loss of funds on ledgers and unauthorized access to canisters they control.\n\n### Solution\nUsing version >1.0.1 of @dfinity/auth-client and @dfinity/identity packages, or @nfid/embed >0.10.1-alpha.6 includes patched versions of the issue.\n\nUser sessions will be automatically fixed when they re-authenticate.\n\n### Why this happened\nThe DFINITY auth client library provides a function, `Ed25519KeyIdentity.generate`, for generating an Ed25519 key pair. This function includes an optional parameter to supply a 32-byte seed value, which will be utilized as the secret key. In cases where no seed value is provided, the library is expected to generate the secret key using secure randomness. However, a recent update of DFINITY libraries has compromised this assurance by employing an insecure seed for key pair generation.\n\n### References\n[AgentJS CVE ](https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@nfid/embed"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.10.0"
      }, {
        "fixed" : "0.10.1-alpha.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/dfinity/agent-js/security/advisories/GHSA-c9vv-fhgv-cjc3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/internet-identity-labs/sdk-ts/security/advisories/GHSA-84c3-j8r2-mcm8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/internet-identity-labs/sdk-ts"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-321", "CWE-330" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-26T20:10:10Z",
    "nvd_published_at" : null
  }
}