Every CVE Search/ Get API key

CVE-2022-3102

jwcrypto token substitution can lead to authentication bypass

6.8 MediumFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
High
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
High

What each source reports

OSV Score usedOESA-2024-2443 6.8

python-jwcrypto security update

Implements JWK, JWS, JWE specifications with python-cryptography

Security Fix(es):

VUL-0: CVE-2022-3102: python-jwcrypto: jwcrypto token substitution can lead to authentication bypass(CVE-2022-3102)

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.(CVE-2024-28102)

Record
OESA-2024-2443
CVSS 3.1
6.8 MediumCVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:N/I:N/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-gwp4-mcv4-w95j No score

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.

Record
GHSA-gwp4-mcv4-w95j
Updated
2026-11-02
OSVGHSA-gwp4-mcv4-w95j No score

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.

Record
GHSA-gwp4-mcv4-w95j
Updated
2026-11-02
OSVopenSUSE-SU-2024:12528-1 No score

python310-jwcrypto-1.4.2-1.1 on GA media

These are all security issues fixed in the python310-jwcrypto-1.4.2-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:12528-1
Updated
2026-11-02
OSVopenSUSE-SU-2025:15096-1 No score

python311-jwcrypto-1.5.6-2.5 on GA media

These are all security issues fixed in the python311-jwcrypto-1.5.6-2.5 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2025:15096-1
Updated
2026-11-02
OSVPYSEC-2026-827 No score

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.

Record
PYSEC-2026-827
Updated
2026-11-02

Affected packages

Affected packages
PackageAffectedFixed
jwcrypto
PyPI
before 1.4
1.4
jwcrypto
PyPI
before 1.4, plus listed versions
0.2.00.2.10.3.00.3.10.4.0
Show 12 moreShow less
0.4.10.4.20.5.00.6.00.70.80.90.9.11.01.21.31.3.1
1.4
python-jwcrypto
openEuler:22.03-LTS-SP1
From an advisory covering 2 CVEs
before 1.4.2-3.oe2203sp1
1.4.2-3.oe2203sp1
python-jwcrypto
openSUSE:Tumbleweed
before 1.4.2-1.1
1.4.2-1.1
python-jwcrypto
openSUSE:Tumbleweed
before 1.5.6-2.5
1.5.6-2.5

History

History
RecordedChangedSources
affected, facts
first indexedGitHub Advisories, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2022-3102 is a medium vulnerability (CVSS 6.8) in jwcrypto, published September 21, 2022. No source lists public exploit code. Fixed in jwcrypto 1.4.

References

Show 5 moreShow less
MoveEnter Open