rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.04k stars 13.94k forks source link

`gather/office365userenum` file gets loaded on start up, as it's missing from the module metadata cache #14705

Closed cgranleese-r7 closed 3 years ago

cgranleese-r7 commented 3 years ago

While pairing with @adfoster-r7 on https://github.com/rapid7/metasploit-framework/pull/14480 showed that the gather/office365userenum file gets loaded on start up, as it's missing from the module metadata cache.

Related PR comment: https://github.com/rapid7/metasploit-framework/pull/14480#discussion_r561935212

This explains why the user's log files are often filled with these messages:

[01/21/2021 14:43:33] [e(0)] core: Unable to load module /Users/adfoster/Documents/code/metasploit-framework/modules/auxiliary/gather/office365userenum.py - LoadError  Try running file manually to check for errors or dependency issues.

We believe this problem is happening on Jenkins for the same reason users can't load this module on most 'fresh' setups, not having the required dependencies:

➜ metasploit-framework git:(improves-handling-off-external-modules-missing-runtime-dependencies) ✗ PYTHONPATH=./lib/msf/core/modules/external/python:$PYTHONPATH python ./modules/auxiliary/gather/office365userenum.py [12/01/21 | 3:14:31] Missing Dependency! python-requests required! {"params": {"message": "\n\n. .1111... | Title: office365userenum.py\n .10000000000011. .. | Author: Oliver Morton (Sec-1 Ltd)\n .00 000... | Email: oliverm@sec-1.com\n1 01.. | Description:\n .. | Enumerate valid usernames from Office 365 using\n .. | ActiveSync.\nGrimHacker .. | Requires: Python 2.7 or 3.6, python-requests\n .. |\ngrimhacker.com .. |\n@grimhacker .. |\n----------------------------------------------------------------------------\n This program comes with ABSOLUTELY NO WARRANTY.\n This is free software, and you are welcome to redistribute it\n under certain conditions. See GPLv2 License.\n----------------------------------------------------------------------------\n", "level": "info"}, "jsonrpc": "2.0", "method": "message"}

This was discussed at module hacking, but just wanted to open an issue just so it's not forgot about 👍

Steps to reproduce

How'd you do it?

  1. Start msfconsole
  2. You should receive the same warning image

Were you following a specific guide/tutorial or reading documentation?

Was working on https://github.com/rapid7/metasploit-framework/pull/14480 when we found the issue.

Expected behavior

Should be no warning.

Current behavior

We get a warning.

Metasploit version

image

Debug

Module/Datastore

The following global/module datastore, and database setup was configured before the issue occurred:

Collapse ``` [framework/core] loglevel=3 [framework/database] default_db=local-https-data-service [framework/database/local-https-data-service] url=[Filtered] cert=[Filtered] skip_verify=[Filtered] api_token=[Filtered] [framework/features] RHOST_HTTP_URL=true [framework/ui/console] ActiveModule=exploit/windows/smb/ms17_010_eternalblue_win8 [windows/smb/ms17_010_eternalblue_win8] WfsDelay=5 WORKSPACE= VERBOSE=false EnableContextEncoding=false ContextInformationFile= DisablePayloadHandler=false RHOST=192.168.215.169 RPORT=445 ProcessName=spoolsv.exe GroomAllocations=13 SMBUser=Jim SMBPass=password PAYLOAD=windows/x64/meterpreter/reverse_tcp LHOST=192.168.215.1 loglevel=3 ```

History

The following commands were ran during the session and before this issue occurred:

Collapse ``` 2163 set loglevel 3 2164 debug ```

Framework Errors

The following framework errors occurred before the issue occurred:

Collapse ``` [02/02/2021 11:38:40] [e(0)] core: Dependency for windows/x64/encrypted_shell_reverse_tcp is not supported [02/02/2021 11:38:40] [e(0)] core: Dependency for windows/encrypted_reverse_tcp is not supported [02/02/2021 11:38:40] [e(0)] core: Dependency for windows/x64/encrypted_reverse_tcp is not supported [02/02/2021 11:38:40] [e(0)] core: Unable to load module /Users/cgranleese/rapid7/metasploit-framework/modules/auxiliary/gather/office365userenum.py - LoadError Try running file manually to check for errors or dependency issues. Call stack: /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/external/shim.rb:9:in `generate' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:84:in `read_module_content' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:125:in `load_module' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:244:in `block in load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:49:in `block (2 levels) in each_module_reference_name' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:133:in `block in find' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:132:in `catch' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:132:in `find' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:38:in `block in each_module_reference_name' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:27:in `foreach' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:27:in `each_module_reference_name' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:243:in `load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:132:in `block in load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:130:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:130:in `load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:41:in `block in add_module_path' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `add_module_path' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:51:in `block in init_module_paths' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:50:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:50:in `init_module_paths' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/driver.rb:157:in `initialize' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `new' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `driver' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start' /Users/cgranleese/rapid7/metasploit-framework/msfconsole:23:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `kernel_load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:28:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:476:in `exec' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor.rb:399:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:30:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/base.rb:476:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:24:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:46:in `block in ' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/friendly_errors.rb:123:in `with_friendly_errors' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:34:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `
' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `eval' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `
' [02/02/2021 11:38:40] [e(0)] core: /Users/cgranleese/rapid7/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue_win8.rb failed to load - Errno::ENOENT No such file or directory @ rb_sysopen - /Users/cgranleese/rapid7/metasploit-framework/modules/exploits/windows/smb/ms17_010_eternalblue_win8.rb Call stack: /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/directory.rb:74:in `initialize' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/directory.rb:74:in `open' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/directory.rb:74:in `read_module_content' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:125:in `load_module' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/cache.rb:90:in `block in load_cached_module' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/cache.rb:85:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/cache.rb:85:in `load_cached_module' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_set.rb:44:in `create' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager.rb:80:in `create' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/command_dispatcher/modules.rb:672:in `cmd_use' /Users/cgranleese/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:525:in `run_command' /Users/cgranleese/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:476:in `block in run_single' /Users/cgranleese/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:470:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:470:in `run_single' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/driver.rb:274:in `block in load_config' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/driver.rb:271:in `each_pair' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/driver.rb:271:in `load_config' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/driver.rb:167:in `initialize' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `new' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `driver' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start' /Users/cgranleese/rapid7/metasploit-framework/msfconsole:23:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `kernel_load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:28:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:476:in `exec' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor.rb:399:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:30:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/base.rb:476:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:24:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:46:in `block in ' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/friendly_errors.rb:123:in `with_friendly_errors' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:34:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `
' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `eval' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `
' [02/02/2021 11:39:25] [e(0)] core: Dependency for windows/encrypted_shell_reverse_tcp is not supported [02/02/2021 11:39:25] [e(0)] core: Dependency for windows/x64/encrypted_shell_reverse_tcp is not supported [02/02/2021 11:39:25] [e(0)] core: Dependency for windows/encrypted_reverse_tcp is not supported [02/02/2021 11:39:25] [e(0)] core: Dependency for windows/x64/encrypted_reverse_tcp is not supported [02/02/2021 11:39:26] [e(0)] core: /Users/cgranleese/rapid7/metasploit-framework/modules/auxiliary/gather/office365userenum.py failed to load - LoadError Try running file manually to check for errors or dependency issues. Call stack: /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/external/shim.rb:9:in `generate' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:89:in `read_module_content' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:126:in `load_module' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:245:in `block in load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:54:in `block (2 levels) in each_module_reference_name' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:133:in `block in find' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:132:in `catch' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:132:in `find' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:43:in `block in each_module_reference_name' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:32:in `foreach' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:32:in `each_module_reference_name' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:244:in `load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:170:in `block in load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:168:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:168:in `load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:41:in `block in add_module_path' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `add_module_path' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:51:in `block in init_module_paths' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:50:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:50:in `init_module_paths' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/driver.rb:157:in `initialize' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `new' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `driver' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start' /Users/cgranleese/rapid7/metasploit-framework/msfconsole:23:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `kernel_load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:28:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:476:in `exec' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor.rb:399:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:30:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/base.rb:476:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:24:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:46:in `block in ' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/friendly_errors.rb:123:in `with_friendly_errors' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:34:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `
' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `eval' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `
' ```

Web Service Errors

The following web service errors occurred before the issue occurred:

Collapse ``` No matching patterns were found in msf-ws.log. ```

Framework Logs

The following framework logs were recorded before the issue occurred:

Collapse ``` [02/02/2021 11:39:26] [d(2)] core: Cached module from /Users/cgranleese/rapid7/metasploit-framework/modules/auxiliary/dos/cisco/cisco_7937g_dos_reboot.py has not changed. [02/02/2021 11:39:26] [d(2)] core: Cached module from /Users/cgranleese/rapid7/metasploit-framework/modules/auxiliary/gather/get_user_spns.py has not changed. [02/02/2021 11:39:26] [d(2)] core: Cached module from /Users/cgranleese/rapid7/metasploit-framework/modules/auxiliary/gather/mikrotik_winbox_fileread.py has not changed. [02/02/2021 11:39:26] [e(0)] core: /Users/cgranleese/rapid7/metasploit-framework/modules/auxiliary/gather/office365userenum.py failed to load - LoadError Try running file manually to check for errors or dependency issues. Call stack: /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/external/shim.rb:9:in `generate' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:89:in `read_module_content' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:126:in `load_module' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:245:in `block in load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:54:in `block (2 levels) in each_module_reference_name' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:133:in `block in find' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:132:in `catch' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/gems/rex-core-0.1.14/lib/rex/file.rb:132:in `find' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:43:in `block in each_module_reference_name' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:32:in `foreach' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/executable.rb:32:in `each_module_reference_name' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/modules/loader/base.rb:244:in `load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:170:in `block in load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:168:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/loading.rb:168:in `load_modules' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:41:in `block in add_module_path' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/core/module_manager/module_paths.rb:40:in `add_module_path' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:51:in `block in init_module_paths' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:50:in `each' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/base/simple/framework/module_paths.rb:50:in `init_module_paths' /Users/cgranleese/rapid7/metasploit-framework/lib/msf/ui/console/driver.rb:157:in `initialize' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `new' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:60:in `driver' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start' /Users/cgranleese/rapid7/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start' /Users/cgranleese/rapid7/metasploit-framework/msfconsole:23:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `kernel_load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:28:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:476:in `exec' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor.rb:399:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:30:in `dispatch' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/base.rb:476:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/cli.rb:24:in `start' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:46:in `block in ' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/2.7.0/bundler/friendly_errors.rb:123:in `with_friendly_errors' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:34:in `' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `load' /Users/cgranleese/.rvm/rubies/ruby-2.7.2/bin/bundle:23:in `
' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `eval' /Users/cgranleese/.rvm/gems/ruby-2.7.2@metasploit-framework/bin/ruby_executable_hooks:24:in `
' [02/02/2021 11:39:26] [i(2)] core: Reloading exploit module windows/smb/ms17_010_eternalblue_win8. Ambiguous module warnings are safe to ignore ```

Web Service Logs

The following web service logs were recorded before the issue occurred:

Collapse ``` Writing PID to /Users/cgranleese/.msf4/msf-ws.pid Thin web server (v1.7.2 codename Bachmanity) Maximum connections set to 1024 Listening on localhost:5443, CTRL+C to stop Exiting! 2020-11-20 13:34:45 +0000 Writing PID to /Users/cgranleese/.msf4/msf-ws.pid 2020-11-20 13:34:50 +0000 Thin web server (v1.8.0 codename Possessed Pickle) 2020-11-20 13:34:50 +0000 Maximum connections set to 1024 2020-11-20 13:34:50 +0000 Listening on localhost:5443, CTRL+C to stop 2020-12-18 13:26:15 +0000 Exiting! 2020-12-18 13:26:18 +0000 Writing PID to /Users/cgranleese/.msf4/msf-ws.pid 2020-12-18 13:26:20 +0000 Thin web server (v1.8.0 codename Possessed Pickle) 2020-12-18 13:26:20 +0000 Maximum connections set to 1024 2020-12-18 13:26:20 +0000 Listening on localhost:5443, CTRL+C to stop [!] {:session=>{:id=>148, :host_id=>10, :stype=>"meterpreter", :via_exploit=>"exploit/multi/handler", :via_payload=>"payload/windows/x64/meterpreter/reverse_tcp", :desc=>"WIN-9ST3FTDJ95L\\Jim @ WIN-9ST3FTDJ95L", :port=>50139, :platform=>"x64/windows", :datastore=>{:PAYLOAD=>"windows/x64/meterpreter/reverse_tcp", :WORKSPACE=>"", :VERBOSE=>"false", :WfsDelay=>"0", :EnableContextEncoding=>"false", :ContextInformationFile=>"", :DisablePayloadHandler=>"false", :ExitOnSession=>"true", :ListenerTimeout=>"0", :lhost=>"192.168.215.1", :LPORT=>"4444", :ReverseListenerBindPort=>"", :ReverseAllowProxy=>"false", :ReverseListenerComm=>"", :ReverseListenerBindAddress=>"", :ReverseListenerThreaded=>"false", :StagerRetryCount=>"10", :StagerRetryWait=>"5", :PingbackRetries=>"0", :PingbackSleep=>"30", :PayloadUUIDSeed=>"", :PayloadUUIDRaw=>"", :PayloadUUIDName=>"", :PayloadUUIDTracking=>"false", :EnableStageEncoding=>"false", :StageEncoder=>"", :StageEncoderSaveRegisters=>"", :StageEncodingFallback=>"true", :PrependMigrate=>"false", :PrependMigrateProc=>"", :EXITFUNC=>"process", :AutoLoadStdapi=>"true", :AutoVerifySession=>"true", :AutoVerifySessionTimeout=>"30", :InitialAutoRunScript=>"", :AutoRunScript=>"", :AutoSystemInfo=>"true", :EnableUnicodeEncoding=>"false", :HandlerSSLCert=>"", :SessionRetryTotal=>"3600", :SessionRetryWait=>"10", :SessionExpirationTimeout=>"604800", :SessionCommunicationTimeout=>"300", :PayloadProcessCommandLine=>"", :AutoUnhookProcess=>"false", :TARGET=>"0"}, :opened_at=>"2020-12-18T13:28:57.881Z", :closed_at=>nil, :close_reason=>nil, :local_id=>1, :last_seen=>"2020-12-18T13:28:57.881Z", :module_run_id=>nil}, :route=>"192.168.215.0/255.255.255.0"} [!] {:session=>{:id=>148, :host_id=>10, :stype=>"meterpreter", :via_exploit=>"exploit/multi/handler", :via_payload=>"payload/windows/x64/meterpreter/reverse_tcp", :desc=>"WIN-9ST3FTDJ95L\\Jim @ WIN-9ST3FTDJ95L", :port=>50139, :platform=>"x64/windows", :datastore=>{:PAYLOAD=>"windows/x64/meterpreter/reverse_tcp", :WORKSPACE=>"", :VERBOSE=>"false", :WfsDelay=>"0", :EnableContextEncoding=>"false", :ContextInformationFile=>"", :DisablePayloadHandler=>"false", :ExitOnSession=>"true", :ListenerTimeout=>"0", :lhost=>"192.168.215.1", :LPORT=>"4444", :ReverseListenerBindPort=>"", :ReverseAllowProxy=>"false", :ReverseListenerComm=>"", :ReverseListenerBindAddress=>"", :ReverseListenerThreaded=>"false", :StagerRetryCount=>"10", :StagerRetryWait=>"5", :PingbackRetries=>"0", :PingbackSleep=>"30", :PayloadUUIDSeed=>"", :PayloadUUIDRaw=>"", :PayloadUUIDName=>"", :PayloadUUIDTracking=>"false", :EnableStageEncoding=>"false", :StageEncoder=>"", :StageEncoderSaveRegisters=>"", :StageEncodingFallback=>"true", :PrependMigrate=>"false", :PrependMigrateProc=>"", :EXITFUNC=>"process", :AutoLoadStdapi=>"true", :AutoVerifySession=>"true", :AutoVerifySessionTimeout=>"30", :InitialAutoRunScript=>"", :AutoRunScript=>"", :AutoSystemInfo=>"true", :EnableUnicodeEncoding=>"false", :HandlerSSLCert=>"", :SessionRetryTotal=>"3600", :SessionRetryWait=>"10", :SessionExpirationTimeout=>"604800", :SessionCommunicationTimeout=>"300", :PayloadProcessCommandLine=>"", :AutoUnhookProcess=>"false", :TARGET=>"0"}, :opened_at=>"2020-12-18T13:28:57.881Z", :closed_at=>nil, :close_reason=>nil, :local_id=>1, :last_seen=>"2020-12-18T13:28:57.881Z", :module_run_id=>nil}, :route=>"169.254.0.0/255.255.0.0"} 2020-12-18 18:53:19 +0000 Exiting! 2021-01-06 09:49:53 +0000 Writing PID to /Users/cgranleese/.msf4/msf-ws.pid 2021-01-06 09:49:55 +0000 Thin web server (v1.8.0 codename Possessed Pickle) 2021-01-06 09:49:55 +0000 Maximum connections set to 1024 2021-01-06 09:49:55 +0000 Listening on localhost:5443, CTRL+C to stop 2021-01-18 11:57:58 +0000 Exiting! 2021-01-18 14:32:08 +0000 Writing PID to /Users/cgranleese/.msf4/msf-ws.pid 2021-01-18 14:32:11 +0000 Thin web server (v1.8.0 codename Possessed Pickle) 2021-01-18 14:32:11 +0000 Maximum connections set to 1024 2021-01-18 14:32:11 +0000 Listening on localhost:5443, CTRL+C to stop 2021-01-18 15:14:21 +0000 Exiting! 2021-01-18 15:15:29 +0000 Writing PID to /Users/cgranleese/.msf4/msf-ws.pid 2021-01-18 15:15:32 +0000 Thin web server (v1.8.0 codename Possessed Pickle) 2021-01-18 15:15:32 +0000 Maximum connections set to 1024 2021-01-18 15:15:32 +0000 Listening on localhost:5443, CTRL+C to stop 2021-01-25 12:08:37 +0000 Exiting! 2021-01-25 14:37:14 +0000 Writing PID to /Users/cgranleese/.msf4/msf-ws.pid 2021-01-25 14:37:17 +0000 Thin web server (v1.8.0 codename Possessed Pickle) 2021-01-25 14:37:17 +0000 Maximum connections set to 1024 2021-01-25 14:37:17 +0000 Listening on localhost:5443, CTRL+C to stop ```

Version/Install

The versions and install method of your Metasploit setup:

Collapse ``` Framework: 6.0.29-dev-ea11df77d2 Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19] Install Root: /Users/cgranleese/rapid7/metasploit-framework Session Type: Connected to remote_data_service: (https://localhost:5443). Connection type: http. Install Method: Git Clone ```
github-actions[bot] commented 3 years ago

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

hollerith commented 3 years ago

There is a dependency missing. python-requests.

I needed to install python3-requests to resolve the issue for me.

ofersadan85 commented 3 years ago

My system has only python3 and no python2, so even with installed python3-requests as @hollerith mentioned the problem persists. Looks like the module is looking for "python" and not "python3", so i solved it by installing:

sudo apt install python-is-python3

It appears that the problem is just the shebang in the module, i.e #! /usr/bin/env python , while the rest of the python modules (at least those i've checked) have a shebang specifically for python3 #! /usr/bin/env python3

Since python2 is deprecated I'm guessing it would be perfectly safe to fix that and remove support for python2, I'd be happy to create a pull request if this is acceptable, because otherwise every modern system that doesn't come with python2 pre-installed will experience this issue (though just a warning)

jmartin-tech commented 3 years ago

Binary names for python are inconsistent across Linux distributions. In some cases python will point to the distro's default version of python which may be 2 or 3. Since python 2 is now EOL, it is likely there will be a trend by distributions maintainers to install python as python 3 by default and deprecate python3 usage.

The current #! implementations were originally to point modules not compatible with python 2 at python3 if available. Since all python external modules should now be python 3 compliant, it may be appropriate to update all detection for python or python3 on the path with version checks and change the execution step call python directly instead of relying on the #! value.