Vulnerabilities in pkg:golang/github.com/dgrijalva/jwt-go/v4

PACKAGE
Advisory Identifier: GHSA-w73w-5m7g-f7qc
Advisory Summary

CVE-2020-26160 is a HIGH (CVSS 7.5) authorization bypass vulnerability (CWE-755: Improper Handling of Exceptional Conditions) affecting Github.com/dgrijalva/jwt go libraries in the Go ecosystem. The issue involves authorization bypass in github.com/dgrijalva/jwt-go. Remediation is available by upgrading affected packages to version 4.0.0-preview1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/dgrijalva/jwt-go/v4

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-w73w-5m7g-f7qc CVE-2020-26160 HIGH Authorization bypass in github.com/dgrijalva/jwt-go

CVE-2020-26160 at a Glance

CVE Identifier CVE-2020-26160
GHSA Identifier GHSA-w73w-5m7g-f7qc
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-755: Improper Handling of Exceptional Conditions
Affected Product Github.com/dgrijalva/jwt go
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:H/I:N/A:N).

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 High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2020-26160

To remediate this vulnerability, upgrade all affected Github.com/dgrijalva/jwt go 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/dgrijalva/jwt-go fixed: Latest secure release
Upgrade github.com/dgrijalva/jwt-go to Latest secure release
github.com/dgrijalva/jwt-go/v4 fixed: 4.0.0-preview1
Upgrade github.com/dgrijalva/jwt-go/v4 to 4.0.0-preview1
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/dgrijalva/jwt-go

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-26160, inspect your project dependencies for Github.com/dgrijalva/jwt go:

inspect dependencies for github.com/dgrijalva/jwt-go

Analyze the terminal output to locate any version of Github.com/dgrijalva/jwt go in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.0-preview1), 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-755: Improper Handling of Exceptional Conditions, where the product does not handle or incorrectly handles an exceptional condition. In Github.com/dgrijalva/jwt go, 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

jwt-go allows attackers to bypass intended access restrictions in situations with `[]string{}` for `m["aud"]` (which is allowed by the specification). Because the type assertion fails, "" is the value of aud. This is a security problem if the JWT token is presented to a service that lacks its own audience check. There is no patch available and users of jwt-go are advised to migrate to [golang-jwt](https://github.com/golang-jwt/jwt) at version 3.2.1

CVE-2020-26160 Affected Github.com/dgrijalva/jwt go Versions

2 component(s)
Fixed Versions:
4.0.0-preview1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/dgrijalva/jwt-go
Go
≥ 0.0.0-20150717181359-44718f8a89b0
≤ 3.2.0
github.com/dgrijalva/jwt-go/v4
Go
< 4.0.0-preview1
4.0.0-preview1

References

Frequently Asked Questions

What is CVE-2020-26160?
CVE-2020-26160 is a security vulnerability in Github.com/dgrijalva/jwt go involving Authorization bypass in github.com/dgrijalva/jwt-go under CWE-755: Improper Handling of Exceptional Conditions.
Which Github.com/dgrijalva/jwt go versions are affected?
Affected versions include releases prior to 4.0.0-preview1 across affected packages: github.com/dgrijalva/jwt-go, github.com/dgrijalva/jwt-go/v4.
What version fixes CVE-2020-26160?
Upgrading to 4.0.0-preview1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/dgrijalva/jwt-go affected?
Yes, github.com/dgrijalva/jwt-go is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
Is github.com/dgrijalva/jwt-go/v4 affected?
Yes, github.com/dgrijalva/jwt-go/v4 is affected in releases prior to 4.0.0-preview1. Upgrade your dependency to 4.0.0-preview1 or later.
What is the CVSS score of CVE-2020-26160?
CVE-2020-26160 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:H/I:N/A:N.
What CWE is associated with CVE-2020-26160?
CVE-2020-26160 is classified under CWE-755: Improper Handling of Exceptional Conditions (The product does not handle or incorrectly handles an exceptional condition.).
How can I check Go dependencies for CVE-2020-26160?
Run the dependency tree command: 'inspect dependencies for github.com/dgrijalva/jwt-go'. 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-w73w-5m7g-f7qc",
  "modified" : "2024-05-20T19:26:26Z",
  "published" : "2021-05-18T21:08:21Z",
  "aliases" : [ "CVE-2020-26160" ],
  "summary" : "Authorization bypass in github.com/dgrijalva/jwt-go",
  "details" : "jwt-go allows attackers to bypass intended access restrictions in situations with `[]string{}` for `m[\"aud\"]` (which is allowed by the specification). Because the type assertion fails, \"\" is the value of aud. This is a security problem if the JWT token is presented to a service that lacks its own audience check. There is no patch available and users of jwt-go are advised to migrate to [golang-jwt](https://github.com/golang-jwt/jwt) at version 3.2.1",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/dgrijalva/jwt-go"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.0.0-20150717181359-44718f8a89b0"
      }, {
        "last_affected" : "3.2.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/dgrijalva/jwt-go/v4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.0-preview1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-26160"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgrijalva/jwt-go/issues/422"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgrijalva/jwt-go/issues/462"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgrijalva/jwt-go/pull/426"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/dgrijalva/jwt-go/commit/ec0a89a131e3e8567adcb21254a5cd20a70ea4ab"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/dgrijalva/jwt-go"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2020-0017"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMDGRIJALVAJWTGO-596515"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287", "CWE-755" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-18T20:54:59Z",
    "nvd_published_at" : "2020-09-30T18:15:00Z"
  }
}