Skip to content

Module auxiliary/gather/kerberos_enumusers errors when enumerating users with no preauthentication required #15286

Description

@stephenbradshaw

Steps to reproduce

The auxiliary/gather/kerberos_enumusers module errors out when attempting to enumerate a Kerberos user with the “No Kerberos Pre-Authentication Required” option set.

Target server is Windows Server 2019 Datacenter 10.0 (17763).

See the example below, in this case the file /tmp/users.txt contains 3 users that exist in the system, the third of which has the “No Kerberos Pre-Authentication Required” option set.

msf6 exploit(windows/smb/psexec) > use auxiliary/gather/kerberos_enumusers
msf6 auxiliary(gather/kerberos_enumusers) > set DOMAIN *REDACTED*
DOMAIN => *REDACTED*
msf6 auxiliary(gather/kerberos_enumusers) > set RHOSTS *REDACTED*
RHOSTS => *REDACTED*
msf6 auxiliary(gather/kerberos_enumusers) > set USER_FILE /tmp/users.txt
USER_FILE => /tmp/users.txt
msf6 auxiliary(gather/kerberos_enumusers) > exploit
[*] Running module against *REDACTED*

[*] Validating options...
[*] Using domain: *REDACTED*...
[*] *REDACTED*:88 - Testing User: "administrator"...
[*] *REDACTED*:88 - KDC_ERR_PREAUTH_REQUIRED - Additional pre-authentication required
[+] *REDACTED*:88 - User: "administrator" is present
[*] *REDACTED*:88 - Testing User: "guest"...
[*] *REDACTED*:88 - KDC_ERR_CLIENT_REVOKED - Clients credentials have been revoked
[-] *REDACTED*:88 - User: "guest" account disabled or locked out
[*] *REDACTED*:88 - Testing User: "*REDACTED*"...
[-] Auxiliary failed: NoMethodError undefined method `error_code' for #<Rex::Proto::Kerberos::Model::KdcResponse:0x00007f7fa695ca18>
[-] Call stack:
[-]   /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:74:in `block in run'
[-]   /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `each'
[-]   /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `run'
[*] Auxiliary module execution completed

Expected behavior

The existing user should be identified, no error should occur.

Current behavior

The error shown above occurs.

Metasploit version

5fe585d (HEAD -> master, origin/master, origin/HEAD) automatic module_metadata_base.json update

Additional Information

##  Module/Datastore

The following global/module datastore, and database setup was configured before the issue occurred:
<details>
<summary>Collapse</summary>

```
[framework/ui/console]
ActiveModule=auxiliary/gather/kerberos_enumusers

[gather/kerberos_enumusers]
WORKSPACE=
VERBOSE=false
RHOSTS=*REDACTED*
RPORT=88
Timeout=10
DOMAIN=*REDACTED*
USER_FILE=/tmp/users.txt
loglevel=3
```

</details>


##  History

The following commands were ran during the session and before this issue occurred:
<details>
<summary>Collapse</summary>

```
2011   use auxiliary/gather/kerberos_enumusers
2012   set loglevel 3
2013   set DOMAIN *REDACTED*
2014   options
2015   set RHOSTS *REDACTED*
2018   set USER_FILE /tmp/users.txt
2019   exploit
2020   debug
```

</details>


##  Framework Errors

The following framework errors occurred before the issue occurred:
<details>
<summary>Collapse</summary>

```
[06/02/2021 11:52:10] [e(0)] core: Failed to connect to the database: No database YAML file
[06/02/2021 11:53:51] [e(0)] core: Thread Exception: StreamMonitorRemote  critical=false    source:
    /opt/metasploit-framework/lib/metasploit/framework/thread_factory_provider.rb:25:in `spawn'
    /opt/metasploit-framework/lib/rex/thread_factory.rb:22:in `spawn'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/socket_abstraction.rb:120:in `monitor_rsock'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/stream_abstraction.rb:30:in `initialize_abstraction'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channels/socket_abstraction.rb:93:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:73:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `new'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `create'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:36:in `open'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:124:in `create_tcp_client_channel'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:93:in `create'
    /opt/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:577:in `create'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket.rb:51:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:37:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:28:in `create'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/tcp.rb:105:in `connect'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/smb/client.rb:106:in `connect'
    /opt/metasploit-framework/modules/exploits/windows/smb/psexec.rb:147:in `exploit'
    /opt/metasploit-framework/lib/msf/core/exploit_driver.rb:215:in `job_run_proc'
    /opt/metasploit-framework/lib/msf/core/exploit_driver.rb:168:in `run'
    /opt/metasploit-framework/lib/msf/base/simple/exploit.rb:144:in `exploit_simple'
    /opt/metasploit-framework/lib/msf/base/simple/exploit.rb:168:in `exploit_simple'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb:56:in `exploit_single'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb:213:in `cmd_exploit'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:532:in `run_command'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:481:in `block in run_single'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `each'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `run_single'
    /opt/metasploit-framework/lib/rex/ui/text/shell.rb:155:in `run'
    /opt/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
    /opt/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
    ./msfconsole:23:in `<main>' - TypeError no implicit conversion of nil into Integer
[06/02/2021 11:53:55] [e(0)] core: Session with no session_host/target_host/tunnel_peer. Session Info: #<Session:meterpreter 127.0.0.1 () >
[06/02/2021 11:55:55] [e(0)] core: Thread Exception: StreamMonitorRemote  critical=false    source:
    /opt/metasploit-framework/lib/metasploit/framework/thread_factory_provider.rb:25:in `spawn'
    /opt/metasploit-framework/lib/rex/thread_factory.rb:22:in `spawn'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/socket_abstraction.rb:120:in `monitor_rsock'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/stream_abstraction.rb:30:in `initialize_abstraction'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channels/socket_abstraction.rb:93:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:73:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `new'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `create'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:36:in `open'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:124:in `create_tcp_client_channel'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:93:in `create'
    /opt/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:577:in `create'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket.rb:51:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:37:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:28:in `create'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:131:in `create_tcp_connection'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:45:in `connect'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:72:in `send_request'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:119:in `send_recv'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client.rb:112:in `send_request_as'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:67:in `block in run'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `each'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `run'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:178:in `job_run_proc'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:85:in `run_simple'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:96:in `run_simple'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:80:in `block in cmd_run'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/range_walker.rb:232:in `each_host'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:75:in `cmd_run'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:532:in `run_command'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:481:in `block in run_single'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `each'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `run_single'
    /opt/metasploit-framework/lib/rex/ui/text/shell.rb:155:in `run'
    /opt/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
    /opt/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
    ./msfconsole:23:in `<main>' - Rex::Post::Meterpreter::RequestError stdapi_net_socket_tcp_shutdown: Operation failed: The handle is invalid.
[06/02/2021 11:55:57] [e(0)] core: Auxiliary failed - NoMethodError undefined method `error_code' for #<Rex::Proto::Kerberos::Model::KdcResponse:0x00007f7fa695ca18>
[06/02/2021 12:04:23] [e(0)] core: Failed to connect to the database: No database YAML file
[06/02/2021 12:07:39] [e(0)] core: Thread Exception: StreamMonitorRemote  critical=false    source:
    /opt/metasploit-framework/lib/metasploit/framework/thread_factory_provider.rb:25:in `spawn'
    /opt/metasploit-framework/lib/rex/thread_factory.rb:22:in `spawn'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/socket_abstraction.rb:120:in `monitor_rsock'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/stream_abstraction.rb:30:in `initialize_abstraction'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channels/socket_abstraction.rb:93:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:73:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `new'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `create'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:36:in `open'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:124:in `create_tcp_client_channel'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:93:in `create'
    /opt/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:577:in `create'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket.rb:51:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:37:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:28:in `create'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/tcp.rb:105:in `connect'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/smb/client.rb:106:in `connect'
    /opt/metasploit-framework/modules/exploits/windows/smb/psexec.rb:147:in `exploit'
    /opt/metasploit-framework/lib/msf/core/exploit_driver.rb:215:in `job_run_proc'
    /opt/metasploit-framework/lib/msf/core/exploit_driver.rb:168:in `run'
    /opt/metasploit-framework/lib/msf/base/simple/exploit.rb:144:in `exploit_simple'
    /opt/metasploit-framework/lib/msf/base/simple/exploit.rb:168:in `exploit_simple'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb:56:in `exploit_single'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/exploit.rb:213:in `cmd_exploit'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:532:in `run_command'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:481:in `block in run_single'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `each'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `run_single'
    /opt/metasploit-framework/lib/rex/ui/text/shell.rb:155:in `run'
    /opt/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
    /opt/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
    ./msfconsole:23:in `<main>' - Rex::Post::Meterpreter::RequestError stdapi_net_socket_tcp_shutdown: Operation failed: 1
[06/02/2021 12:09:08] [e(0)] core: Thread Exception: StreamMonitorRemote  critical=false    source:
    /opt/metasploit-framework/lib/metasploit/framework/thread_factory_provider.rb:25:in `spawn'
    /opt/metasploit-framework/lib/rex/thread_factory.rb:22:in `spawn'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/socket_abstraction.rb:120:in `monitor_rsock'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/stream_abstraction.rb:30:in `initialize_abstraction'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channels/socket_abstraction.rb:93:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:73:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `new'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `create'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:36:in `open'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:124:in `create_tcp_client_channel'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:93:in `create'
    /opt/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:577:in `create'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket.rb:51:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:37:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:28:in `create'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:131:in `create_tcp_connection'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:45:in `connect'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:72:in `send_request'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:119:in `send_recv'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client.rb:112:in `send_request_as'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:67:in `block in run'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `each'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `run'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:178:in `job_run_proc'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:85:in `run_simple'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:96:in `run_simple'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:80:in `block in cmd_run'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/range_walker.rb:232:in `each_host'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:75:in `cmd_run'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:532:in `run_command'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:481:in `block in run_single'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `each'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `run_single'
    /opt/metasploit-framework/lib/rex/ui/text/shell.rb:155:in `run'
    /opt/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
    /opt/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
    ./msfconsole:23:in `<main>' - Rex::Post::Meterpreter::RequestError stdapi_net_socket_tcp_shutdown: Operation failed: The handle is invalid.
[06/02/2021 12:09:09] [e(0)] core: Thread Exception: StreamMonitorRemote  critical=false    source:
    /opt/metasploit-framework/lib/metasploit/framework/thread_factory_provider.rb:25:in `spawn'
    /opt/metasploit-framework/lib/rex/thread_factory.rb:22:in `spawn'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/socket_abstraction.rb:120:in `monitor_rsock'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/stream_abstraction.rb:30:in `initialize_abstraction'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channels/socket_abstraction.rb:93:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:73:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `new'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `create'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:36:in `open'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:124:in `create_tcp_client_channel'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:93:in `create'
    /opt/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:577:in `create'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket.rb:51:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:37:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:28:in `create'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:131:in `create_tcp_connection'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:45:in `connect'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:72:in `send_request'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:119:in `send_recv'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client.rb:112:in `send_request_as'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:67:in `block in run'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `each'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `run'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:178:in `job_run_proc'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:85:in `run_simple'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:96:in `run_simple'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:80:in `block in cmd_run'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/range_walker.rb:232:in `each_host'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:75:in `cmd_run'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:532:in `run_command'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:481:in `block in run_single'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `each'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `run_single'
    /opt/metasploit-framework/lib/rex/ui/text/shell.rb:155:in `run'
    /opt/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
    /opt/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
    ./msfconsole:23:in `<main>' - Rex::Post::Meterpreter::RequestError stdapi_net_socket_tcp_shutdown: Operation failed: The handle is invalid.
[06/02/2021 12:09:10] [e(0)] core: Auxiliary failed - NoMethodError undefined method `error_code' for #<Rex::Proto::Kerberos::Model::KdcResponse:0x00007f926f90c0a0>
```

</details>


##  Web Service Errors

The following web service errors occurred before the issue occurred:
<details>
<summary>Collapse</summary>

```
msf-ws.log does not exist.
```

</details>


##  Framework Logs

The following framework logs were recorded before the issue occurred:
<details>
<summary>Collapse</summary>

```
/opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:75:in `cmd_run'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:532:in `run_command'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:481:in `block in run_single'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `each'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `run_single'
    /opt/metasploit-framework/lib/rex/ui/text/shell.rb:155:in `run'
    /opt/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
    /opt/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
    ./msfconsole:23:in `<main>' - Rex::Post::Meterpreter::RequestError stdapi_net_socket_tcp_shutdown: Operation failed: The handle is invalid.
[06/02/2021 12:09:08] [w(0)] core: monitor_rsock: exception during select: Rex::StreamClosedError Stream #<TCPSocket:0x00007f92c9f12580> is closed.
[06/02/2021 12:09:09] [e(0)] core: Thread Exception: StreamMonitorRemote  critical=false    source:
    /opt/metasploit-framework/lib/metasploit/framework/thread_factory_provider.rb:25:in `spawn'
    /opt/metasploit-framework/lib/rex/thread_factory.rb:22:in `spawn'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/socket_abstraction.rb:120:in `monitor_rsock'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-core-0.1.16/lib/rex/io/stream_abstraction.rb:30:in `initialize_abstraction'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channels/socket_abstraction.rb:93:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:73:in `initialize'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `new'
    /opt/metasploit-framework/lib/rex/post/meterpreter/channel.rb:124:in `create'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket_subsystem/tcp_client_channel.rb:36:in `open'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:124:in `create_tcp_client_channel'
    /opt/metasploit-framework/lib/rex/post/meterpreter/extensions/stdapi/net/socket.rb:93:in `create'
    /opt/metasploit-framework/lib/msf/base/sessions/meterpreter.rb:577:in `create'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket.rb:51:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:37:in `create_param'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/tcp.rb:28:in `create'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:131:in `create_tcp_connection'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:45:in `connect'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:72:in `send_request'
    /opt/metasploit-framework/lib/rex/proto/kerberos/client.rb:119:in `send_recv'
    /opt/metasploit-framework/lib/msf/core/exploit/remote/kerberos/client.rb:112:in `send_request_as'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:67:in `block in run'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `each'
    /opt/metasploit-framework/modules/auxiliary/gather/kerberos_enumusers.rb:65:in `run'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:178:in `job_run_proc'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:85:in `run_simple'
    /opt/metasploit-framework/lib/msf/base/simple/auxiliary.rb:96:in `run_simple'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:80:in `block in cmd_run'
    /opt/local/lib/ruby2.7/gems/2.7.0/gems/rex-socket-0.1.29/lib/rex/socket/range_walker.rb:232:in `each_host'
    /opt/metasploit-framework/lib/msf/ui/console/command_dispatcher/auxiliary.rb:75:in `cmd_run'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:532:in `run_command'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:481:in `block in run_single'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `each'
    /opt/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:475:in `run_single'
    /opt/metasploit-framework/lib/rex/ui/text/shell.rb:155:in `run'
    /opt/metasploit-framework/lib/metasploit/framework/command/console.rb:48:in `start'
    /opt/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
    ./msfconsole:23:in `<main>' - Rex::Post::Meterpreter::RequestError stdapi_net_socket_tcp_shutdown: Operation failed: The handle is invalid.
[06/02/2021 12:09:10] [w(0)] core: monitor_rsock: exception during select: Rex::StreamClosedError Stream #<TCPSocket:0x00007f926f94dde8> is closed.
[06/02/2021 12:09:10] [e(0)] core: Auxiliary failed - NoMethodError undefined method `error_code' for #<Rex::Proto::Kerberos::Model::KdcResponse:0x00007f926f90c0a0>
```

</details>


##  Web Service Logs

The following web service logs were recorded before the issue occurred:
<details>
<summary>Collapse</summary>

```
msf-ws.log does not exist.
```

</details>


##  Version/Install

The versions and install method of your Metasploit setup:
<details>
<summary>Collapse</summary>

```
Framework: 6.0.47-dev-5fe585df79
Ruby: ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-darwin19]
Install Root: /opt/metasploit-framework
Session Type: postgresql selected, no connection
Install Method: Git Clone
```

</details>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfirmedIssues confirmed by a committer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions