Junglewise Threat Intelligence

CVE-2016-7036: python-jose timing attack in HMAC key comparison

CVE-2016-7036 · Severity: critical · CVSS 9.8 · Published 2017-01-23

Technologies: Mpdavis Jose, python-jose (PyPI). Vendors: Mpdavis, PyPI.

Executive brief

The python-jose library, which is used to implement JSON Web Tokens (JWT) for secure data exchange and authentication, contains a vulnerability in how it verifies security keys. Because the library does not use a consistent amount of time to compare keys, an attacker could potentially guess valid security signatures by measuring response times. If successful, this could allow an attacker to bypass authentication, forge data, or gain unauthorized access to protected systems.

Technical details

The python-jose library prior to version 1.3.2 fails to use a constant-time string comparison algorithm when verifying HMAC signatures. This introduces a timing side-channel vulnerability (CWE-361) where the time taken to reject an invalid signature depends on how many initial bytes match the correct key. A remote, unauthenticated attacker can exploit this by measuring precise response times to iteratively guess the correct HMAC signature. Successful exploitation allows the attacker to forge valid JSON Web Tokens (JWTs), leading to complete authentication bypass and unauthorized data modification. The issue was resolved in version 1.3.2 by implementing constant-time comparison in the JWK component.

Affected products

  • mpdavis python-jose < 1.3.2

Timeline

  • 2016-09-05: patched: Fix merged into master and version 1.3.2 released.
  • 2017-01-23: disclosed: NVD publication date.

References

Related threats