GHSA-prmc-5v5w-c465: Nats Client TLS Credentials Sent Raw Vulnerability

CRITICAL
CWE-522
Published
Advisory Summary

GHSA-prmc-5v5w-c465 is a CRITICAL client tls credentials sent raw vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Nats libraries in the npm ecosystem. The issue involves client tls credentials sent raw to server in npm package nats. Remediation is available by upgrading affected packages to version 2.0.0-209.

GHSA-prmc-5v5w-c465 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-prmc-5v5w-c465
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product Nats
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-prmc-5v5w-c465

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

nats fixed: 2.0.0-209
npm install nats@2.0.0-209
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 nats

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-prmc-5v5w-c465, inspect your project dependencies using npm:

npm ls nats

Analyze the terminal output to locate any version of Nats in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0-209), your application is affected.

Note: The npm ls nats 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-522: Insufficiently Protected Credentials, where the product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval. In Nats, 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

Nats is a Node.js client for the NATS messaging system. ## Problem Description _Preview versions_ of two NPM packages and one Deno package from the NATS project contain an information disclosure flaw, leaking options to the NATS server; for one package, this includes TLS private credentials. The _connection_ configuration options in these JavaScript-based implementations were fully serialized and sent to the server in the client's `CONNECT` message, immediately after TLS establishment. The nats.js client supports Mutual TLS and the credentials for the TLS client key are included in the connection configuration options; disclosure of the client's TLS private key to the server has been observed. Most authentication mechanisms are handled after connection, instead of as part of connection, so other authentication mechanisms are unaffected. For clarity: NATS account NKey authentication **is NOT affected**. Neither the nats.ws nor the nats.deno clients support Mutual TLS: the affected versions listed below are those where the logic flaw is present. We are including the nats.ws and nats.deno versions out of an abundance of caution, as library maintainers, but rate as minimal the likelihood of applications leaking sensitive data. ## Affected versions ### Security impact * NPM package nats.js: + **mainline is unaffected** + beta branch is vulnerable from 2.0.0-201, fixed in 2.0.0-209 ### Logic flaw * NPM package nats.ws: + status: preview + flawed from 1.0.0-85, fixed in 1.0.0-111 * Deno repository https://github.com/nats-io/nats.deno + status: preview + flawed in all git tags prior to fix + fixed with git tag v1.0.0-9 ## Impact For deployments using TLS client certificates (for mutual TLS), private key material for TLS is leaked from the client application to the server. If the server is untrusted (run by a third party), or if the client application also disables TLS verification (and so the true identity of the server is unverifiable) then authentication credentials are leaked. ## Workaround *None* ## Solution Upgrade your package dependencies to fixed versions, and then reissue any TLS client credentials (with new keys, not just new certificates) and revoke the old ones.

GHSA-prmc-5v5w-c465 Affected Nats Versions

1 component(s)
Fixed Versions:
2.0.0-209
Product / Package Ecosystem Affected Versions Fixed Version
nats
npm
≥ 2.0.0-201
< 2.0.0-209
2.0.0-209

References

Frequently Asked Questions

What is GHSA-prmc-5v5w-c465?
GHSA-prmc-5v5w-c465 is a security vulnerability in Nats involving Client TLS credentials sent raw to server in npm package nats under CWE-522: Insufficiently Protected Credentials.
Which Nats versions are affected?
Affected versions include releases prior to 2.0.0-209 across affected packages: nats.
What version fixes GHSA-prmc-5v5w-c465?
Upgrading to 2.0.0-209 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nats affected?
Yes, nats is affected in releases prior to 2.0.0-209. Upgrade your dependency to 2.0.0-209 or later.
What CWE is associated with GHSA-prmc-5v5w-c465?
GHSA-prmc-5v5w-c465 is classified under CWE-522: Insufficiently Protected Credentials (The product transmits or stores authentication credentials, but it uses an insecure method that is susceptible to unauthorized interception and/or retrieval.).
How can I check npm dependencies for GHSA-prmc-5v5w-c465?
Run the dependency tree command: 'npm ls nats'. 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-prmc-5v5w-c465",
  "modified" : "2021-03-31T18:09:39Z",
  "published" : "2021-04-06T17:32:38Z",
  "aliases" : [ ],
  "summary" : "Client TLS credentials sent raw to server in npm package nats",
  "details" : "Nats is a Node.js client for the NATS messaging system.\n\n## Problem Description\n\n_Preview versions_ of two NPM packages and one Deno package from the NATS project contain an information disclosure flaw, leaking options to the NATS server; for one package, this includes TLS private credentials.\n\nThe _connection_ configuration options in these JavaScript-based implementations were fully serialized and sent to the server in the client's `CONNECT` message, immediately after TLS establishment.\n\nThe nats.js client supports Mutual TLS and the credentials for the TLS client key are included in the connection configuration options; disclosure of the client's TLS private key to the server has been observed.\n\nMost authentication mechanisms are handled after connection, instead of as part of connection, so other authentication mechanisms are unaffected.\nFor clarity: NATS account NKey authentication **is NOT affected**.\n\nNeither the nats.ws nor the nats.deno clients support Mutual TLS: the affected versions listed below are those where the logic flaw is\npresent.  We are including the nats.ws and nats.deno versions out of an abundance of caution, as library maintainers, but rate as minimal the likelihood of applications leaking sensitive data.\n\n\n## Affected versions\n\n### Security impact\n\n* NPM package nats.js:\n  + **mainline is unaffected**\n  + beta branch is vulnerable from 2.0.0-201, fixed in 2.0.0-209\n\n### Logic flaw\n\n* NPM package nats.ws:\n  + status: preview\n  + flawed from 1.0.0-85, fixed in 1.0.0-111\n\n* Deno repository https://github.com/nats-io/nats.deno\n  + status: preview\n  + flawed in all git tags prior to fix\n  + fixed with git tag v1.0.0-9\n\n\n## Impact\n\nFor deployments using TLS client certificates (for mutual TLS), private key material for TLS is leaked from the client application to the\nserver.  If the server is untrusted (run by a third party), or if the client application also disables TLS verification (and so the true identity of the server is unverifiable) then authentication credentials are leaked.\n\n## Workaround\n\n*None*\n\n## Solution\n\nUpgrade your package dependencies to fixed versions, and then reissue any TLS client credentials (with new keys, not just new certificates) and revoke the old ones.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "nats"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0-201"
      }, {
        "fixed" : "2.0.0-209"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.0.0-208"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats.js/security/advisories/GHSA-prmc-5v5w-c465"
  }, {
    "type" : "WEB",
    "url" : "https://advisories.nats.io/CVE/CVE-2020-26149.txt"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-522" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-31T18:09:39Z",
    "nvd_published_at" : null
  }
}