Node.jsApplication

CVE-2023-30590

HIGH · 7.5 CVSS v3.1 Published 2023-11-28
Fix available
A fix is available. Upgrade to 16.20.1 / 18.16.1 or later.
See remediation →
84/100
Remediation priority · High
Remotely reachable No privileges Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
The generateKeys() API function returned from crypto.createDiffieHellman() only generates missing (or outdated) keys, that is, it only generates a private key if none has been set yet, but the function is also needed to compute the corresponding public key after calling setPrivateKey(). However, the documentation says this API call: "Generates private and public Diffie-Hellman key values". The documented behavior is very different from the actual behavior, and this difference could easily lead to security issues in applications that use these APIs as the DiffieHellman may be used as the basis for application-level security, implications are consequently broad.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

In Node.js crypto.createDiffieHellman(), the generateKeys() function only generates a private key if none exists, failing to compute the corresponding public key when setPrivateKey() has been called. This contradicts the documentation stating it 'Generates private and public Diffie-Hellman key values', potentially causing applications to use incomplete or insecure key pairs for cryptographic operations.

MitigationApplications using setPrivateKey() followed by generateKeys() should manually compute the public key using the private key, or audit code to ensure DH key pairs are complete before use in security-critical operations.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
Node.jsApplication
Affected:>= 16.0.0, < 16.20.1>= 18.0.0, < 18.16.1>= 20.0.0, < 20.3.1

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Determine your Node.js version
    Run 'node --version' in your terminal to get the installed Node.js version number
    Affected if The version is 16.0.0 to 16.20.0, 18.0.0 to 18.16.0, or 20.0.0 to 20.3.0 (any version in the ranges >= 16.0.0 < 16.20.1, >= 18.0.0 < 18.16.1, or >= 20.0.0 < 20.3.1)
  2. Identify use of crypto.createDiffieHellman
    Search your codebase for 'crypto.createDiffieHellman' or 'require("crypto").createDiffieHellman' to see if your application creates Diffie-Hellman objects
    Affected if Your application uses crypto.createDiffieHellman() to create DH key pairs
  3. Check for setPrivateKey() followed by generateKeys()
    Search for code that calls setPrivateKey() on a DH object and then calls generateKeys() on the same object
    Affected if Your code calls setPrivateKey() before calling generateKeys() on the same Diffie-Hellman object
  4. Verify public key computation after setPrivateKey
    Inspect whether your code manually calls getPublicKey() after setPrivateKey() and generateKeys(), or review if getPublicKey() returns a valid computed value rather than incomplete or stale data
    Affected if After calling setPrivateKey() then generateKeys(), getPublicKey() returns an incomplete key or the code does not explicitly compute the public key using getPublicKey()

You are affected if your Node.js version is in the vulnerable range AND your application uses the pattern of calling setPrivateKey() followed by generateKeys() on a Diffie-Hellman object without manually computing the public key afterward.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 16.20.1 / 18.16.1 / 20.3.1 or later
Fixed in 16.20.118.16.120.3.1
Interim mitigation

Applications using setPrivateKey() followed by generateKeys() should manually compute the public key using the private key, or audit code to ensure DH key pairs are complete before use in security-critical operations.

Recommended fix High confidence

Node.js 16.20.1+ (LTS), 18.16.1+ (LTS), or 20.3.1+ (Current)

  1. Identify the current Node.js version in use by running `node --version`
  2. Stop any services or applications running on the affected Node.js version
  3. Upgrade Node.js to version 16.20.1 or higher (for 16.x branches), 18.16.1 or higher (for 18.x branches), or 20.3.1 or higher (for 20.x branches)
  4. Verify the new Node.js version is installed correctly by running `node --version`
  5. Restart any affected services or applications to ensure they use the updated Node.js runtime
  6. Test that crypto.createDiffieHellman() with generateKeys() now correctly generates both private and public keys as documented
Caveat Minor - this is a bug fix, but applications relying on the buggy behavior may need testing; ensure Diffie-Hellman key exchange functionality works correctly after upgrade

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Node.js Scoped from the published advisory
  • Consultation6.0 h
  • Implementation12.0 h
  • Testing10.0 h
  • Review / QA8.0 h
36.0 hours of engineering $6,300
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $10,080.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2023-30590 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2023-30590 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data