Skip to content

Commit 8d622c2

Browse files
author
Ivan Kurnosov
committed
bug #42637 [Security] Fixed TOCTOU in RememberMe cache token verifier
1 parent 1468230 commit 8d622c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Authentication/RememberMe/CacheTokenVerifier.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public function verifyToken(PersistentTokenInterface $token, string $tokenValue)
4545
}
4646

4747
$cacheKey = $this->getCacheKey($token);
48-
if (!$this->cache->hasItem($cacheKey)) {
48+
$item = $this->cache->getItem($cacheKey);
49+
if (!$item->isHit()) {
4950
return false;
5051
}
5152

52-
$item = $this->cache->getItem($cacheKey);
5353
$outdatedToken = $item->get();
5454

5555
return hash_equals($outdatedToken, $tokenValue);

0 commit comments

Comments
 (0)