arnaucaso01/detection-engineering
GitHub: arnaucaso01/detection-engineering
一个针对 Active Directory 环境中 Kerberoasting 攻击的多层检测工程实验室,提供 Sigma 规则、SIEM 查询和 PowerShell 检测脚本。
Stars: 0 | Forks: 0
# 检测工程实验室:Kerberoasting 多层检测
## 概述
本项目演示了在 Active Directory 环境中对 Kerberoasting 攻击的多层检测方法。
该实验室结合了以下组件:
- 蜜罐服务账户
- 转换为 Splunk 和 Elastic EQL 的 Sigma 规则
- 具有多层检测功能的 PowerShell 检测脚本
所有检测均基于 Windows 事件 ID 4769(Kerberos 服务票据请求)。
## 实验室环境
| 组件 | IP | 操作系统 | 角色 |
|-----------|----|----|------|
| DC01 | 192.168.100.50 | Windows Server 2022 | 域控制器 |
| Kali | 192.168.100.10 | Kali Linux | 攻击机 |
| Windows 10 | 192.168.100.30 | Windows 10 | 域客户端 |
### 域信息
- 域:`homelab.local`
- 服务账户:`svc_sql`
- 蜜罐 SPN:`MSSQLSvc/fake.homelab.local`
## 检测层
### 1. Sigma 规则 – RC4 加密检测
此规则检测使用 RC4 加密(0x17)的 TGS 请求,这种加密方式在 Kerberoasting 攻击中经常使用。
```
title: Kerberoasting - RC4 Encryption Detected
id: 7b1a2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects TGS requests with RC4 encryption used in Kerberoasting attacks.
references:
- https://attack.mitre.org/techniques/T1558/003/
logsource:
product: windows
service: security
detection:
selection:
EventID: 4769
TicketEncryptionType: 0x17
filter:
ServiceName|startswith:
- 'cifs'
- 'host'
condition: selection and not filter
level: medium
tags:
- attack.t1558.003
```
### Splunk 查询
```
source="WinEventLog:Security" EventCode=4769 TicketEncryptionType=23 NOT (ServiceName IN ("cifs*", "host*"))
```
### Elastic EQL 查询
```
any where winlog.channel:"Security" and (event.code:"4769" and winlog.event_data.TicketEncryptionType:"23" and not (service.name like~ ("cifs*", "host*")))
```
## 2. 蜜罐服务账户检测
一个伪造的 SPN(`MSSQLSvc/fake.homelab.local`)被附加到一个虚拟服务账户上。
对该 SPN 的任何请求均被视为可疑行为,可能表明存在 Kerberoasting 活动。
### Sigma 规则
```
title: Honeypot Service Account Access
id: 9d4e5f6a-7b8c-9d0e-1f2a-3b4c5d6e7f8a
status: experimental
description: Detects TGS requests to the honeypot SPN.
logsource:
product: windows
service: security
detection:
selection:
EventID: 4769
ServiceName: "MSSQLSvc/fake.homelab.local"
condition: selection
level: critical
tags:
- attack.t1558.003
```
### Splunk 查询
```
source="WinEventLog:Security" EventCode=4769 ServiceName="MSSQLSvc/fake.homelab.local"
```
## 3. PowerShell 多层检测脚本
`Detect-Kerberoasting.ps1` 脚本在域控制器上运行,执行以下操作:
- 检测 RC4 加密使用情况(0x17)
- 检测蜜罐 SPN 访问
- 检测来自同一 IP 的异常 TGS 请求量
该脚本旨在使用原生 Windows 日志模拟简单的 SOC 风格检测逻辑。
## 攻击模拟
从 Kali Linux 使用 Impacket 模拟了 Kerberoasting 活动。
```
impacket-GetUserSPNs homelab.local/USERNAME:PASSWORD -dc-ip 192.168.100.50 -request
```
这为实验室中配置的服务账户生成了 Kerberos TGS 请求。
## 截图
### PowerShell 检测脚本输出

### 事件 ID 4769 RC4 检测

### Sigma 蜜罐规则转换

### Kerberoasting 攻击哈希

## SIEM 集成
Sigma 规则已转换为:
- Splunk 查询
- Elastic EQL 查询
这使得检测规则可以在不同的 SIEM 平台中重复使用。
## 展示的技能
- 检测工程
- Active Directory 安全
- Kerberos 认证分析
- Windows 事件日志分析
- Sigma 规则创建
- SIEM 查询
- 威胁检测
- PowerShell 脚本编写
## 参考资料
- MITRE ATT&CK T1558.003 – Kerberoasting
- Microsoft 事件 ID 4769 文档
- Sigma Rules 项目
标签:Active Directory, AI合规, Elastic EQL, HTTP, Kerberoasting, MITRE ATT&CK映射, Plaso, PowerShell检测脚本, RC4加密检测, Sigma规则, SPN, T1558.003, Terraform 安全, TGS请求, URL发现, Windows事件ID 4769, 域控制器, 多检测层, 安全检测, 安全运营, 扫描框架, 混合加密, 目标导入, 蓝队防御, 蜜罐服务账户