Vulnerabilities in pkg:npm/nats.ws

PACKAGE
Advisory Identifier: GHSA-82rf-q3pr-4f6p
Advisory Summary

CVE-2020-26149 is a HIGH (CVSS 7.5) sensitive data exposure vulnerability (CWE-522: Insufficiently Protected Credentials) affecting Nats libraries in the npm ecosystem. The issue involves sensitive data exposure in nats. Remediation is available by upgrading affected packages to version 2.0.0-209, 1.0.0-111.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/nats.ws

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/nats.ws. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-82rf-q3pr-4f6p CVE-2020-26149 HIGH Sensitive data exposure in NATS

CVE-2020-26149 at a Glance

CVE Identifier CVE-2020-26149
GHSA Identifier GHSA-82rf-q3pr-4f6p
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-522: Insufficiently Protected Credentials
Affected Product Nats
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

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:N/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 None (I:N)
Availability None (A:N)

How to Fix CVE-2020-26149

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
nats.ws fixed: 1.0.0-111
npm install nats.ws@1.0.0-111
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 CVE-2020-26149, 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

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. ### 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.

CVE-2020-26149 Affected Nats Versions

2 component(s)
Fixed Versions:
2.0.0-2091.0.0-111
Product / Package Ecosystem Affected Versions Fixed Version
nats
npm
≥ 2.0.0-201
< 2.0.0-209
2.0.0-209
nats.ws
npm
≥ 1.0.0-85
< 1.0.0-111
1.0.0-111

References

Frequently Asked Questions

What is CVE-2020-26149?
CVE-2020-26149 is a security vulnerability in Nats involving Sensitive data exposure in NATS under CWE-522: Insufficiently Protected Credentials.
Which Nats versions are affected?
Affected versions include releases prior to 2.0.0-209, 1.0.0-111 across affected packages: nats, nats.ws.
What version fixes CVE-2020-26149?
Upgrading to 2.0.0-209, 1.0.0-111 (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.
Is nats.ws affected?
Yes, nats.ws is affected in releases prior to 1.0.0-111. Upgrade your dependency to 1.0.0-111 or later.
What is the CVSS score of CVE-2020-26149?
CVE-2020-26149 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2020-26149?
CVE-2020-26149 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 CVE-2020-26149?
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-82rf-q3pr-4f6p",
  "modified" : "2023-09-11T20:18:19Z",
  "published" : "2020-10-08T22:11:32Z",
  "aliases" : [ "CVE-2020-26149" ],
  "summary" : "Sensitive data exposure in NATS",
  "details" : "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. For 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 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.\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* 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### Impact:\n\nFor 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "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-206"
    }
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "nats.ws"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0-85"
      }, {
        "fixed" : "1.0.0-111"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.0.0-110"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-26149"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats.ws/commit/0a37ac2a411ff63f0707cda69a268c5fc4079eb7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats.deno/compare/v1.0.0-8...v1.0.0-9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nats-io/nats.ws"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2020/09/30/3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-522" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-10-08T22:11:09Z",
    "nvd_published_at" : null
  }
}