Cloudanix VulnDB

CVE-2022-26652

Medium · 6.5

CVSS

6.5

EPSS

2.3%

Published

Mar 10, 2022

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

A flaw in the NATS messaging server could let authorized users write files anywhere on the system by sending specially crafted data packages.

Exploitation
Remote Authenticated
Attacker needs
Low Privilege
Complexity
Low
Impact
Data Tampering
Component
Network Service
Class
Path Traversal
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Allows an authenticated user with write access to JetStream streams to perform directory traversal by including malicious elements in a ZIP archive, potentially writing files outside the intended directory.

Why it matters to the business

Attackers could overwrite critical configuration or data files on the server, leading to service disruption, data corruption, or unauthorized access to sensitive information.

How an attack unfolds

An attacker with valid credentials and JetStream write permissions crafts a ZIP archive containing path traversal sequences like ../ in file names, uploads it via the JetStream API, causing the server to extract files to unintended locations on the filesystem.

How to fix it

Upgrade nats-server to the version containing commit a86b84a9f35168973d910f462b8d03f77699b34f or later. For nats-streaming-server, upgrade to 0.24.3 or later.

How to confirm the fix worked

Verify the server version is at least the fixed commit. Monitor JetStream stream operations for unexpected file writes.

Typical attack path

  1. Obtain valid NATS credentials with JetStream permissions
  2. Create a malicious ZIP archive with directory traversal payloads
  3. Upload the archive to a JetStream stream
  4. Trigger extraction to write files to arbitrary paths
  5. Achieve persistence or disrupt operations

How to detect it

Examine NATS server logs for JetStream stream creation or message uploads containing ZIP archives. Look for unexpected file modifications in directories outside the data store.

What your security team should do

  • Immediately upgrade affected NATS servers to the fixed version
  • Review and restrict JetStream permissions to least privilege
  • Implement file integrity monitoring on the server filesystem
  • Audit logs for suspicious stream uploads

The record

NATS nats-server before 2.7.4 allows Directory Traversal (with write access) via an element in a ZIP archive for JetStream streams. nats-streaming-server before 0.24.3 is also affected.

Affected packages

Ecosystem Package Introduced Fixed
Go github.com/nats-io/nats-server 0 No fix
Go github.com/nats-io/nats-server/v2 2.2.0 2.7.4
Go github.com/nats-io/nats-streaming-server 0.15.0 0.24.3
Bitnami nats 2.2.0 2.7.4
go github.com/nats-io/nats-server/v2 v2.2.0 v2.7.4
go github.com/nats-io/nats-streaming-server v0.15.0 v0.24.3

Related vulnerabilities