metasploit-framework icon indicating copy to clipboard operation
metasploit-framework copied to clipboard

cmd_exec: Trailing line feed in command terminates ssh session

Open bcoles opened this issue 2 months ago • 1 comments

Executing a command with a trailing new line (\n) using cmd_exec kills Linux ssh sessions.

The following will kill a SSH session (Reason: Died):

puts cmd_exec("id\n")

The same is not true for shell and Meterpreter sessions. The command is executed and the session survives.

bcoles avatar Oct 23 '25 14:10 bcoles