Vulnérabilité dans pyjwt (CVE-2026-102271)
Résumé
Vulnérabilité dans pyjwt (CVE-2026-102271). Des informations confidentielles peuvent être exposées. Exploitable via HMACAlgorithm.prepare_key. Atténuation : mise à jour vers 2.14.0 ou plus.
Description d'origine
La description telle que publiée par la source (souvent en anglais).
Summary
HMACAlgorithm.prepare_key blocks asymmetric keys from being used as HMAC secrets by searching for text markers only. It looks for -----BEGIN and for an ssh- prefix. The same key in DER form is binary ASN.1 and has neither marker, so it passes the check and is used as an HMAC secret.
An application that verifies tokens with an RSA or EC public key, and also allows HS256 with that same key, can be given a forged token. The attacker signs it with the public key, which is public. This is the key confusion problem CVE-2022-29217 was filed for, reachable again through a different encoding.
The reach is smaller than the original CVE. The application must already be in that misconfiguration, and it must hold its public key as DER bytes rather than PEM.
Details
The guard is at jwt/algorithms.py:331:
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."
)
Both helpers are text matchers. Neither one parses the key.
jwt/utils.py:126,is_pem_format, runs a regex for----[- ]BEGIN ...----.jwt/utils.py:141,is_ssh_key, checksstartswithagainst a list ofssh-andecdsa-sha2-prefixes.
A DER encoded public key starts with the bytes 0x30 0x82. It matches neither, so prepare_key returns it unchanged and it becomes the HMAC secret.
There is no DER handling anywhere in the…
Source: NIST National Vulnerability Database NVD GitHub Advisory
Résumé généré automatiquement
Assemblé par SecPulse à partir des données sources (CVSS, CWE, versions affectées) à l'aide de modèles, sans IA. Vérifiez la description d'origine et les références ci-dessous.
Une vulnérabilité référencée CVE-2026-102271 a été découverte dans pyjwt.
Des attaquants peuvent cibler un point d'entrée spécifique comme HMACAlgorithm.prepare_key à distance pour détourner le produit.
Des informations confidentielles peuvent être exposées. Score CVSS : 7.4/10.
Action : mettez à jour pyjwt vers 2.14.0 ou supérieur.
En cas de doute, contactez votre service informatique ou cherchez « pyjwt CVE-2026-102271 » sur le site de l'éditeur.
CVE-2026-102271 (pyjwt) — CWE-347 / CVSS v3 7.4
Vecteur d'attaque : distant (réseau) / non authentifié / sans interaction utilisateur
Surface d'attaque : HMACAlgorithm.prepare_key / is_pem_format / is_ssh_key / startswith
Correctif : 2.14.0 — appliquer immédiatement
Plan : 1) Audit SBOM, 2) Mise à jour staging→prod, 3) Surveillance WAF/proxy sur les endpoints affectés, 4) Recherche d'IOC dans les logs.
Réfs : voir GHSA / avis éditeur / version corrigée liés sur cette page.
Une vulnérabilité (CWE-347) affecte pyjwt. Les attaquants atteignent le code vulnérable via HMACAlgorithm.prepare_key sans authentification.
Consultez l'avis de l'éditeur pour les versions affectées de pyjwt. Surface d'attaque : HMACAlgorithm.prepare_key / is_pem_format / is_ssh_key / startswith.
Gravité : Élevée (CVSS 7.4/10). Des informations confidentielles peuvent être exposées.
Mettre à jour vers 2.14.0.
En attendant le correctif : désactivez la fonctionnalité concernée, appliquez des règles WAF, ou restreignez l'accès par ACL réseau.
Recherchez dans les logs des requêtes correspondant aux IOC connus de cette CVE. Auditez les SBOM/dépendances.
Actions de réponse
Étapes concrètes et exemples de commandes que les équipes SOC/SRE doivent exécuter dans l'ordre
-
1Identify exposure identify
grep -r 'pyjwt' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
pyjwtを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade pyjwt to 2.14.0ステージング環境で 2.14.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Paquets affectés
Références
- advisory nvd.nist.gov
- advisory github.com
- package github.com
- package pypi.org
- web github.com
- web github.com
- web github.com