Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-58254

CVE-2026-58254: NATS Server Privilege Escalation Flaw

CVE-2026-58254 is a privilege escalation vulnerability in NATS Server that allows leafnode operators to bypass trace destination checks and send unauthorized trace events. This article covers technical details, affected versions, and fixes.

Published:

CVE-2026-58254 Overview

CVE-2026-58254 is an authorization bypass vulnerability [CWE-863] in NATS Server, a high-performance messaging system used in cloud and edge native architectures. The flaw exists in message trace destination checks, which are enforced on ordinary client connections but not consistently on messages arriving through leafnode connections. A leafnode operator can send trace events to subjects that would otherwise be restricted and use trace-only behavior to suppress normal message delivery or storage. The issue is fixed in NATS Server versions 2.14.3 and 2.12.8.

Critical Impact

A leafnode operator can bypass publish permission checks on Nats-Trace-Dest messages, exfiltrating trace data to unauthorized subjects and interfering with legitimate message delivery.

Affected Products

  • NATS Server versions prior to 2.12.8 (2.12.x branch)
  • NATS Server versions prior to 2.14.3 (2.14.x branch)
  • Deployments using leafnode connections for hub-and-spoke or edge topologies

Discovery Timeline

  • 2026-07-08 - CVE-2026-58254 published to NVD
  • 2026-07-08 - Last updated in NVD database

Technical Details for CVE-2026-58254

Vulnerability Analysis

NATS Server supports message tracing through the Nats-Trace-Dest header, which directs trace events to a specified subject. For standard client connections, the server validates that the publisher has permission to publish to the trace destination subject. This check enforces the account's configured publish allow and deny lists.

The defect resides in the authorization path within server/msgtrace.go. When a message arrives over a leafnode connection, the code branch that evaluates client publish permissions is not applied. As a result, trace destinations are accepted without validating whether the leafnode is authorized to publish to that subject. In addition, trace-only messages can be flagged so that the original message is not delivered or persisted, giving the operator a mechanism to suppress traffic.

Root Cause

The root cause is inconsistent enforcement of publish permission checks across connection kinds. The pre-patch logic evaluated c.perms.pub.allow and c.perms.pub.deny without differentiating leafnode connections, which use a separate permission model based on spoke and hub directionality. Leafnode messages therefore fell through to the allowed = true default.

Attack Vector

An authenticated leafnode operator crafts a published message that includes a Nats-Trace-Dest header pointing to a subject the operator would not normally be permitted to publish to. The NATS Server accepts the trace destination and emits trace events to that subject. When combined with trace-only semantics, the operator can also prevent the original message from being delivered to subscribers or stored in JetStream.

go
// Patch: server/msgtrace.go
// Source: https://github.com/nats-io/nats-server/commit/cbe845932980b71563efac5cfa4cc751c88936cd
allowed := true
c.mu.Lock()
if c.kind == LEAF {
    if c.isSpokeLeafNode() {
        allowed = c.leafReceiveAllowed(td)
    } else {
        allowed = c.leafSendAllowed(td)
    }
} else if c.perms != nil && (c.perms.pub.allow != nil || c.perms.pub.deny != nil) && !c.pubAllowedFullCheck(dest, false, true) {
    allowed = false
}
c.mu.Unlock()

The patch adds a dedicated branch for LEAF connections that invokes leafReceiveAllowed for spoke leaf nodes and leafSendAllowed for hub leaf nodes, aligning trace destination validation with the leafnode permission model.

Detection Methods for CVE-2026-58254

Indicators of Compromise

  • Trace events arriving on subjects that are not part of the documented tracing topology or accounts.
  • Leafnode-originated messages containing the Nats-Trace-Dest header pointing to unexpected subjects.
  • Gaps in JetStream storage or subscriber delivery correlated with trace-only messages from leafnode peers.

Detection Strategies

  • Enable NATS Server debug and trace logging and search for Nats-Trace-Dest header usage originating from leafnode connections.
  • Correlate leafnode connection identifiers with subjects that receive trace events and flag deviations from expected trace destinations.
  • Review account-level publish permission audits against observed trace subject activity to identify mismatches.

Monitoring Recommendations

  • Ingest NATS Server logs into a central analytics platform and alert on Nats-Trace-Dest values that fall outside allow-listed subjects.
  • Monitor JetStream stream ingestion counters for unexplained drops that align with leafnode publish activity.
  • Track NATS Server version inventory across clusters to confirm all nodes are running 2.12.8, 2.14.3, or later.

How to Mitigate CVE-2026-58254

Immediate Actions Required

  • Upgrade NATS Server to version 2.12.8 on the 2.12.x branch or 2.14.3 on the 2.14.x branch.
  • Audit leafnode credentials and remove any leafnode operators that are not strictly required.
  • Review account import and export configurations to confirm that trace subjects are scoped to trusted accounts only.

Patch Information

The fix is delivered in commit cbe845932980b71563efac5cfa4cc751c88936cd and included in NATS Server v2.12.8 and NATS Server v2.14.3. Technical details are documented in GHSA-p3j5-5hrq-p75h.

Workarounds

  • Disable message tracing on clusters that accept leafnode connections until upgrades are complete.
  • Restrict leafnode connections to trusted operators using mutual TLS and dedicated accounts with minimal subject scope.
  • Segment leafnode traffic at the network layer so that untrusted edge deployments cannot reach production hubs.
bash
# Verify NATS Server version after upgrade
nats-server --version

# Example leafnode account restriction in server config
accounts: {
  EDGE: {
    users: [ { user: "edge", password: "$2a$..." } ]
    exports: []
    imports: []
  }
}
leafnodes {
  remotes: [
    { url: "tls://hub.example.com:7422", account: "EDGE" }
  ]
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.