CVE-2022-24450: Github.com/nats io/nats server/v2 Incorrect Authorization Vulnerability

HIGH
Advisory Identifier: GHSA-g6w6-r76c-28j7
CVSS 8.8
CWE-863
Published
Advisory Summary

CVE-2022-24450 is a HIGH (CVSS 8.8) incorrect authorization vulnerability (CWE-863: Incorrect Authorization) affecting Github.com/nats io/nats server/v2 libraries in the Go ecosystem. The issue involves incorrect authorization in nats nats-server. Remediation is available by upgrading affected packages to version 2.7.2, 0.24.1.

CVE-2022-24450 at a Glance

CVE Identifier CVE-2022-24450
GHSA Identifier GHSA-g6w6-r76c-28j7
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-863: Incorrect Authorization
Affected Product Github.com/nats io/nats server/v2
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2022-24450

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.7.2
Upgrade github.com/nats-io/nats-server/v2 to 2.7.2
github.com/nats-io/nats-streaming-server fixed: 0.24.1
Upgrade github.com/nats-io/nats-streaming-server to 0.24.1
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 CVE-2022-24450, 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.7.2), 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-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. 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-2022-24450.txt>) ## Problem Description NATS nats-server through 2022-02-04 has Incorrect Access Control, with unchecked ability for clients to authorize into any account, because of a coding error in a long-extant experimental feature. A client crafting the initial protocol-level handshake could, with valid credentials for any account, specify a target account and switch into it immediately. This includes any other tenant, and includes the System account which controls nats-server core operations. For deployments not using multi-tenancy through NATS Accounts, there is still a vulnerability: normal users are able to choose to be in the System account. An experimental feature to provide dynamically provisioned sandbox accounts was designed to allow a server administrator to turn on an option to allow clients to dynamically request a brand new account inline at connection time. This feature went nowhere, but lived on in the code and was used by a number of tests; support was never added to any client libraries or to the documentation. A bug in handling the feature meant that if someone did in fact have valid account credentials, then they could specify any other existing account and they would be assigned into that account. Release 2.7.2 of nats-server removes the feature. Because of the lack of client support and absence from protocol documentation, we feel this is safe operationally as well as the safest fix for the code. ## Affected versions #### NATS Server * All 2.x versions up to and including 2.7.1. * Fixed with nats-io/nats-server: 2.7.2 * NATS Server 1.x did not have accounts. * Docker image: nats <https://hub.docker.com/_/nats> #### NATS Streaming Server * All versions embedding affected NATS Server: + Affected: v0.15.0 up to and including v0.24.0 + Fixed with nats-io/nats-streaming-server: 0.24.1 * Docker image: nats-streaming <https://hub.docker.com/_/nats-streaming> ## Impact Existing users could act in any account, including the System account. ## Workaround None. ## Solution Upgrade the NATS server.

CVE-2022-24450 Affected Github.com/nats io/nats server/v2 Versions

2 component(s)
Fixed Versions:
2.7.20.24.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/nats-io/nats-server/v2
Go
≥ 2.0.0
< 2.7.2
2.7.2
github.com/nats-io/nats-streaming-server
Go
≥ 0.15.0
< 0.24.1
0.24.1

References

Frequently Asked Questions

What is CVE-2022-24450?
CVE-2022-24450 is a security vulnerability in Github.com/nats io/nats server/v2 involving Incorrect Authorization in NATS nats-server under CWE-863: Incorrect Authorization.
Which Github.com/nats io/nats server/v2 versions are affected?
Affected versions include releases prior to 2.7.2, 0.24.1 across affected packages: github.com/nats-io/nats-server/v2, github.com/nats-io/nats-streaming-server.
What version fixes CVE-2022-24450?
Upgrading to 2.7.2, 0.24.1 (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.7.2. Upgrade your dependency to 2.7.2 or later.
Is github.com/nats-io/nats-streaming-server affected?
Yes, github.com/nats-io/nats-streaming-server is affected in releases prior to 0.24.1. Upgrade your dependency to 0.24.1 or later.
What is the CVSS score of CVE-2022-24450?
CVE-2022-24450 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2022-24450?
CVE-2022-24450 is classified under CWE-863: Incorrect Authorization (The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.).
How can I check Go dependencies for CVE-2022-24450?
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-g6w6-r76c-28j7",
  "modified" : "2023-08-08T20:44:45Z",
  "published" : "2022-02-08T17:23:16Z",
  "aliases" : [ "CVE-2022-24450" ],
  "summary" : "Incorrect Authorization in NATS nats-server",
  "details" : "(This advisory is canonically <https://advisories.nats.io/CVE/CVE-2022-24450.txt>)\n\n## Problem Description\n\nNATS nats-server through 2022-02-04 has Incorrect Access Control, with unchecked ability for clients to authorize into any account, because of a coding error in a long-extant experimental feature.\n\nA client crafting the initial protocol-level handshake could, with valid credentials for any account, specify a target account and switch into it immediately.  This includes any other tenant, and includes the System account which controls nats-server core operations.\n\nFor deployments not using multi-tenancy through NATS Accounts, there is still a vulnerability: normal users are able to choose to be in the System account.\n\nAn experimental feature to provide dynamically provisioned sandbox accounts was designed to allow a server administrator to turn on an option to allow clients to dynamically request a brand new account inline at connection time.  This feature went nowhere, but lived on in the code and was used by a number of tests; support was never added to any client libraries or to the documentation.\n\nA bug in handling the feature meant that if someone did in fact have valid account credentials, then they could specify any other existing account and they would be assigned into that account.\n\nRelease 2.7.2 of nats-server removes the feature.\nBecause of the lack of client support and absence from protocol documentation, we feel this is safe operationally as well as the safest fix for the code.\n\n\n## Affected versions\n\n#### NATS Server\n * All 2.x versions up to and including 2.7.1.\n * Fixed with nats-io/nats-server: 2.7.2\n * NATS Server 1.x did not have accounts.\n * Docker image:  nats <https://hub.docker.com/_/nats>\n\n#### NATS Streaming Server\n * All versions embedding affected NATS Server:\n   + Affected: v0.15.0 up to and including v0.24.0\n   + Fixed with nats-io/nats-streaming-server: 0.24.1\n * Docker image:  nats-streaming <https://hub.docker.com/_/nats-streaming>\n\n\n## Impact\n\nExisting users could act in any account, including the System account.\n\n## Workaround\n\nNone.\n\n## Solution\n\nUpgrade the NATS server.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-server/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.7.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-streaming-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.15.0"
      }, {
        "fixed" : "0.24.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/security/advisories/GHSA-g6w6-r76c-28j7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24450"
  }, {
    "type" : "WEB",
    "url" : "https://advisories.nats.io/CVE/CVE-2022-24450.txt"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nats-io/nats-server"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/releases/tag/v2.7.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-863" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-02-08T17:23:16Z",
    "nvd_published_at" : "2022-02-08T02:15:00Z"
  }
}