1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-01-20 10:52:15 +01:00

anti otp phishing

This commit is contained in:
Paul Chen 2008-12-03 18:27:48 +00:00
parent 150458a5ea
commit 15b2daaf19

View File

@ -140,24 +140,31 @@ if ($scDiff == 0) { // Same use session, check time stamp diff
sendResp(S_REPLAYED_OTP); sendResp(S_REPLAYED_OTP);
exit; exit;
} else { } else {
updDB($ad['id'], $decoded_token, $client);
$tsDelta = $tsDiff * TS_SEC; $tsDelta = $tsDiff * TS_SEC;
debug("Timestamp OK (" . $ts . ") delta count=" . $tsDiff . debug("Timestamp OK (" . $ts . ") delta count=" . $tsDiff .
'-> delta secs=' . $tsDelta); '-> delta secs=' . $tsDelta);
} }
//// Check the real time
//
if ($ad['chk_time']) {
$lastTime = strtotime($ad['accessed']); $lastTime = strtotime($ad['accessed']);
//$lastAccess = $ad['accessed']; //$lastAccess = $ad['accessed'];
//echo 'Last accessed: '.$lastAccess.' '.date("F j, Y, g:i a", $lastTime)."\n"; //echo 'Last accessed: '.$lastAccess.' '.date("F j, Y, g:i a", $lastTime)."\n";
$elapsed = time() - $lastTime; $elapsed = time() - $lastTime;
debug('Elapsed time from last validation: ' . $elapsed . ' secs'); debug('Elapsed time from last validation: ' . $elapsed . ' secs');
$deviation = abs($elapsed - $tsDelta); $deviation = abs($elapsed - $tsDelta);
debug("Key time deviation vs. real elapsed time=".$deviation.' secs'); debug("Key time deviation vs. elapsed time=".$deviation.' secs ('.
($deviation/$elapsed).'%)');
if ($deviation > TS_TOLERANCE * $elapsed) { if ($deviation > TS_TOLERANCE * $elapsed) {
debug("Is the OTP generated from a real crypto key?"); debug("Is the OTP generated from a real crypto key?");
sendResp(S_SECURITY_ERROR); sendResp(S_SECURITY_ERROR);
exit; exit;
} }
} }
} // End check time stamp
//// Check the high counter //// Check the high counter
// //