1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2025-02-01 10:52:18 +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);
} }
$lastTime = strtotime($ad['accessed']); //// Check the real time
//$lastAccess = $ad['accessed']; //
//echo 'Last accessed: '.$lastAccess.' '.date("F j, Y, g:i a", $lastTime)."\n";
$elapsed = time() - $lastTime; if ($ad['chk_time']) {
debug('Elapsed time from last validation: '.$elapsed.' secs'); $lastTime = strtotime($ad['accessed']);
$deviation = abs($elapsed - $tsDelta); //$lastAccess = $ad['accessed'];
debug("Key time deviation vs. real elapsed time=".$deviation.' secs'); //echo 'Last accessed: '.$lastAccess.' '.date("F j, Y, g:i a", $lastTime)."\n";
if ($deviation > TS_TOLERANCE * $elapsed) { $elapsed = time() - $lastTime;
debug("Is the OTP generated from a real crypto key?"); debug('Elapsed time from last validation: ' . $elapsed . ' secs');
sendResp(S_SECURITY_ERROR); $deviation = abs($elapsed - $tsDelta);
exit; debug("Key time deviation vs. elapsed time=".$deviation.' secs ('.
($deviation/$elapsed).'%)');
if ($deviation > TS_TOLERANCE * $elapsed) {
debug("Is the OTP generated from a real crypto key?");
sendResp(S_SECURITY_ERROR);
exit;
}
} }
} } // End check time stamp
//// Check the high counter //// Check the high counter
// //