github jpadilla/pyjwt 1.0.0
v1.0.0

latest releases: 2.4.0, 2.3.0, 2.2.0...
9 years ago

Changelog

  • [CLEANUP] Removed api.header. #85
  • [DOCS] README details how to extract public / private keys from an x509 certificate. #100
  • [ENHANCEMENT] Refactor api.py functions into an object (PyJWT). #101
  • [ENHANCEMENT] Support PyCrypto and ecdsa when cryptography isn't available. #103
  • [SECURITY] Added some fixes related to algorithm and key choice. #109
  • [SECURITY] Added support for whitelist validation of the alg header. #110

Security

A security researcher has notified JSON Web Token library maintainers about a number of vulnerabilities allowing attackers to bypass the verification step. Read more about some of this issues here.

This release fixes the vulnerabilities reported, continue reading for details.

None algorithm

Applies if you

  • rely on and do not validate the alg field in the token header.
  • implement the "none" algorithm.

Impact

Attackers can craft a malicious token containing an arbitrary payload that passes the verification step.

Exploit

Create a token with the header {"typ":"JWT","alg":"none"}. Include any payload. Do not include a signature (i.e. the token should end with a period). Note: some implementations include some basic but insufficient checking for a missing signature -- some minor fiddling may be required to produce an exploit.

Asymmetric key of a token signed with a symmetric key

Applies if you

  • rely on and do not validate the alg field in the token header.
  • implement at least one of the HMAC algorithms and at least one of the asymmetric algorithms (e.g. HS256 and RS256).

Impact

If the system is expecting a token signed with one of the asymmetric algorithms, an attacker can bypass the verification step by knowing only the public key.

Exploit

Create an HS256 token. Generate the HMAC signature using the literal bytes of the public key file (often in the PEM format). This will confuse the implementation into interpreting the public key file as an HMAC key.

This release was possible thanks to the awesome @mark-adams.

Don't miss a new pyjwt release

NewReleases is sending notifications on new releases.