Skip to content

Commit d65fc92

Browse files
authored
Land rapid7#14873, handle modules failing to be created when checking compatibility
2 parents cf6b08d + 5f19160 commit d65fc92

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/msf/core/exploit.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,12 @@ def is_payload_compatible?(name)
710710
# Skip over payloads that are too big
711711
return false if payload_space && p.cached_size && p.cached_size > payload_space
712712

713-
pi = p.new
713+
begin
714+
pi = p.new
715+
rescue ::Exception, ::LoadError => e
716+
wlog("Module #{name} failed to initialize: #{e}", 'core', LEV_0)
717+
return false
718+
end
714719

715720
# Are we compatible in terms of conventions and connections and
716721
# what not?

msfvenom

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,13 @@ def dump_payloads(platform = nil, arch = nil)
346346
framework.payloads.each_module(
347347
'Platform' => platform ? Msf::Module::PlatformList.transform(platform.split(',')) : nil,
348348
'Arch' => arch ? arch.split(',') : nil) do |name, mod|
349-
tbl << [ name, mod.new.description.split.join(' ') ]
349+
begin
350+
mod_info = mod.new.description.split.join(' ')
351+
rescue ::Exception, ::LoadError => e
352+
wlog("Module #{name} failed to initialize: #{e}", 'core', LEV_0)
353+
next
354+
end
355+
tbl << [ name, mod_info ]
350356
end
351357

352358
"\n" + tbl.to_s + "\n"

0 commit comments

Comments
 (0)