dirtyfilthy/metassh — Issue #6: Concurrent meterpreter session breaks metassh and framework
Author: sempervictus
Created: 2012-01-31 19:52:58+00:00
State: open

Seeing the following behavior:
establish ssh session with host, enter shell, get normal metass shell within the metassh session.
establish reverse tcp meterpreter session, go back to metassh, enter 'shell' and it hangs
This also stops execution of 'pwd' from metassh session, port forwarding, etc.

Stack trace when running shell with a meterpreter session in the framework:

metaSSH > shell
Channel 2 created.

^C
Terminate channel 2? [y/N] [-] Error running command shell: Interrupt
/opt/metasploit4/msf4/lib/rex/ui/text/input/readline.rb:58:in `sysread'
/opt/metasploit4/msf4/lib/rex/ui/text/input/readline.rb:58:in `sysread'
/opt/metasploit4/msf4/lib/rex/ui/interactive.rb:288:in `prompt'
/opt/metasploit4/msf4/lib/rex/ui/interactive.rb:296:in `prompt_yesno'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/rex/post/meta_ssh/ui/console/interactive_channel.rb:35:in `_interrupt'
/opt/metasploit4/msf4/lib/rex/ui/interactive.rb:54:in `rescue in interact'
/opt/metasploit4/msf4/lib/rex/ui/interactive.rb:47:in `interact'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/rex/post/meta_ssh/ui/console.rb:82:in `interact_with_channel'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/rex/post/meta_ssh/ui/console/command_dispatcher/stdapi/sys.rb:100:in `cmd_execute'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/rex/post/meta_ssh/ui/console/command_dispatcher/stdapi/sys.rb:110:in `cmd_shell'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:380:in `run_command'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/rex/post/meta_ssh/ui/console.rb:99:in `run_command'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:342:in `block in run_single'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:336:in `each'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:336:in `run_single'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/rex/post/meta_ssh/ui/console.rb:63:in `block in interact'
/opt/metasploit4/msf4/lib/rex/ui/text/shell.rb:189:in `call'
/opt/metasploit4/msf4/lib/rex/ui/text/shell.rb:189:in `run'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/rex/post/meta_ssh/ui/console.rb:61:in `interact'
/opt/metasploit4/msf4/plugins/meta_ssh/lib/msf/base/sessions/meta_ssh.rb:270:in `_interact'
/opt/metasploit4/msf4/lib/rex/ui/interactive.rb:48:in `interact'
/opt/metasploit4/msf4/lib/msf/ui/console/command_dispatcher/core.rb:1565:in `cmd_sessions'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:380:in `run_command'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:342:in `block in run_single'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:336:in `each'
/opt/metasploit4/msf4/lib/rex/ui/text/dispatcher_shell.rb:336:in `run_single'
/opt/metasploit4/msf4/lib/rex/ui/text/shell.rb:199:in `run'
/usr/local/sbin/msfconsole:134:in `

'

Framework will also fail to close the channels/threads. I remember seeing a trace which stated that Thread.kill was called which doesnt exist. Will investigate further, but has anyone else seeing this behavior?