Skip to content

Nil dereference in NATS JWT, DoS of nats-server

High severity GitHub Reviewed Published Mar 24, 2021 in nats-io/jwt • Updated Feb 17, 2023

Package

gomod github.com/nats-io/jwt (Go)

Affected versions

< 1.1.0

Patched versions

1.1.0
gomod github.com/nats-io/nats-server/v2 (Go)
< 2.1.9
2.1.9

Description

Problem Description

The NATS account system has an Operator trusted by the servers, which signs Accounts, and each Account can then create and sign Users within their account. The Operator should be able to safely issue Accounts to other entities which it does not fully trust.

A malicious Account could create and sign a User JWT with a state not created by the normal tooling, such that decoding by the NATS JWT library (written in Go) would attempt a nil dereference, aborting execution.

The NATS Server is known to be impacted by this.

Affected versions

JWT library

  • all versions prior to 1.1.0

NATS Server

  • Version 2 prior to 2.1.9

Impact

JWT library

  • Programs would nil dereference and panic, aborting execution by default.

NATS server

  • Denial of Service caused by process termination

Workaround

If your NATS servers do not trust any accounts which are managed by untrusted entities, then malformed User credentials are unlikely to be encountered.

Solution

Upgrade the JWT dependency in any application using it.

Upgrade the NATS server if using NATS Accounts.

References

Published by the National Vulnerability Database Nov 6, 2020
@philpennock philpennock published to nats-io/jwt Mar 24, 2021
Reviewed May 21, 2021
Published to the GitHub Advisory Database Feb 11, 2022
Last updated Feb 17, 2023

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

EPSS score

0.153%
(52nd percentile)

Weaknesses

CVE ID

CVE-2020-26521

GHSA ID

GHSA-h2fg-54x9-5qhq

Source code

No known source code
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.