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

PACKAGE
Advisory Identifier: GHSA-h2fg-54x9-5qhq
Advisory Summary

CVE-2020-26521 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-476: NULL Pointer Dereference) affecting Github.com/nats io/jwt libraries in the Go ecosystem. The issue involves nil dereference in nats jwt, dos of nats-server. Remediation is available by upgrading affected packages to version 1.1.0.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/nats-io/jwt

4 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-h2fg-54x9-5qhq CVE-2020-26521 HIGH Nil dereference in NATS JWT, DoS of nats-server
GHSA-4w5x-x539-ppf5 CVE-2020-26892 CRITICAL Incorrect handling of credential expiry by /nats-io/nats-server
GHSA-62mh-w5cv-p88c CVE-2021-3127 CRITICAL nats-io/jwt not enforcing checking of Import token permissions
GHSA-9r5x-fjv3-q6h4 - HIGH Duplicate Advisory: Incorrect Access Control in github.com/nats-io/jwt and github.com/nats-io/nats-server/v2

CVE-2020-26521 at a Glance

CVE Identifier CVE-2020-26521
GHSA Identifier GHSA-h2fg-54x9-5qhq
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-476: NULL Pointer Dereference
Affected Product Github.com/nats io/jwt
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2020-26521

To remediate this vulnerability, upgrade all affected Github.com/nats io/jwt 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/jwt fixed: 1.1.0
Upgrade github.com/nats-io/jwt to 1.1.0
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/jwt

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-26521, inspect your project dependencies for Github.com/nats io/jwt:

inspect dependencies for github.com/nats-io/jwt

Analyze the terminal output to locate any version of Github.com/nats io/jwt in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.0), 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-476: NULL Pointer Dereference, where the product dereferences a pointer that it expects to be valid but is null. In Github.com/nats io/jwt, 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

## 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.

CVE-2020-26521 Affected Github.com/nats io/jwt Versions

1 component(s)
Fixed Versions:
1.1.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/nats-io/jwt
Go
< 1.1.0
1.1.0

References

Frequently Asked Questions

What is CVE-2020-26521?
CVE-2020-26521 is a security vulnerability in Github.com/nats io/jwt involving Nil dereference in NATS JWT, DoS of nats-server under CWE-476: NULL Pointer Dereference.
Which Github.com/nats io/jwt versions are affected?
Affected versions include releases prior to 1.1.0 across affected packages: github.com/nats-io/jwt.
What version fixes CVE-2020-26521?
Upgrading to 1.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/nats-io/jwt affected?
Yes, github.com/nats-io/jwt is affected in releases prior to 1.1.0. Upgrade your dependency to 1.1.0 or later.
What is the CVSS score of CVE-2020-26521?
CVE-2020-26521 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2020-26521?
CVE-2020-26521 is classified under CWE-476: NULL Pointer Dereference (The product dereferences a pointer that it expects to be valid but is NULL.).
How can I check Go dependencies for CVE-2020-26521?
Run the dependency tree command: 'inspect dependencies for github.com/nats-io/jwt'. 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-h2fg-54x9-5qhq",
  "modified" : "2025-10-03T19:29:57Z",
  "published" : "2022-02-11T23:43:13Z",
  "aliases" : [ "CVE-2020-26521" ],
  "summary" : "Nil dereference in NATS JWT, DoS of nats-server",
  "details" : "## Problem Description\n\nThe 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.\n\nA 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.\n\nThe NATS Server is known to be impacted by this.\n\n\n## Affected versions\n\n#### JWT library\n\n * all versions prior to 1.1.0\n\n#### NATS Server\n\n * Version 2 prior to 2.1.9\n\n\n## Impact\n\n#### JWT library\n\n * Programs would nil dereference and panic, aborting execution by default.\n\n#### NATS server\n\n * Denial of Service caused by process termination\n\n\n## Workaround\n\nIf your NATS servers do not trust any accounts which are managed by untrusted entities, then malformed User credentials are unlikely to be encountered.\n\n\n## Solution\n\nUpgrade the JWT dependency in any application using it.\n\nUpgrade the NATS server if using NATS Accounts.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/nats-io/jwt"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/jwt/security/advisories/GHSA-h2fg-54x9-5qhq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-26521"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/jwt/pull/107"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/commit/9ff8bcde2e46009e98bd9e88f598af355f62c168"
  }, {
    "type" : "WEB",
    "url" : "https://advisories.nats.io/CVE/CVE-2020-26521.txt"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nats-io/jwt"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nats-io/nats-server/commits/master"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VT67XCLIIBYRT762SVFBYFFTQFVSM3SI"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-0402"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2020/11/02/2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-476" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-21T21:32:02Z",
    "nvd_published_at" : "2020-11-06T08:15:00Z"
  }
}