Sudo Fail2ban Privilege Escalation
Sudo fail2ban command might be vulnerable to privilege escalation (PrivEsc).
Fail2ban is an intrusion prevention software framework. It prevents against brute force attacks.
If we can execute "fail2ban" as root, we can gain access to privileges by modifying the configuration file. We need to check if the config file is writable.
Look inside of "/etc/fail2ban/jail.conf" to know more about how fail2ban is configured.
For privilege escalation, we need to update the "iptables-multiport.conf". Specifically, insert a payload to one of the following values.
actionstart
actionstop
actioncheck
actionban
actionunban
Here update the value of actionban which triggers ban on multiple login attempts. Copy iptables-multiport.conf to the current user's home directory.
Now modify the file.
We insert a reverse shell payload into the actionban.
Then move back the config file to the original one.
To apply the new configuration, restart it as root.
Start a listener in local machine.
Try to login with the wrong passwords multiple times until we will get banned. So that to, hydra is useful.
After a short time, you will get a root shell via listener.
Last updated