Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle nil error when creating adapted payloads #18166

Merged

Conversation

dwelch-r7
Copy link
Contributor

Issue introduced as part of #17901

When doing show payloads for a module that supports the encrypted payloads on a machine that doesn't have mingw available we try to adapt a nil payload, this PR is just adding a check to make sure the payload we want to adapt is actually available

msf6 exploit(multi/handler) > show payloads
[-] Error while running command show: undefined method `new' for nil:NilClass

Call stack:
/Users/dwelch/dev/metasploit-framework/lib/msf/core/payload_set.rb:156:in `calculate_adapted_single_payload'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/payload_set.rb:390:in `add_cached_module'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/payload_set.rb:318:in `add_module'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/module_manager/loading.rb:108:in `on_module_load'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/modules/loader/base.rb:202:in `load_module'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/module_manager/cache.rb:101:in `block in load_cached_module'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/module_manager/cache.rb:98:in `each'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/module_manager/cache.rb:98:in `load_cached_module'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/module_set.rb:42:in `create'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/module_set.rb:26:in `[]'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/exploit.rb:705:in `is_payload_compatible?'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/exploit.rb:744:in `block in compatible_payloads'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/exploit.rb:743:in `each'
/Users/dwelch/dev/metasploit-framework/lib/msf/core/exploit.rb:743:in `compatible_payloads'
/Users/dwelch/dev/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb:1398:in `show_payloads'
/Users/dwelch/dev/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb:590:in `block in cmd_show'
/Users/dwelch/dev/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb:571:in `each'
/Users/dwelch/dev/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb:571:in `cmd_show'
/Users/dwelch/dev/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:581:in `run_command'
/Users/dwelch/dev/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:530:in `block in run_single'
/Users/dwelch/dev/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:524:in `each'
/Users/dwelch/dev/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:524:in `run_single'
/Users/dwelch/dev/metasploit-framework/lib/rex/ui/text/shell.rb:168:in `run'
/Users/dwelch/dev/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
/Users/dwelch/dev/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
./msfconsole:23:in `<main>'

Verification steps

  • Boot up msfconsole
  • use exploit/multi/handler
  • show payloads

@dwelch-r7 dwelch-r7 added the rn-fix release notes fix label Jul 5, 2023
@adfoster-r7 adfoster-r7 merged commit 00aa2e6 into rapid7:master Jul 5, 2023
35 checks passed
@adfoster-r7
Copy link
Contributor

Release Notes

Fixes a crash when running the show payloads command for a module that supports encrypted payloads on a machine that doesn't have a Mingw compiler available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants