Vulnerabilities in pkg:golang/github.com/nats-io/nats-streaming-server

PACKAGE
Advisory Identifier: GHSA-2h2x-8hh2-mfq8
Advisory Summary

CVE-2022-29946 is a HIGH (CVSS 6.5) remote code execution vulnerability (CWE-863: Incorrect Authorization) affecting Github.com/nats io/nats server/v2 libraries in the Go ecosystem. The issue involves nats server and streaming server fails to enforce negative user permissions, may allow denied subjects. Remediation is available by upgrading affected packages to version 2.8.2, 0.24.6.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/nats-io/nats-streaming-server

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/nats-io/nats-streaming-server. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-2h2x-8hh2-mfq8 CVE-2022-29946 HIGH NATS Server and Streaming Server fails to enforce negative user permissions, may allow denied subjects
GHSA-g6w6-r76c-28j7 CVE-2022-24450 HIGH Incorrect Authorization in NATS nats-server
GHSA-6h3m-36w8-hv68 CVE-2022-26652 HIGH Arbitrary file write in nats-server

CVE-2022-29946 at a Glance

CVE Identifier CVE-2022-29946
GHSA Identifier GHSA-2h2x-8hh2-mfq8
Severity HIGH
CVSS v3.1 Base Score 6.5
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: 6.5

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:N/I:H/A:N).

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

How to Fix CVE-2022-29946

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.8.2
Upgrade github.com/nats-io/nats-server/v2 to 2.8.2
github.com/nats-io/nats-streaming-server fixed: 0.24.6
Upgrade github.com/nats-io/nats-streaming-server to 0.24.6
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-29946, 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.8.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

NATS.io NATS Server before 2.8.2 and Streaming Server before 0.24.6 could allow a remote attacker to bypass security restrictions, caused by the failure to enforce negative user permissions in one scenario. By using a queue subscription on the wildcard, an attacker could exploit this vulnerability to allow denied subjects.

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

2 component(s)
Fixed Versions:
2.8.20.24.6
Product / Package Ecosystem Affected Versions Fixed Version
github.com/nats-io/nats-server/v2
Go
< 2.8.2
2.8.2
github.com/nats-io/nats-streaming-server
Go
< 0.24.6
0.24.6

References

Frequently Asked Questions

What is CVE-2022-29946?
CVE-2022-29946 is a security vulnerability in Github.com/nats io/nats server/v2 involving NATS Server and Streaming Server fails to enforce negative user permissions, may allow denied subjects under CWE-863: Incorrect Authorization.
Which Github.com/nats io/nats server/v2 versions are affected?
Affected versions include releases prior to 2.8.2, 0.24.6 across affected packages: github.com/nats-io/nats-server/v2, github.com/nats-io/nats-streaming-server.
What version fixes CVE-2022-29946?
Upgrading to 2.8.2, 0.24.6 (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.8.2. Upgrade your dependency to 2.8.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.6. Upgrade your dependency to 0.24.6 or later.
What is the CVSS score of CVE-2022-29946?
CVE-2022-29946 has a CVSS v3.1 base score of 6.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2022-29946?
CVE-2022-29946 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-29946?
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-2h2x-8hh2-mfq8",
  "modified" : "2024-10-30T18:50:03Z",
  "published" : "2024-07-11T21:31:12Z",
  "aliases" : [ "CVE-2022-29946" ],
  "summary" : "NATS Server and Streaming Server fails to enforce negative user permissions, may allow denied subjects",
  "details" : "NATS.io NATS Server before 2.8.2 and Streaming Server before 0.24.6 could allow a remote attacker to bypass security restrictions, caused by the failure to enforce negative user permissions in one scenario. By using a queue subscription on the wildcard, an attacker could exploit this vulnerability to allow denied subjects.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-server/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-streaming-server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.24.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-29946"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-2h2x-8hh2-mfq8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/advisories/blob/main/CVE/CVE-2022-29946.txt"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-863" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-12T14:01:30Z",
    "nvd_published_at" : "2024-07-11T21:15:10Z"
  }
}