Skip to content

Commit 5f56a08

Browse files
authored
Document pentesting Kafka with Nmap and scripts
Added a section on pentesting Kafka, including usage of Nmap and a script for enumerating brokers.
1 parent cc5b1d2 commit 5f56a08

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

Cloud.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ In Jira, privileges can be checked by any user, authenticated or not, through th
641641
curl https://org.atlassian.net/rest/api/2/mypermissions | jq | grep -iB6 '"havePermission": true'
642642
```
643643

644-
## Kafka Recon
644+
## Pentesting Kafka
645645

646646
Use Nmap to detect Kafka brokers and check for open ports:
647647

@@ -664,6 +664,26 @@ Metadata for all topics (from broker -1: target.com:9092/bootstrap):
664664
topic "__consumer_offsets" with 50 partitions:
665665
```
666666

667+
Enumerating brokers script:
668+
669+
```sh
670+
#!/usr/bin/env bash
671+
672+
TARGET=$1
673+
PORT=${2:-9092}
674+
675+
if [ -z "$TARGET" ]; then
676+
echo "Usage: $0 <target.com>"
677+
exit 1
678+
fi
679+
680+
# Read all topics
681+
for topic in $(kcat -b $TARGET:$PORT -L | grep topic | awk '{print $2}' | sed 's/"//g'); do
682+
echo "[*] Topic: $topic"
683+
kcat -b $TARGET:$PORT -t $topic -C -c 10
684+
done
685+
```
686+
667687
Save messages for offline analysis;
668688

669689
```sh

0 commit comments

Comments
 (0)