GHSA-rm8v-mxj3-5rmq: Github.com/lestrrat go/jwx/v2 Github.com/lestrrat-go/jwx Vulnerable To Potential Padding Vulnerability

MODERATE
Published
Advisory Summary

GHSA-rm8v-mxj3-5rmq is a MODERATE github.com/lestrrat-go/jwx vulnerable to potential padding vulnerability (General Security Weakness) affecting Github.com/lestrrat go/jwx/v2 libraries in the Go ecosystem. The issue involves github.com/lestrrat-go/jwx vulnerable to potential padding oracle attack. Remediation is available by upgrading affected packages to version 2.0.11, 1.2.26.

GHSA-rm8v-mxj3-5rmq at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rm8v-mxj3-5rmq
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product Github.com/lestrrat go/jwx/v2
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-rm8v-mxj3-5rmq

To remediate this vulnerability, upgrade all affected Github.com/lestrrat go/jwx/v2 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/lestrrat-go/jwx/v2 fixed: 2.0.11
Upgrade github.com/lestrrat-go/jwx/v2 to 2.0.11
github.com/lestrrat-go/jwx fixed: 1.2.26
Upgrade github.com/lestrrat-go/jwx to 1.2.26
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/lestrrat-go/jwx/v2

How to Check if You Are Affected

To determine whether your application is affected by GHSA-rm8v-mxj3-5rmq, inspect your project dependencies for Github.com/lestrrat go/jwx/v2:

inspect dependencies for github.com/lestrrat-go/jwx/v2

Analyze the terminal output to locate any version of Github.com/lestrrat go/jwx/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.11), 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 General Security Weakness. In Github.com/lestrrat go/jwx/v2, 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

### Summary Decrypting AES-CBC encrypted JWE has Potential Padding Oracle Attack Vulnerability. ### Details On [v2.0.10](https://github.com/lestrrat-go/jwx/releases/tag/v2.0.10), decrypting AES-CBC encrypted JWE may return an error "failed to generate plaintext from decrypted blocks: invalid padding": https://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213 Reporting padding error causes [Padding Oracle Attack](https://en.wikipedia.org/wiki/Padding_oracle_attack) Vulnerability. RFC 7516 JSON Web Encryption (JWE) says that we **MUST NOT** do this. > 11.5. Timing Attacks > To mitigate the attacks described in RFC 3218 [RFC3218], the > recipient MUST NOT distinguish between format, padding, and length > errors of encrypted keys. It is strongly recommended, in the event > of receiving an improperly formatted key, that the recipient > substitute a randomly generated CEK and proceed to the next step, to > mitigate timing attacks. In addition, the time to remove padding depends on the length of the padding. It may leak the length of the padding by Timing Attacks. https://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66 To mitigate Timing Attacks, it MUST be done in constant time. ### Impact The authentication tag is verified, so it is not an immediate attack.

GHSA-rm8v-mxj3-5rmq Affected Github.com/lestrrat go/jwx/v2 Versions

2 component(s)
Fixed Versions:
2.0.111.2.26
Product / Package Ecosystem Affected Versions Fixed Version
github.com/lestrrat-go/jwx/v2
Go
< 2.0.11
2.0.11
github.com/lestrrat-go/jwx
Go
< 1.2.26
1.2.26

References

Frequently Asked Questions

What is GHSA-rm8v-mxj3-5rmq?
GHSA-rm8v-mxj3-5rmq is a security vulnerability in Github.com/lestrrat go/jwx/v2 involving github.com/lestrrat-go/jwx vulnerable to Potential Padding Oracle Attack under General Security Weakness.
Which Github.com/lestrrat go/jwx/v2 versions are affected?
Affected versions include releases prior to 2.0.11, 1.2.26 across affected packages: github.com/lestrrat-go/jwx/v2, github.com/lestrrat-go/jwx.
What version fixes GHSA-rm8v-mxj3-5rmq?
Upgrading to 2.0.11, 1.2.26 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/lestrrat-go/jwx/v2 affected?
Yes, github.com/lestrrat-go/jwx/v2 is affected in releases prior to 2.0.11. Upgrade your dependency to 2.0.11 or later.
Is github.com/lestrrat-go/jwx affected?
Yes, github.com/lestrrat-go/jwx is affected in releases prior to 1.2.26. Upgrade your dependency to 1.2.26 or later.
What CWE is associated with GHSA-rm8v-mxj3-5rmq?
GHSA-rm8v-mxj3-5rmq is classified under General Security Weakness.
How can I check Go dependencies for GHSA-rm8v-mxj3-5rmq?
Run the dependency tree command: 'inspect dependencies for github.com/lestrrat-go/jwx/v2'. 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-rm8v-mxj3-5rmq",
  "modified" : "2023-06-14T17:24:36Z",
  "published" : "2023-06-14T17:24:36Z",
  "aliases" : [ ],
  "summary" : "github.com/lestrrat-go/jwx vulnerable to Potential Padding Oracle Attack",
  "details" : "### Summary\n\nDecrypting AES-CBC encrypted JWE has Potential Padding Oracle Attack Vulnerability.\n\n### Details\n\nOn [v2.0.10](https://github.com/lestrrat-go/jwx/releases/tag/v2.0.10), decrypting AES-CBC encrypted JWE may return an error \"failed to generate plaintext from decrypted blocks: invalid padding\":\n\nhttps://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213\n\nReporting padding error causes [Padding Oracle Attack](https://en.wikipedia.org/wiki/Padding_oracle_attack) Vulnerability.\nRFC 7516 JSON Web Encryption (JWE) says that we **MUST NOT** do this.\n\n> 11.5.  Timing Attacks\n> To mitigate the attacks described in RFC 3218 [RFC3218], the\n> recipient MUST NOT distinguish between format, padding, and length\n> errors of encrypted keys.  It is strongly recommended, in the event\n> of receiving an improperly formatted key, that the recipient\n> substitute a randomly generated CEK and proceed to the next step, to\n> mitigate timing attacks.\n\nIn addition, the time to remove padding depends on the length of the padding.\nIt may leak the length of the padding by Timing Attacks.\n\nhttps://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66\n\nTo mitigate Timing Attacks, it MUST be done in constant time.\n\n### Impact\n\nThe authentication tag is verified, so it is not an immediate attack.\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/lestrrat-go/jwx/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.11"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.0.10"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/lestrrat-go/jwx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.26"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.2.25"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lestrrat-go/jwx/security/advisories/GHSA-rm8v-mxj3-5rmq"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lestrrat-go/jwx/commit/6c41e3822485fc7e11dd70b4b0524b075d66b103"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lestrrat-go/jwx/commit/d9ddbc8e5009cfdd8c28413390b67afa7f576dd6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lestrrat-go/jwx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-14T17:24:36Z",
    "nvd_published_at" : null
  }
}