Studying PHP's (5.3.1 and below) LCG (linear congruential generator, a pseudorandom number generator), I discovered that there are weaknesses that reduce the complexity of determining the sequence of pseudorandom numbers. What this means is that PHP is severely deficient in producing random session IDs or random numbers, leading to the possibility of stealing sessions or other sensitive information.
The initial seed can be reduced from 64-bits to 35-bits, and with PHP code execution, can be reduced further down to just under 20-bits, which takes only seconds to recreate the initial seed. You can test with sources available below.
Mad hax0r pr0pz to Arshan "DHS-most-wanted" Dabirsiaghi (bless you) and Amit "smartypants" Klein for pointing me in the right direction with the LCG. Other tools to work out the LCG in forward and reverse, as well as determine session IDs, found below.
To test breaking the seed, run the following (after compiling s1s2.c)
time ./s1s2 8854 0.0887895027162
Can you guess my next lcg_value based off the above? (hint: it's 0.80061552527463).
Test by running:
time ./lcg-state-forward [s1] [s2] 100
Your session_id is hoiaaf8rrsm2hterbfk2b8b8p0 (or just look at your cookie)
session_start(); echo "Hi $_SERVER[REMOTE_ADDR]! The time is " . time() . "<p>"; echo "To test breaking the seed, run the following (after compiling <a href='s1s2.c'>s1s2.c</a>)<br>"; echo "<code>time <a href='s1s2.c'>./s1s2</a> " . getmypid() . " " . lcg_value() . "</code><p>"; echo "Can you guess my next lcg_value based off the above? (hint: it's " . lcg_value() . ").<br>"; echo "Test by running: <code>time <a href='lcg-state-forward.c'>./lcg-state-forward</a> [s1] [s2] 100</code><p>"; echo "Your <a href='http://www.test.com/search?q=" . session_id() . "'>session_id</a> is " . session_id() . " (or just look at your cookie)";