matheuscybersec/siem-honeypot-wazuh-cowrie

GitHub: matheuscybersec/siem-honeypot-wazuh-cowrie

一个集成了 Cowrie 蜜罐和 Wazuh SIEM 的蓝队实验室,用于捕获恶意 SSH 活动并实践检测工程与威胁狩猎。

Stars: 0 | Forks: 0

🇺🇸 English | [🇧🇷 Português](README.pt-BR.md) # SIEM Honeypot — Wazuh + Cowrie 一个面向互联网的蓝队实验室,使用 Cowrie 捕获恶意的 SSH 活动,通过 Wazuh 进行分析,结合 MITRE ATT&CK 和 GeoIP 丰富告警信息,并通过 SOC 和 Threat Hunting 仪表板支持安全调查。

SIEM Honeypot architecture

## 结果概览 七天历史快照: | 指标 | 结果 | |---|---:| | 观察到的事件 | **44,000+** | | 唯一可见源 IP | **180+** | | 通过 GeoIP 识别的国家 | **29** | | 观察到的 SSH 会话 | **8,000+** | | 自定义 Wazuh 规则 | **14** | | 最终健康检查 | **26 PASS / 0 WARN / 0 FAIL** | 这些数值是受时间限制的快照,会随着过滤器、保留策略和新的互联网活动而变化。 ## 项目亮点 - Cowrie 在 `TCP/22` 上公开暴露。 - 管理 OpenSSH 隔离在 `TCP/22222`。 - Wazuh Dashboard 限制在 `TCP/443`。 - Cowrie 通过 `authbind` 作为非 root 服务运行。 - 直接将 JSON 从 Cowrie 输入到 Wazuh。 - 自定义检测 `100100–100113`。 - MITRE ATT&CK 和 GeoIP 数据扩充。 - SOC 概览、全球攻击地图和 Threat Hunting 仪表板。 - 通过 `data.session` 进行会话重建。 - 使用 `INPUT → SIEM_INPUT → REJECT` 的持久主机防火墙。 - 运维备份、恢复文档和健康检查。 - 捕获的 payload 已保留,未执行。 ## 架构 ``` Internet | +--> TCP/22 ------> Cowrie SSH Honeypot | | | v | cowrie.json | | | v | Wazuh Logcollector | | | v | Wazuh Analysis | | | custom rules + MITRE ATT&CK | | | v | Filebeat | | | GeoIP enrichment | | | v | Wazuh Indexer | | | v | Wazuh Dashboard | +--> TCP/22222 --> Administrative OpenSSH | +--> TCP/443 ----> Wazuh Dashboard ``` | 服务 | 端口 | 暴露范围 | |---|---:|---| | Cowrie | `22/TCP` | 公开 | | 管理 OpenSSH | `22222/TCP` | 仅限 `/32` | | Wazuh Dashboard | `443/TCP` | 仅限 `/32` | | Wazuh Indexer | `9200/TCP`, `9300/TCP` | 本地 | | Wazuh 内部服务 | `1514/TCP`, `1515/TCP`, `55000/TCP` | 非故意公开 | [阅读架构文档](docs/architecture.md) ## 技术栈 ``` Oracle Cloud Infrastructure Ubuntu Server 24.04 LTS ARM64 / AArch64 Cowrie Wazuh 4.14.6 Filebeat OpenSearch Dashboard and Maps MITRE ATT&CK GeoIP PCRE2 systemd iptables-nft Bash jq ``` ## 数据流

SIEM Honeypot data flow

``` attacker interaction -> Cowrie JSON -> Wazuh collection and analysis -> custom detection -> MITRE and GeoIP enrichment -> indexed alert -> dashboard and Threat Hunting ``` 主要调查字段: ``` data.eventid data.src_ip data.session data.username data.input data.filename data.shasum rule.id rule.level rule.mitre.id timestamp ``` ## 检测工程 生产环境使用了 14 条自定义 Wazuh 规则: | 规则 | 级别 | 检测内容 | MITRE | |---:|---:|---|---| | `100100` | 3 | 新的 SSH 连接 | — | | `100101` | 5 | 登录失败 | `T1110` | | `100102` | 7 | Honeypot 接受登录 | `T1078` | | `100103` | 8 | 通用 Cowrie 命令 | `T1059.004` | | `100104` | 4 | 会话关闭 | — | | `100105` | 10 | 系统信息发现 | `T1082` | | `100106` | 12 | 自动化指纹识别 | `T1082` | | `100107` | 12 | 入站工具传输 | `T1105` | | `100108` | 13 | Payload 执行 | `T1059.004` | | `100109` | 12 | 持久化 | `T1053.003`, `T1098.004`, `T1543.002` | | `100110` | 13 | 防御规避 | `T1070.003`, `T1562.001` | | `100111` | 13 | 凭据访问 | `T1003.008`, `T1552.004` | | `100112` | 12 | SSH/SFTP 文件上传 | `T1105` | | `100113` | 13 | 使用 `nohup` 在后台执行 | `T1059.004` | 规则 `100103` 仍然是通用的命令捕获规则。更具体的子规则用于对更高价值的行为进行分类。 验证工作流: ``` syntax validation -> positive test -> negative test -> Manager restart -> production telemetry review ``` 公开规则展示: [查看脱敏后的规则](rules/local_rules_sanitized.xml) 详细方法论: [阅读检测工程](docs/detection-engineering.md) ## MITRE ATT&CK

Observed attack lifecycle

ATT&CK 映射描述了遥测数据所代表的行为。它们不能确定威胁行为者的身份、恶意软件家族、活动归属,或真实主机是否被成功攻陷。 [阅读 ATT&CK 映射指南](docs/mitre-attck.md) ## Threat Hunting 使用的调查工作流: ``` source IP -> session ID -> chronological timeline -> command input -> Wazuh classification -> facts, inferences, and limitations ``` `data.session` 对于关联属于同一 Cowrie 交互的连接、身份验证、命令、上传和关闭事件至关重要。 [阅读 Threat Hunting 指南](docs/threat-hunting.md) ## 案例研究 ### 自动化凭据填充与指纹识别 重复的短会话不断轮换用户名,执行相同的 `uname` 发现命令,并立即关闭。 [阅读案例研究](case-studies/credential-spraying.md) ### Payload 下载、执行与清理 复合命令尝试了以下操作: ``` wget -> curl fallback -> chmod -> sh -> cleanup ``` Wazuh 将该行为归类为规则 `100108`,级别 13。 [阅读案例研究](case-studies/payload-execution.md) ### SSH/SFTP 上传与 `nohup` 直接文件上传之后执行了: ``` chmod +x -> nohup execution request -> background operator ``` 调查产生了规则 `100112` 和 `100113`。 [阅读案例研究](case-studies/sftp-upload-nohup.md) ## 仪表板 ### SOC 概览 - Cowrie 告警总数; - 唯一源 IP; - GeoIP 国家数量; - 唯一 SSH 会话; - 攻击时间轴; - Top 源 IP; - MITRE 活动; - 严重性分布; - 自定义规则分布; - 全球攻击地图。 ### Threat Hunting 仪表板 - Payload 执行 KPI; - 工具传输 KPI; - Honeypot 接受的登录; - 唯一会话; - MITRE 活动; - Top 用户名; - 单个事件的 Saved Search。 [阅读仪表板指南](docs/dashboards.md) ## 加固与运维 最终的 OpenSSH 控制: ``` Port 22222 PermitRootLogin no PasswordAuthentication no PubkeyAuthentication yes X11Forwarding no AllowTcpForwarding no ``` 持久化 IPv4 策略: ``` INPUT -> SIEM_INPUT -> allow established traffic -> allow loopback and ICMP -> restrict TCP/22222 and TCP/443 -> expose Cowrie TCP/22 -> reject everything else ``` Cowrie 以非特权用户 `cowrie` 的身份运行,并通过 `authbind` 绑定到 TCP/22。 公开的运维脚本: - [SIEM 健康检查](scripts/siem-healthcheck.sh) - [脱敏防火墙策略](scripts/apply-siem-firewall-sanitized.sh) 文档: - [安全加固](docs/hardening.md) - [运维](docs/operations.md) - [备份与恢复](docs/backup-and-recovery.md) - [事件恢复](docs/incident-recovery.md) ## 安全边界 ``` Cowrie login success != real Ubuntu compromise ``` ``` Cowrie command input != command executed on the real host ``` ``` GeoIP != operator identity or nationality ``` 公开存储库排除了: - 私有 SSH 密钥和密码; - Wazuh 和 OCI 凭据; - 管理员和活跃的基础设施地址; - 捕获的凭据对; - 活跃的恶意 URL; - Payload 二进制文件; - 完整的原始日志; - 私有备份; - 私有会话标识符。 ## 已知限制 - 单节点 Wazuh 和 Cowrie 部署。 - 共享计算和存储资源。 - 故意公开的 Cowrie 服务。 - 基于文档的全球攻击地图,没有原生集群。 - GeoIP 提供的是近似的网络上下文。 - 完整命令仍然是高基数数据。 - 某些规则族可以进一步拆分,以实现更精确的 ATT&CK 映射。 [阅读所有限制](docs/limitations.md) ## 存储库结构 ``` . ├── README.md ├── LICENSE.md ├── docs/ ├── rules/ │ └── local_rules_sanitized.xml ├── scripts/ │ ├── siem-healthcheck.sh │ └── apply-siem-firewall-sanitized.sh ├── case-studies/ │ ├── credential-spraying.md │ ├── payload-execution.md │ └── sftp-upload-nohup.md ├── diagrams/ │ ├── architecture.png │ ├── data-flow.png │ └── attack-lifecycle.png └── screenshots/ ├── 01-soc-overview.png ├── 02-soc-overview-2.png ├── 03-threat-hunting-dashboard.png ├── 04-discover.png ├── 05-threat-hunting-events.png ├── 06-rules.png ├── 07-health-check.png └── 08-health-check-2.png ``` ## 文档索引 | 领域 | 文档 | |---|---| | 架构 | [架构](docs/architecture.md), [部署](docs/deployment.md), [网络](docs/networking.md) | | 组件 | [Cowrie](docs/cowrie.md), [Wazuh](docs/wazuh.md), [GeoIP](docs/geoip.md) | | 检测 | [检测工程](docs/detection-engineering.md), [MITRE ATT&CK](docs/mitre-attck.md) | | 调查 | [仪表板](docs/dashboards.md), [Threat Hunting](docs/threat-hunting.md) | | 运维 | [安全加固](docs/hardening.md), [运维](docs/operations.md), [备份与恢复](docs/backup-and-recovery.md) | | 弹性 | [事件恢复](docs/incident-recovery.md), [限制](docs/limitations.md), [经验教训](docs/lessons-learned.md) | ## 状态 ``` Infrastructure Complete Cowrie deployment Complete Wazuh integration Complete GeoIP enrichment Complete Detection Engineering Complete Threat Hunting Complete SOC Overview Complete World Attack Map Complete Threat Hunting Dashboard Complete Hardening Complete Health check and backups Complete Public documentation Complete ``` ## 作者 **Matheus Paes** 信息安全与软件工程专业学生,专注于蓝队、SOC、检测工程、Threat Hunting、Linux 和云安全。 [LinkedIn](https://www.linkedin.com/in/matheus-cybersec/) ## 许可证 在 MIT 许可证下发布。 [阅读许可证](LICENSE.md)
标签:Wazuh, 应用安全, 蜜罐, 证书利用