GHSA-gwj5-3vfq-q992: Github.com/nats io/nats server/v2 Denial of Service Vulnerability

LOW
CVSS 7.5
CWE-400
Published
Advisory Summary

GHSA-gwj5-3vfq-q992 is a LOW (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/nats io/nats server/v2 libraries in the Go ecosystem. The issue involves import loops in account imports, nats-server dos. Remediation is available by upgrading affected packages to version 2.2.0.

GHSA-gwj5-3vfq-q992 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-gwj5-3vfq-q992
Severity LOW
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Github.com/nats io/nats server/v2
Package Ecosystem Go
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:N/I:N/A:H).

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 None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix GHSA-gwj5-3vfq-q992

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

github.com/nats-io/nats-server/v2 fixed: 2.2.0
Upgrade github.com/nats-io/nats-server/v2 to 2.2.0
Verify Direct and Transitive Dependencies

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

inspect dependencies for github.com/nats-io/nats-server/v2

How to Check if You Are Affected

To determine whether your application is affected by GHSA-gwj5-3vfq-q992, inspect your project dependencies for Github.com/nats io/nats server/v2:

inspect dependencies for github.com/nats-io/nats-server/v2

Analyze the terminal output to locate any version of Github.com/nats io/nats server/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Github.com/nats io/nats server/v2, 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

(This advisory is canonically <https://advisories.nats.io/CVE/CVE-2020-28466.txt>) ## Problem Description An export/import cycle between accounts could crash the nats-server, after consuming CPU and memory. This issue was fixed publicly in <https://github.com/nats-io/nats-server/pull/1731> in November 2020. The need to call this out as a security issue was highlighted by `snyk.io` and we are grateful for their assistance in doing so. Organizations which run a NATS service providing access to accounts run by untrusted third parties are affected. See below for an important caveat if running such a service. ## Affected versions #### NATS Server * Version 2 prior to 2.2.0 + 2.0.0 through and including 2.1.9 are vulnerable. * fixed with nats-io/nats-server PR 1731, commit 2e3c226729 ## Impact The nats-server could be killed, after consuming resources. ## Workaround The import cycle requires at least two accounts to work; if you have open account sign-up, then restricting new account sign-up might hinder an attacker. ## Solution Upgrade the nats-server. ## Caveat on NATS with untrusted users Running a NATS service which is exposed to untrusted users presents a heightened risk. Any remote execution flaw or equivalent seriousness, or denial-of-service by unauthenticated users, will lead to prompt releases by the NATS maintainers. Fixes for denial of service issues with no threat of remote execution, when limited to account holders, are likely to just be committed to the main development branch with no special attention. Those who are running such services are encouraged to build regularly from git.

GHSA-gwj5-3vfq-q992 Affected Github.com/nats io/nats server/v2 Versions

1 component(s)
Fixed Versions:
2.2.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/nats-io/nats-server/v2
Go
< 2.2.0
2.2.0

References

Frequently Asked Questions

What is GHSA-gwj5-3vfq-q992?
GHSA-gwj5-3vfq-q992 is a security vulnerability in Github.com/nats io/nats server/v2 involving Import loops in account imports, nats-server DoS under CWE-400: Uncontrolled Resource Consumption.
Which Github.com/nats io/nats server/v2 versions are affected?
Affected versions include releases prior to 2.2.0 across affected packages: github.com/nats-io/nats-server/v2.
What version fixes GHSA-gwj5-3vfq-q992?
Upgrading to 2.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/nats-io/nats-server/v2 affected?
Yes, github.com/nats-io/nats-server/v2 is affected in releases prior to 2.2.0. Upgrade your dependency to 2.2.0 or later.
What is the CVSS score of GHSA-gwj5-3vfq-q992?
GHSA-gwj5-3vfq-q992 has a CVSS v3.1 base score of 7.5 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-gwj5-3vfq-q992?
GHSA-gwj5-3vfq-q992 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Go dependencies for GHSA-gwj5-3vfq-q992?
Run the dependency tree command: 'inspect dependencies for github.com/nats-io/nats-server/v2'. 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-gwj5-3vfq-q992",
  "modified" : "2021-05-20T21:07:16Z",
  "published" : "2021-05-21T16:22:16Z",
  "aliases" : [ ],
  "summary" : "Import loops in account imports, nats-server DoS",
  "details" : "(This advisory is canonically <https://advisories.nats.io/CVE/CVE-2020-28466.txt>)\n\n## Problem Description\n\nAn export/import cycle between accounts could crash the nats-server, after consuming CPU and memory.\n\nThis issue was fixed publicly in <https://github.com/nats-io/nats-server/pull/1731> in November 2020.\n\nThe need to call this out as a security issue was highlighted by `snyk.io` and we are grateful for their assistance in doing so.\n\nOrganizations which run a NATS service providing access to accounts run by untrusted third parties are affected.\nSee below for an important caveat if running such a service.\n\n\n## Affected versions\n\n#### NATS Server\n\n * Version 2 prior to 2.2.0\n   + 2.0.0 through and including 2.1.9 are vulnerable.\n * fixed with nats-io/nats-server PR 1731, commit 2e3c226729\n\n\n## Impact\n\nThe nats-server could be killed, after consuming resources.\n\n\n## Workaround\n\nThe import cycle requires at least two accounts to work; if you have open account sign-up, then restricting new account sign-up might hinder an attacker.\n\n\n## Solution\n\nUpgrade the nats-server.\n\n\n## Caveat on NATS with untrusted users\n\nRunning a NATS service which is exposed to untrusted users presents a heightened risk.\n\nAny remote execution flaw or equivalent seriousness, or denial-of-service by unauthenticated users, will lead to prompt releases by the NATS maintainers.\n\nFixes for denial of service issues with no threat of remote execution, when limited to account holders, are likely to just be committed to the main development branch with no special attention.\n\nThose who are running such services are encouraged to build regularly from git.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-server/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/security/advisories/GHSA-gwj5-3vfq-q992"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-20T21:07:16Z",
    "nvd_published_at" : null
  }
}