juzna

SessionId and randomness

Dec 1st, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Starts a PHP session and dump a random number
  4.  */
  5. session_start();
  6.  
  7. // do some stuff...
  8.  
  9. $password = mt_rand();
  10. $otherRandomToken = rand();
  11. $nettePass = Nette\Utils\Strings::random();
  12.  
  13. // Question 1: which of these is/are random?
  14. // Question 2: which of these is/are unpredictable by an attacker?
  15.  
  16. // Answer 1: all three
  17. // Answer 2: none, all can be recovered only from sessionId, precisely (i.e. attacker won't even have to try several possibilities)
Advertisement
Add Comment
Please, Sign In to add comment