mirror of
https://github.com/Yubico/yubikey-val.git
synced 2024-11-29 09:24:12 +01:00
Use absolute timestamp tolerance as well.
This commit is contained in:
parent
0fd6a2b7d0
commit
420f2fb9bf
@ -9,7 +9,8 @@ define('S_NO_SUCH_CLIENT', 'NO_SUCH_CLIENT');
|
||||
define('S_OPERATION_NOT_ALLOWED', 'OPERATION_NOT_ALLOWED');
|
||||
define('S_BACKEND_ERROR', 'BACKEND_ERROR');
|
||||
define('TS_SEC', 0.119);
|
||||
define('TS_TOLERANCE', 0.3);
|
||||
define('TS_REL_TOLERANCE', 0.3);
|
||||
define('TS_ABS_TOLERANCE', 20);
|
||||
|
||||
require_once 'yubikey.php';
|
||||
require_once 'config.php';
|
||||
|
@ -132,15 +132,15 @@ if ($sessionCounter == $seenSessionCounter && $sessionUse > $seenSessionUse) {
|
||||
$now = time();
|
||||
$elapsed = $now - $lastTime;
|
||||
$deviation = abs($elapsed - $tsDelta);
|
||||
$percent = round(100*$deviation/$elapsed);
|
||||
$percent = $deviation/$elapsed;
|
||||
debug("Timestamp seen=" . $seenTs . " this=" . $ts .
|
||||
" delta=" . $tsDiff . ' secs=' . $tsDelta .
|
||||
' accessed=' . $lastTime .' (' . $ad['accessed'] . ') now='
|
||||
. $now . ' (' . strftime("%Y-%m-%d %H:%M:%S", $now)
|
||||
. ') elapsed=' . $elapsed .
|
||||
' deviation=' . $deviation . ' secs or '.
|
||||
$percent . '%');
|
||||
if ($deviation > TS_TOLERANCE * $elapsed) {
|
||||
round(100*$percent) . '%');
|
||||
if ($deviation > TS_ABS_TOLERANCE && $percent > TS_REL_TOLERANCE) {
|
||||
debug("OTP failed phishing test");
|
||||
if ($ad['chk_time']) {
|
||||
sendResp(S_DELAYED_OTP);
|
||||
|
Loading…
Reference in New Issue
Block a user