Skip to content

Instantly share code, notes, and snippets.

@dibsy
Forked from PSJoshi/rbash-escape.md
Created July 10, 2023 18:14
Show Gist options
  • Select an option

  • Save dibsy/bde4e8a5e397461dab210c2cab86bc12 to your computer and use it in GitHub Desktop.

Select an option

Save dibsy/bde4e8a5e397461dab210c2cab86bc12 to your computer and use it in GitHub Desktop.
Escape from rbash to bash shell

Change rbash to bash

psj@ubuntu:~$ ssh psj@server_name-t "bash --noprofile"

List available commands:

$ compgen -c 

Essentially you need to do the following:

a) start bash without source'ing either ~/.bashrc or ~/.bash_profile 
b) since such a shell wouldn't be a full login shell / have no tty attached, force ssh to attach a tty:

Good presentation on rbash escape

Other interesting links for Rbash hardening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment