diff --git a/lib/msf/base/sessions/command_shell.rb b/lib/msf/base/sessions/command_shell.rb index ab8df3a759fd..181c118bb995 100644 --- a/lib/msf/base/sessions/command_shell.rb +++ b/lib/msf/base/sessions/command_shell.rb @@ -621,8 +621,13 @@ def run_single(cmd) end # Built-in command - if commands.key?(method) - return run_builtin_cmd(method, arguments) + if commands.key?(method) or ( not method.nil? and method[0] == '.' and commands.key?(method[1..-1])) + # Handle overlapping built-ins with actual shell commands by prepending '.' + if method[0] == '.' and commands.key?(method[1..-1]) + return shell_write(cmd[1..-1] + command_termination) + else + return run_builtin_cmd(method, arguments) + end end # User input is not a built-in command, write to socket directly