Skip to content

GHSA-gwj5-3vfq-q992 GO-2022-0398

Import loops in account imports, nats-server DoS

High Go
Severity
7.5 / 10
High · CVSS 3.1
Exploit chance (EPSS)
—
No score published
Known exploited
No
Not in CISA's catalog
Weakness
CWE-400 Uncontrolled Resource Consumption
Fix
2.2.0
Upgrade github.com/nats-io/nats-server/v2 to this version or later

Description

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

Affected versions

Go

PackageVulnerableFixed in
github.com/nats-io/nats-server
all versions
No fix yet
github.com/nats-io/nats-server/v2
< 2.2.0
2.2.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

github.com/nats-io/nats-server/v2 Go → 2.2.0

go
go get github.com/nats-io/nats-server/v2@v2.2.0 && go mod tidy

Severity breakdown

CVSS 3.1 7.5

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

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Weakness

CWE-400: Uncontrolled Resource Consumption

The product does not properly control the allocation and maintenance of a limited resource.

How to prevent it
  • Architecture and Design: Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
  • Architecture and Design: Mitigation of resource exhaustion attacks requires that the target system either: recognizes the attack and denies that user further access for a given amount of time, or uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed. The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question. The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
  • Architecture and Design: Ensure that protocols have specific limits of scale placed on them.
  • Implementation: Ensure that all failures in resource allocation place the system into a safe posture.

References

Timeline

  1. Published
  2. Last updated by the source
AdvisorySeverityWhy it's related
GHSA-pq2q-rcw4-3hr6
NATS: Pre-auth remote server crash via WebSocket frame length overflow in wsRead
High Also affects github.com/nats-io/nats-server
GHSA-3f24-pcvm-5jqc
NATS has mTLS verify_and_map authentication bypass via incorrect Subject DN matching
Medium Also affects github.com/nats-io/nats-server
GHSA-55h8-8g96-x4hj
NATS: Leafnode connections allow spoofing of Nats-Request-Info identity headers
Medium Also affects github.com/nats-io/nats-server
GHSA-pwx7-fx9r-hr4h
NATS Server: Incomplete Stripping of Nats-Request-Info Header Allows Identity Spoofing
Medium Also affects github.com/nats-io/nats-server
GHSA-9983-vrx2-fg9c
NATS JetStream has an authorization bypass through its Management API
Medium Also affects github.com/nats-io/nats-server
GHSA-8r68-gvr4-jh7j
NATS is vulnerable to pre-auth DoS through WebSockets client service
Medium Also affects github.com/nats-io/nats-server
GHSA-vprv-35vv-q339
NATS has pre-auth server panic via leafnode handling
High Also affects github.com/nats-io/nats-server
GHSA-jxxm-27vp-c3m5
NATS allows MQTT clients to bypass ACL checks
Medium Also affects github.com/nats-io/nats-server
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor