Reputation: 35
On a recent penetration test it was identified that the rbash restricted shell we use could be escaped by simply forcing allocation of a pseudo terminal.
ssh -i id_rsa_key user@hostname -t "bash --noprofile"
I have done a fair amount of research and haven't been able to find anything regarding how to prevent this via an ssh config or other process. Any suggestions on how to lock this down would be greatly appreciated.
Upvotes: 0
Views: 2263
Reputation: 35
Finally found a fix using a method found here:
How to restrict SSH users to a predefined set of commands after login?
You can restrict allocation of the PTY using a directive in the authorized_key file.
no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1.......
Upvotes: 1