Fastest Privesc on Grub
Context
During Networking Security class, i had a lab with seven servers on a Proxmox created by our teacher without a root user.
After reporting all privilege escalations with sudo
commands, my teacher decided to disable all the sudo
commands until he could find a solution.
Unfortunately, it was not enough.
Privesc
Grub is a boot loader that allows you to choose which operating system to boot.
It was installed on the servers, and I could edit startup scripts :
|
|
In our case, the LVM was not encrypted, so we could access files by spawning a root shell :
|
|
Just change ro
(read_only) to rw
(read-write) and add init=/bin/bash at the end of the line, then reboot the server.
|
|
We can now access the root user.
|
|
Conclusion
Please encrypt your LVMs. Imagine it was not a lab, but an enterprise laptop with confidential documents.
When you encrypt LVM you can’t read files when changing ro
to rw
in the grub file, passphrase is required.