detecting-dcsync-attack-in-active-directory

通过监控非域控制器账户通过 DsGetNCChanges 请求目录复制的行为,检测攻击者滥用 Active Directory 复制权限提取密码哈希的 DCSync 攻击。

9 stars

Best use case

detecting-dcsync-attack-in-active-directory is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

通过监控非域控制器账户通过 DsGetNCChanges 请求目录复制的行为,检测攻击者滥用 Active Directory 复制权限提取密码哈希的 DCSync 攻击。

Teams using detecting-dcsync-attack-in-active-directory should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/detecting-dcsync-attack-in-active-directory/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/detecting-dcsync-attack-in-active-directory/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/detecting-dcsync-attack-in-active-directory/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How detecting-dcsync-attack-in-active-directory Compares

Feature / Agentdetecting-dcsync-attack-in-active-directoryStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

通过监控非域控制器账户通过 DsGetNCChanges 请求目录复制的行为,检测攻击者滥用 Active Directory 复制权限提取密码哈希的 DCSync 攻击。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 检测 Active Directory 中的 DCSync 攻击

## 适用场景

- 在 Active Directory 环境中狩猎凭据盗取活动时
- 拥有复制目录更改权限的账户被入侵后
- 调查疑似使用 Mimikatz 或 Impacket secretsdump 的情况时
- 涉及域管理员凭据横向移动的事件响应期间
- 作为安全加固的一部分审计 AD 复制权限时

## 前置条件

- 启用事件 ID 4662(对象访问)的 Windows 安全事件日志
- 已启用高级审计策略:审计目录服务访问
- 域控制器事件转发至 SIEM
- 了解合法域控制器的主机名和 IP
- 在域对象上配置 SACL 的目录服务访问审计

## 工作流程

1. **识别合法复制源**:按主机名、IP 和计算机账户记录环境中所有域控制器。只有这些系统才应执行目录复制。
2. **启用必要审计**:配置高级审计策略,通过特定 GUID 监控在域控制器上捕获事件 ID 4662 的复制权限。
3. **监控复制权限访问**:跟踪对三个关键 GUID 的访问——DS-Replication-Get-Changes(1131f6aa-9c07-11d1-f79f-00c04fc2dcd2)、DS-Replication-Get-Changes-All(1131f6ad-9c07-11d1-f79f-00c04fc2dcd2)和 DS-Replication-Get-Changes-In-Filtered-Set(89e95b76-444d-4c62-991a-0facbeda640c)。
4. **检测非域控制器复制请求**:当任何与域控制器无关的账户请求复制权限时发出告警。
5. **与网络流量关联**:DCSync 会从攻击者的机器向域控制器产生复制流量(MS-DRSR/RPC)。监控来自非域控制器 IP 地址的 DrsGetNCChanges RPC 调用。
6. **调查源头上下文**:检查发起复制请求的进程、用户账户和机器。
7. **检查凭据滥用**:DCSync 检测后,审计提取哈希的后续使用情况(哈希传递、黄金票据创建)。

## 核心概念

| 概念 | 描述 |
|------|------|
| T1003.006 | 操作系统凭据转储:DCSync |
| DCSync | 模仿域控制器复制以提取凭据 |
| DsGetNCChanges | 用于请求 AD 复制数据的 RPC 函数 |
| DS-Replication-Get-Changes | 所需的 AD 权限(GUID:1131f6aa-...) |
| DS-Replication-Get-Changes-All | 包含机密属性的权限(GUID:1131f6ad-...) |
| MS-DRSR | 微软目录复制服务远程协议 |
| KRBTGT 哈希 | DCSync 的关键目标,可用于黄金票据(Golden Ticket)攻击 |
| 事件 ID 4662 | 目录服务对象访问审计事件 |

## 工具与系统

| 工具 | 用途 |
|------|------|
| Mimikatz (lsadump::dcsync) | 主要 DCSync 攻击工具 |
| Impacket secretsdump.py | 基于 Python 的 DCSync 实现 |
| DSInternals | 用于 AD 复制的 PowerShell 模块 |
| BloodHound | 映射具有复制权限的账户 |
| Splunk / Elastic | 4662 事件的 SIEM 关联 |
| Microsoft Defender for Identity | 原生 DCSync 检测 |
| CrowdStrike Falcon | 基于 EDR 的 DCSync 检测 |

## 检测查询

### Splunk——通过事件 4662 检测 DCSync
```spl
index=wineventlog EventCode=4662
| where Properties IN ("*1131f6aa-9c07-11d1-f79f-00c04fc2dcd2*",
    "*1131f6ad-9c07-11d1-f79f-00c04fc2dcd2*",
    "*89e95b76-444d-4c62-991a-0facbeda640c*")
| where NOT match(SubjectUserName, ".*\\$$")
| where NOT SubjectUserName IN ("known_svc_account1", "known_svc_account2")
| stats count values(Properties) as ReplicationRights by SubjectUserName SubjectDomainName Computer
| where count > 0
| table SubjectUserName SubjectDomainName Computer count ReplicationRights
```

### KQL——Microsoft Sentinel DCSync 检测
```kql
SecurityEvent
| where EventID == 4662
| where Properties has "1131f6ad-9c07-11d1-f79f-00c04fc2dcd2"
    or Properties has "1131f6aa-9c07-11d1-f79f-00c04fc2dcd2"
| where SubjectUserName !endswith "$"
| where SubjectUserName !in ("AzureADConnect", "MSOL_*")
| project TimeGenerated, SubjectUserName, SubjectDomainName, Computer, Properties
| sort by TimeGenerated desc
```

### Sigma 规则——DCSync 活动
```yaml
title: DCSync Activity Detected - Non-DC Replication Request
status: stable
logsource:
    product: windows
    service: security
detection:
    selection:
        EventID: 4662
        Properties|contains:
            - '1131f6aa-9c07-11d1-f79f-00c04fc2dcd2'
            - '1131f6ad-9c07-11d1-f79f-00c04fc2dcd2'
    filter_dc:
        SubjectUserName|endswith: '$'
    condition: selection and not filter_dc
level: critical
tags:
    - attack.credential_access
    - attack.t1003.006
```

## 常见场景

1. **Mimikatz DCSync**:拥有域管理员权限的攻击者运行 `lsadump::dcsync /user:krbtgt` 提取 KRBTGT 哈希,用于创建黄金票据。
2. **Impacket secretsdump**:通过 `secretsdump.py domain/user:password@dc-ip` 进行远程 DCSync,提取所有域哈希。
3. **委托复制权限**:攻击者在执行 DCSync 之前通过 ACL 修改为自己授予复制目录更改权限。
4. **Azure AD Connect 滥用**:入侵拥有合法复制权限的 Azure AD Connect 服务账户。
5. **DSInternals PowerShell**:使用 `Get-ADReplAccount` cmdlet 复制特定账户凭据。

## 输出格式

```
Hunt ID: TH-DCSYNC-[DATE]-[SEQ]
Alert Severity: Critical
Source Account: [请求复制的账户]
Source Machine: [请求者的主机名/IP]
Target DC: [接收请求的域控制器]
Replication Rights: [访问的 GUID]
Timestamp: [事件时间]
Legitimate DC: [是/否]
Known Service Account: [是/否]
Risk Assessment: [严重 - 检测到非域控制器复制]
```

Related Skills

recovering-from-ransomware-attack

9
from killvxk/cybersecurity-skills-zh

按照 NIST 和 CISA 框架执行结构化勒索软件事件恢复,包括环境隔离、取证证据保全、 干净基础设施重建、从已验证备份优先还原系统、凭据重置,以及针对再感染的验证。 涵盖 Active Directory 恢复、数据库还原和按依赖顺序重建应用栈。

performing-web-cache-poisoning-attack

9
from killvxk/cybersecurity-skills-zh

在授权安全测试期间,通过未纳入缓存键的头部和参数毒化缓存响应,利用 Web 缓存机制向其他用户投递恶意内容。

performing-web-cache-deception-attack

9
from killvxk/cybersecurity-skills-zh

通过利用 CDN 缓存层与源服务器之间的路径规范化差异,执行 Web 缓存欺骗攻击,从而缓存并获取敏感的已认证内容。

performing-vlan-hopping-attack

9
from killvxk/cybersecurity-skills-zh

在授权环境中使用交换机欺骗(Switch Spoofing)和双标签(Double Tagging)技术模拟 VLAN 跳转攻击, 测试 VLAN 分段有效性,并验证交换机端口安全配置对二层旁路攻击的抵御能力。

performing-supply-chain-attack-simulation

9
from killvxk/cybersecurity-skills-zh

模拟和检测软件供应链攻击,包括通过 Levenshtein 距离检测域名抢注(Typosquatting)、针对私有注册表的依赖混淆(Dependency Confusion)测试、使用 pip 进行包哈希验证,以及使用 pip-audit 扫描已知漏洞。

performing-ssl-stripping-attack

9
from killvxk/cybersecurity-skills-zh

在授权环境中使用 sslstrip、Bettercap 和 mitmproxy 模拟 SSL 剥离(SSL Stripping)攻击, 测试 HSTS 强制执行、证书验证以及保护用户免受加密连接降级攻击的 HTTPS 升级机制。

performing-packet-injection-attack

9
from killvxk/cybersecurity-skills-zh

在授权安全评估中使用 Scapy、hping3 和 Nemesis 构造并注入自定义网络数据包, 测试防火墙规则、IDS 检测、协议处理能力以及网络协议栈对畸形和伪造流量的抵御能力。

performing-kerberoasting-attack

9
from killvxk/cybersecurity-skills-zh

Kerberoasting 是一种后渗透技术,通过为设置了服务主体名称(SPN)的账户请求 Kerberos TGS 票据来针对活动目录中的服务账户。这些票据用服务账户的 NTLM 哈希加密,允许在不产生登录失败事件的情况下进行离线暴力破解。

performing-jwt-none-algorithm-attack

9
from killvxk/cybersecurity-skills-zh

通过操纵 JSON Web Token 中的 alg 头部字段,执行并测试 JWT None 算法攻击,以绕过签名验证。

performing-http-parameter-pollution-attack

9
from killvxk/cybersecurity-skills-zh

执行 HTTP 参数污染(HPP)攻击,通过注入由前端和后端系统以不同方式处理的重复参数,绕过输入验证、WAF 规则和安全控制。

performing-graphql-depth-limit-attack

9
from killvxk/cybersecurity-skills-zh

使用深度嵌套递归查询执行和测试 GraphQL 深度限制攻击,以识别 GraphQL API 中的拒绝服务(DoS)漏洞。

performing-directory-traversal-testing

9
from killvxk/cybersecurity-skills-zh

通过操控文件路径参数,测试 Web 应用程序中允许读取或写入服务器任意文件的路径遍历漏洞。