CVE-2026-58213: NATS Server MQTT SUBSCRIBE Protocol Injection Vulnerability

HIGH
Advisory Identifier: GHSA-qrcv-3558-gj4f
CVSS 7.1
CWE-74
Published
Advisory Summary

CVE-2026-58213 is a HIGH (CVSS 7.1) mqtt subscribe protocol injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting NATS Server libraries in the Go ecosystem. The issue involves mqtt subscribe protocol injection via leaf node/route forwarding allows arbitrary nats command injection. Remediation is available by upgrading affected packages to version 2.12.9, 2.14.1.

CVE-2026-58213 at a Glance

CVE Identifier CVE-2026-58213
GHSA Identifier GHSA-qrcv-3558-gj4f
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product NATS Server
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.1

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

How to Fix CVE-2026-58213

To remediate this vulnerability, upgrade all affected NATS Server 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.12.9
Upgrade github.com/nats-io/nats-server/v2 to 2.12.9
github.com/nats-io/nats-server/v2 fixed: 2.14.1
Upgrade github.com/nats-io/nats-server/v2 to 2.14.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-2026-58213, inspect your project dependencies for NATS Server:

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

Analyze the terminal output to locate any version of NATS Server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.12.9), 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-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In NATS Server, 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

### Background NATS.io is a high performance open source pub-sub distributed communication technology, built for the cloud, on-premise, IoT and edge computing. The NATS Server supports MQTT clients and can bridge MQTT activity into NATS subjects across routes and leafnode connections. ### Problem Description An MQTT client could include protocol control characters in subscription filters that were later forwarded as NATS protocol data to route or leafnode connections. This could corrupt the forwarded protocol stream and allow injection of unintended NATS protocol operations, potentially across cluster nodes or accounts where route or gateway connections are present. Anonymous MQTT deployments are higher risk because no credentials are required to reach the affected parser. Authenticated deployments are still affected for clients allowed to create MQTT subscriptions. ### Affected Versions Versions v2.14.0, v2.12.8 and below are vulnerable. The issue is fixed in v2.14.1 and v2.12.9. ### Workarounds Disable anonymous MQTT access where it is not required. Deployments that need MQTT have no known complete workaround other than upgrading. ### References * GHSA advisory: <https://github.com/nats-io/nats-server/security/advisories/GHSA-qrcv-3558-gj4f> * Credit: @thesecguy45

CVE-2026-58213 Affected NATS Server Versions

2 component(s)
Fixed Versions:
2.12.92.14.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/nats-io/nats-server/v2
Go
< 2.12.9
2.12.9
github.com/nats-io/nats-server/v2
Go
≥ 2.14.0-RC.1
< 2.14.1
2.14.1

References

Frequently Asked Questions

What is CVE-2026-58213?
CVE-2026-58213 is a security vulnerability in NATS Server involving MQTT SUBSCRIBE Protocol Injection via Leaf Node/Route Forwarding allows arbitrary NATS command injection under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which NATS Server versions are affected?
Affected versions include releases prior to 2.12.9, 2.14.1 across affected packages: github.com/nats-io/nats-server/v2.
What version fixes CVE-2026-58213?
Upgrading to 2.12.9, 2.14.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.12.9, 2.14.1. Upgrade your dependency to 2.12.9, 2.14.1 or later.
What is the CVSS score of CVE-2026-58213?
CVE-2026-58213 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N.
What CWE is associated with CVE-2026-58213?
CVE-2026-58213 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2026-58213?
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-qrcv-3558-gj4f",
  "modified" : "2026-11-19T15:56:55Z",
  "published" : "2026-11-19T15:56:55Z",
  "aliases" : [ "CVE-2026-58213" ],
  "summary" : "NATS Server: MQTT SUBSCRIBE Protocol Injection via Leaf Node/Route Forwarding allows arbitrary NATS command injection",
  "details" : "### Background\n\nNATS.io is a high performance open source pub-sub distributed communication technology, built for the cloud, on-premise, IoT and edge computing.\n\nThe NATS Server supports MQTT clients and can bridge MQTT activity into NATS subjects across routes and leafnode connections.\n\n### Problem Description\n\nAn MQTT client could include protocol control characters in subscription filters that were later forwarded as NATS protocol data to route or leafnode connections.\n\nThis could corrupt the forwarded protocol stream and allow injection of unintended NATS protocol operations, potentially across cluster nodes or accounts where route or gateway connections are present.\n\nAnonymous MQTT deployments are higher risk because no credentials are required to reach the affected parser. Authenticated deployments are still affected for clients allowed to create MQTT subscriptions.\n\n### Affected Versions\n\nVersions v2.14.0, v2.12.8 and below are vulnerable. The issue is fixed in v2.14.1 and v2.12.9.\n\n### Workarounds\n\nDisable anonymous MQTT access where it is not required. Deployments that need MQTT have no known complete workaround other than upgrading.\n\n### References\n\n * GHSA advisory: <https://github.com/nats-io/nats-server/security/advisories/GHSA-qrcv-3558-gj4f>\n * Credit: @thesecguy45",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-server/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.12.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/nats-server/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.14.0-RC.1"
      }, {
        "fixed" : "2.14.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/security/advisories/GHSA-qrcv-3558-gj4f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-58213"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/pull/8163"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/pull/8164"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/commit/366837cfc65ab9ccb4f98193c65e8daf238582d8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/commit/64ebae40051ee497c481e10f316238faf0de1736"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/commit/f14856b9e57a36818f43851cb69b6e33670885c9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nats-io/nats-server"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/releases/tag/v2.12.9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/releases/tag/v2.14.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-19T15:56:55Z",
    "nvd_published_at" : "2026-07-08T20:16:54Z"
  }
}