You have access to the vim text editor via sudo, but shell escapes are blocked. How do you escalate privileges to get an unfettered root shell without sudo?

#Linux #DFIR #CommandLine #Trivia

@hal_pomeranz Edit /etc/sudoers?
@piquant00
I have a similar issue in an old pc. Can't find the password for sudo.
Can't update Linux, can't even reinstall it since I can't boot from the USB pretty crazy
#linuxhelp
@hal_pomeranz
@away2thestars @piquant00 https://linoxide.com/boot-root-shell-prompting-password/ - Once you are at the root prompt, edit /etc/shadow and remove the password hash for the root account. Reboot the system normally and you will be able to log in as root without entering a password.
How to Boot into Root Shell without Password

How to boot into root shell in linux without entering the password. Command line root recovery by entering in single user mode for maintenance.

LinOxide
@hal_pomeranz @piquant00 how can I get the root prompt though since there isnt/haven't got passwd to root 🥲
@away2thestars @piquant00 Just enter "root" as your username to log in, or if you're logged in as a regular user just use "su".
@hal_pomeranz
I wrote su->entered password ->authentication failure
@piquant00
@away2thestars If you properly removed the password hash for the root account in /etc/shadow you should not even be prompted for a password.
@hal_pomeranz
I can see a shadow file I can't edit it since I'm not root
@away2thestars Oh I understand now. You need to reboot your system (power it off and on if necessary) and follow the advice in the original article I linked to. You will boot into a bash shell running as root and can edit /etc/shadow from there.

@away2thestars @hal_pomeranz

"su" doesn't work on *buntu which has the root account disabled by default.