Skip to content

Commit 5cc28a0

Browse files
filipnyquistDaneEveritt
authored andcommitted
Fixing timing attack vuln. on HMAC comparison (pterodactyl#409)
1 parent a35788d commit 5cc28a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/Http/Middleware/HMACAuthorization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected function validateIPAccess()
170170
*/
171171
protected function validateContents()
172172
{
173-
if (base64_decode($this->hash()) !== $this->generateSignature()) {
173+
if (! hash_equals(base64_decode($this->hash()), $this->generateSignature())) {
174174
throw new BadRequestHttpException('The HMAC for the request was invalid.');
175175
}
176176
}

0 commit comments

Comments
 (0)