Executive brief
The Malcolm Fell JWT library, used for handling JSON Web Tokens in PHP applications, contains a security flaw in how it verifies signatures. An attacker could potentially exploit small differences in the time it takes the server to process requests to guess a valid signature. This would allow them to forge tokens and gain unauthorized access or perform actions as other users.
Technical details
The verify function in Encryption/Symmetric.php fails to use a constant-time comparison function (such as PHP's hash_equals) when validating HMAC signatures. Because standard string comparisons return as soon as a mismatch is found, an attacker can measure the response time of the server to iteratively determine the correct signature bytes. This timing side-channel vulnerability allows for the creation of forged JWTs without knowing the secret key. The issue is resolved in version 1.0.3 by implementing timing-safe hash comparisons.
Affected products
- Malcolm Fell (emarref) jwt before 1.0.3
Timeline
- 2016-09-05: patched: Fix merged in GitHub pull request #20 and released in v1.0.3
- 2017-01-23: disclosed: NVD publication date