CVE-2020-26521: Panic in NATS JWT decoding in github.com/nats-io/jwt
Summary
CVE-2020-26521: Panic in NATS JWT decoding in github.com/nats-io/jwt. Affects github.com/nats-io/jwt versions < 1.1.0. Fixed in 1.1.0. How to fix ↓
Also tracked for
- github.com/nats-io/nats-server/v2 · Go
- golang-github-nats-io-jwt · Debian:12
The same CVE-2020-26521 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The github.com/nats-io/jwt package is a Go library that provides functionality for decoding and validating JSON Web Tokens (JWTs) used in the NATS messaging system. It is commonly used to authenticate and authorize users within NATS applications. The package includes various functions for validating different types of JWT claims and exports.
Vulnerability Detail
A vulnerability has been discovered in the NATS JWT library that allows a malicious account to create and sign a User JWT that triggers a panic when decoded. This panic can lead to a denial of service (DoS) condition in applications using the vulnerable library. The vulnerability is identified as CVE-2020-26521 and has aliases GHSA-h2fg-54x9-5qhq and GHSA-hmm9-r2m2-qg9w.
How To Fix
Latest published version: v1.2.2 as of 23 Oct 2026
go get github.com/nats-io/jwt@v1.2.2
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.1.0
This is the first release that contains the fix.
go get github.com/nats-io/jwt@v1.1.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. It is recommended to update to the fixed version of the package as soon as possible.
Conclusion
The NATS JWT library in github.com/nats-io/jwt is vulnerable to a panic issue when decoding maliciously crafted User JWTs. This vulnerability can lead to a denial of service (DoS) condition in applications using the library. Developers should update to version 1.1.0 or later of the package to fix this issue. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for github.com/nats-io/jwt →
FAQ
The vulnerability can lead to a denial of service (DoS) condition in applications using the vulnerable NATS JWT library.
You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your Gopkg.lock file and the playground will provide real-time alerts for open-source vulnerabilities.
There are no known exploits for this vulnerability at the moment. However, it is important to update to the fixed version of the package to prevent any potential attacks.
No, there is no known workaround for this vulnerability. It is crucial to update to the fixed version of the package to ensure the security of your application.
You can find more information about this vulnerability, including the technical details and affected versions, in the vulnerability report at https://pkg.go.dev/vuln/GO-2022-0402.
References
Related vulnerabilities
Recent vulnerabilities recorded for github.com/nats-io/jwt.