Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overlap of shell built-in commands with host's #19729

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sempervictus
Copy link
Contributor

When a shell session is established against a system which offers limited shells, its very common to run into something like "help" being a native command in the target. MSF now intercepts those as built-ins and presents the MSF shell help instead of letting the user see the relevant output from the target.

Implement a fix by allowing the user to prepend built-ins with '.' to pass-through execution of the intended command (such as '.help' being executed as 'help') to the target.

Testing:
Local testing with racadm SSH shell - works as intended

When a shell session is established against a system which offers
limited shells, its very common to run into something like "help"
being a native command in the target. MSF now intercepts those as
built-ins and presents the MSF shell help instead of letting the
user see the relevant output from the target.

Implement a fix by allowing the user to prepend built-ins with '.'
to pass-through execution of the intended command (such as '.help'
being executed as 'help') to the target.

Testing:
  Local testing with racadm SSH shell - works as intended
@h00die
Copy link
Contributor

h00die commented Dec 15, 2024

I think this should be added to the tips list as well.

Vcenter has a pseudo shell where shell must be run to get a real shell. Another use case

@sempervictus
Copy link
Contributor Author

Sorry a bit rusty... tips list?

@h00die
Copy link
Contributor

h00die commented Dec 15, 2024

lib/msf/ui/tip.rb it's what pops up when you start msfconsole with neat little tips and such

@sempervictus
Copy link
Contributor Author

Seems like something users can see when they try to get help from the shell session, added there for explicit visibility.

@sempervictus
Copy link
Contributor Author

Usage example:

[*] Starting interaction with 1...


racadm>>help

Meta shell commands
===================

    Command     Description
    -------     -----------
    help        Help menu
    background  Backgrounds the current shell session
    sessions    Quickly switch to another session
    resource    Run a meta commands script stored in a local file
    shell       Spawn an interactive shell (*NIX Only)
    download    Download files
    upload      Upload files
    source      Run a shell script on remote machine (*NIX Only)
    irb         Open an interactive Ruby shell on the current session
    pry         Open the Pry debugger on the current session
    .<command>  Prefix any built-in command on this list with a '.' to execute in the underlying shell (ex: .help)

For more info on a specific command, use <command> -h or help <command>.

     

racadm>>.help
help
 
 help                 -- Display list of RACADM sub commands with help string
 help [subcommand]    -- display usage summary for a subcommand
 arp                  -- display the networking ARP table
 autoupdatescheduler  -- Automatic Platform Update of the devices on the server.
 bezelfilter          -- perform a Bezel Filter Life reset operation
 bioscert             -- Secure Boot Certificate Management operations
 biosscan             -- Performs BIOS live scanning or creates a recurrent job for live scanning.
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants