Junaidpk07/PassTheHash-LateralMovement-ThreatHunt
GitHub: Junaidpk07/PassTheHash-LateralMovement-ThreatHunt
一套生产就绪的威胁狩猎检测规则集,覆盖多平台SIEM,旨在帮助企业检测和狩猎针对Windows环境的Pass-the-Hash横向移动攻击。
Stars: 0 | Forks: 0
# PassTheHash-横向移动-威胁狩猎
Pass-the-Hash 横向移动狩猎:Splunk SPL + Sentinel KQL + CrowdStrike 查询 (T1550.002)。包含生产级 SIEM 规则。
针对 Pass-the-Hash (PtH) 横向移动的生产级检测查询 —— 涵盖 Splunk SPL、Microsoft Sentinel KQL 和 CrowdStrike NG-SIEM。映射至 MITRE ATT&CK T1550.002。
# PassTheHash-横向移动-威胁狩猎





## 目录
- [什么是 Pass-the-Hash?](#what-is-pass-the-hash)
- [PtH 工作原理 — 逐步解析](#how-pth-works--step-by-step)
- [狩猎目标](#what-to-hunt-for)
- [ATT&CK 覆盖范围](#attck-coverage)
- [日志源要求](#log-source-requirements)
- [检测查询](#detection-queries)
- [Splunk SPL](#splunk-spl)
- [Microsoft Sentinel KQL](#microsoft-sentinel-kql)
- [CrowdStrike NG-SIEM](#crowdstrike-ng-siem)
- [误报调优](#false-positive-tuning)
- [分类排查清单](#triage-checklist)
- [设置与要求](#setup--requirements)
- [仓库结构](#repository-structure)
- [贡献](#contributing)
- [参考](#references)
## 什么是 Pass-the-Hash?
Pass-the-Hash (PtH) 是一种攻击技术,攻击者从内存中**窃取用户密码的 NTLM 哈希**(例如通过 Mimikatz),并直接使用该哈希进行身份验证 —— 而无需知道明文密码。
这使得攻击者能够:
- 在网络中横向移动到其他机器
- 冒充特权用户(例如本地 Administrator)
- 在依赖 NTLM 的环境中绕过多因素身份验证
PtH 被归类于 **MITRE ATT&CK T1550.002 — 使用替代身份验证材料:Pass the Hash**。
## PtH 工作原理 — 逐步解析
了解攻击链有助于您明确检测重点:
```
[Step 1] Initial Access
Attacker compromises one endpoint (phishing, exploit, etc.)
[Step 2] Credential Harvesting
Attacker dumps NTLM hashes from LSASS memory
Tools: Mimikatz, Impacket secretsdump, CrackMapExec
[Step 3] Hash Reuse (The Attack)
Attacker crafts an NTLM authentication using the stolen hash
No password cracking required — the hash IS the credential
[Step 4] Lateral Movement
Attacker authenticates to another machine (SMB, WMI, PsExec)
Appears as a legitimate network logon (Event ID 4624)
[Step 5] Privilege Escalation / Persistence
If hash belongs to Domain Admin or local Admin → full control
```
**防御者的关键洞察:** PtH 总是产生**使用 NTLM 的网络登录 (Type 3)** —— 这是主要的检测信号。现代环境中的普通用户通常通过 Kerberos 而非 NTLM 进行身份验证。
## 狩猎目标
这些是您需要在日志中寻找的主要指标:
### 1. 没有事先交互式会话的 NTLM 网络登录
- **事件 ID 4624**,且 `LogonType=3` 且 `AuthenticationPackageName=NTLM`
- 同一用户在源机器上没有相应的事件 ID 4648 或 4624 Type 2(交互式)
- 这是**主要检测信号**
### 2. 工作站到工作站的登录(横向移动模式)
- 源 IP 是另一台**工作站**,而不是服务器或域控制器
- 用户账户正在验证他们通常不访问的机器
- 查找 `WorkstationName` ≠ `TargetServerName`
### 3. 使用内置或本地 Administrator 账户
- RID 500(本地 Administrator)被用于网络身份验证
- 本地账户(非域账户)通过网络进行身份验证
- `TargetUserName` = `Administrator` 且 `LogonType=3`
### 4. 可疑的会话特征
- `LogonProcessName = NtLmSsp`(NTLM Security Support Provider —— 基于哈希的身份验证标志)
- `KeyLength = 0`(表示没有会话密钥 —— 在 PtH 中常见)
- `WorkstationName` 字段为空或不匹配
### 5. 大量横向身份验证
- 单个源 IP 在短时间内向多台主机进行身份验证
- 多次登录失败(事件 ID 4625)后跟一次成功的 4624
- CrackMapExec/Impacket 喷射模式
### 6. 基于进程的指标 (Endpoint)
- 非系统进程对 `lsass.exe` 的内存读取(Sysmon 事件 ID 10)
- 命令行日志中包含 `sekurlsa` 或 `mimikatz` 字符串
- 身份验证后从意外父进程派生出 `cmd.exe` 或 `powershell.exe`
## ATT&CK 覆盖范围
| ATT&CK ID | 技术 | 子技术 | 战术 | 覆盖范围 |
|-----------|-----------|---------------|--------|----------|
| T1550.002 | 使用替代身份验证材料 | Pass the Hash | 横向移动 | ✅ 完整 |
| T1078.002 | 有效账户 | 域账户 | 防御规避 | ✅ 部分 |
| T1550 | 使用替代身份验证材料 | (父级) | 横向移动 | ✅ 完整 |
| T1003.001 | 操作系统凭证转储 | LSASS 内存 | 凭证访问 | ✅ 部分 |
| T1021.002 | 远程服务 | SMB/Windows 管理共享 | 横向移动 | ✅ 部分 |
## 日志源要求
### Windows 事件日志 (最低要求)
| 事件 ID | 日志通道 | 描述 | 重要原因 |
|----------|-------------|-------------|----------------|
| 4624 | Security | 账户登录成功 | 核心检测 —— NTLM Type 3 登录 |
| 4625 | Security | 账户登录失败 | PtH 发生前的喷洒检测 |
| 4648 | Security | 使用了显式凭证 | 检测替代凭证的使用 |
| 4672 | Security | 分配了特殊权限 | 管理员级别的 PtH 提权 |
| 4768 | Security | 请求 Kerberos TGT | 缺少 Kerberos = 强制使用 NTLM |
| 4776 | Security | NTLM 凭证验证 | 确认 DC 上的 NTLM 使用情况 |
### Sysmon (强烈建议)
| 事件 ID | 描述 | 重要原因 |
|----------|-------------|----------------|
| 10 | 进程访问 (读取 LSASS) | 凭证窃取检测 |
| 1 | 进程创建 | 检测 Mimikatz、PsExec 等 |
| 3 | 网络连接 | 横向移动网络流量 |
### 审核策略要求
确保在所有端点和 DC 上**启用**以下审核策略:
```
Audit Logon Events → Success + Failure
Audit Account Logon Events → Success + Failure
Audit Privilege Use → Success
Audit Process Creation → Success
```
用于验证的 PowerShell 命令:
```
auditpol /get /subcategory:"Logon","Account Logon","Privilege Use","Process Creation"
```
## 检测查询
### Splunk SPL
检测来自单个源并命中多个主机的 NTLM Type 3 网络登录 —— 这是主要的 PtH 横向移动信号。
### Microsoft Sentinel KQL
## 误报调优
在生产环境中部署这些规则之前,请排除以下常见的误报:
### 已知的良性 NTLM 来源
| 来源 | 原因 | 建议操作 |
|--------|--------|--------------------|
| SCCM / MECM 服务器 | 使用 NTLM 进行软件部署 | 白名单 SCCM 服务器 IP |
| 备份代理 (Veeam, Commvault) | 通过 NTLM 验证以访问共享 | 白名单备份服务器 IP + 服务账户 |
| 打印机 / MFDs | 使用 NTLM 进行扫描到文件夹操作 | 白名单设备 IP |
| 旧版应用程序 | 较旧的应用程序不支持 Kerberos | 白名单已知的应用程序服务账户 |
| 域控制器 (DC 到 DC) | 某些配置中使用 NTLM 进行复制 | 白名单 DC IP 范围 |
| 监控工具 (PRTG, SolarWinds) | 通过 NTLM 轮询端点 | 白名单监控服务器 IP |
### 调优模板 (Splunk)
```
| where NOT (src_ip IN ("10.0.1.5","10.0.1.6"))
| where NOT (TargetUserName IN ("svc_backup","svc_sccm","svc_monitoring"))
| where NOT (WorkstationName IN ("BACKUPSRV01","SCCMSRV01"))
```
### 调优模板 (KQL)
```
| where IpAddress !in ("10.0.1.5", "10.0.1.6")
| where TargetUserName !in~ ("svc_backup", "svc_sccm", "svc_monitoring")
| where WorkstationName !in~ ("BACKUPSRV01", "SCCMSRV01")
```
### 使用基线减少噪音
在启用告警之前,先在**检测模式**下运行查询 1 两周。收集:
- 哪些源 IP 经常使用 NTLM Type 3 登录
- 哪些服务账户出现频繁
- 每个用户每小时正常的 `unique_targets` 数量是多少
然后根据高于基线 2-3 倍的数据设置您的阈值。
## 分类排查清单
当触发告警时,请遵循以下步骤:
```
[ ] 1. Confirm NTLM Type 3 logon on source IP — is it a user machine or a server?
[ ] 2. Check if the user has any Interactive (Type 2) logon in the same window → if not, suspicious
[ ] 3. Look up the source IP → is it expected to authenticate to that destination?
[ ] 4. Check for Event ID 4625 (failed logons) just before the 4624 → spray pattern?
[ ] 5. Search Sysmon Event ID 10 on the source host → any LSASS access in the last 24h?
[ ] 6. Check for Mimikatz / Impacket strings in process command-line logs on source
[ ] 7. Is the authenticating account a local admin (RID 500) or domain account?
[ ] 8. Did the destination machine have any outbound connections after the logon?
[ ] 9. Correlate with EDR telemetry for lateral tool transfer (Sysmon 11 file creation)
[ ] 10. Escalate if: multiple hosts hit + LSASS access + admin account = HIGH CONFIDENCE PtH
```
## 设置与要求
### Splunk 要求
- **版本:** Splunk 8.x+
- **索引:** `wineventlog`、`sysmon`
- **应用:** Windows TA (`Splunk_TA_windows`) 已正确配置
- **CIM:** 确保 `Authentication` 数据模型已加速以加快搜索速度
### Microsoft Sentinel 要求
- **表:** `SecurityEvent`、`SysmonEvent`(通过 Azure Monitor Agent)
- **连接器:** Windows Security Events 连接器(旧版或 AMA)
- **UEBA:** 启用以进行 `TargetUserName` 实体丰富
- **工作区:** 确保审核策略转发了 4624、4625、4648、4672、4768、4776
### CrowdStrike 要求
- **Sensor 版本:** 6.x+
- **数据:** 确保启用了 `UserLogon` 和 `ProcessRollup2` 事件类型
- **模块:** 需要 Falcon Insight (EDR) 以获取进程级事件
## 仓库结构
```
PassTheHash-LateralMovement-ThreatHunt/
├── splunk/
│ ├── pth_primary_detection.spl
│ ├── pth_local_admin.spl
│ └── pth_lsass_access.spl
├── sentinel/
│ ├── pth_primary_detection.kql
│ ├── pth_kerberos_absence.kql
│ └── pth_analytics_rule.kql
├── crowdstrike/
│ ├── pth_ntlm_lateral.ql
│ └── pth_lsass_injection.ql
├── sigma/
│ └── pth_lateral_movement.yml
├── docs/
│ └── false_positive_baseline.md
└── README.md
```
## 参考
- [MITRE ATT&CK T1550.002 — Pass the Hash](https://attack.mitre.org/techniques/T1550/002/)
- [Microsoft 安全事件 ID 4624](https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4624)
- [Impacket — Pass-the-Hash 工具](https://github.com/SecureAuthCorp/impacket)
- [Sigma 规则项目](https://github.com/SigmaHQ/sigma)
- [Windows NTLM 身份验证概述](https://docs.microsoft.com/en-us/windows-server/security/kerberos/ntlm-overview)
*由 [@Junaidpk07](https://github.com/Junaidpk07) 维护 — 最后验证时间:2025 年 5 月*
标签:CrowdStrike, EDR, KQL, Microsoft Defender, Mimikatz, Modbus, NTLM, Pass-the-Hash, PtH, Sentinel, SPL, 哈希传递攻击, 安全检测规则, 库, 应急响应, 攻击模拟, 横向移动, 生产环境, 编程规范, 网络安全, 脆弱性评估, 隐私保护, 驱动签名利用