New to Claude Skills? Learn how to install them →

mukul975 on GitHub

Detecting DCSync Attack

Free

Identify and respond to DCSync attacks in Active Directory.

Get this skill

Free · Opens the source repo

What Detecting DCSync Attack does

The Detecting DCSync Attack skill is designed for security professionals and system administrators who need to monitor and respond to potential credential theft in Active Directory environments. This skill focuses on detecting DCSync attacks, a technique used by adversaries to exploit Active Directory replication privileges to extract password hashes. By auditing specific Windows Security Event Logs, particularly Event ID 4662, this skill helps identify unauthorized replication requests from non-domain controller accounts, which are indicative of DCSync activity.

To effectively utilize this skill, users must ensure that their Active Directory environments are properly configured for auditing. This includes enabling Advanced Audit Policies, monitoring specific GUIDs associated with directory replication rights, and being aware of legitimate domain controller hosts. The skill provides a structured workflow that guides users through the process of setting up monitoring, detecting anomalies, and investigating potential security incidents. It also correlates detected events with network traffic patterns, enhancing the ability to identify malicious activity.

This skill is particularly valuable in scenarios involving credential theft investigations, such as when Mimikatz or Impacket tools are suspected to be in use. It aids in incident response efforts by providing actionable alerts and detailed context about replication requests, helping teams to quickly assess the legitimacy of the activity. Additionally, it supports security hardening initiatives by enabling audits of Active Directory replication permissions, ensuring that only authorized accounts have access to sensitive replication rights.

Overall, the Detecting DCSync Attack skill is an essential tool for organizations looking to bolster their defenses against credential theft and lateral movement attacks within their Active Directory environments.

When to use it

Use this skill when investigating potential credential theft incidents or auditing Active Directory replication permissions.

When not to use it

This skill is not suitable for environments without Active Directory or where Event ID 4662 auditing is not enabled.

What you can build with it

Investigating Credential Theft

Use this skill when you suspect that an account with replication privileges has been compromised and may be involved in credential theft.

Auditing AD Permissions

Employ this skill to audit Active Directory replication permissions as part of a security hardening initiative.

Incident Response

Utilize this skill during incident response efforts to quickly identify and assess unauthorized replication requests.

How to install Detecting DCSync Attack

View source

1. Install with the skills CLI

npx skills add mukul975/anthropic-cybersecurity-skills/detecting-dcsync-attack-in-active-directory --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by mukul975

Detecting DCSync Attack in Active Directory

When to Use

  • When hunting for credential theft in Active Directory environments
  • After compromise of accounts with Replicating Directory Changes permissions
  • When investigating suspected use of Mimikatz or Impacket secretsdump
  • During incident response involving lateral movement with domain admin credentials
  • When auditing AD replication permissions as part of security hardening

Prerequisites

  • Windows Security Event Logs with Event ID 4662 (Object Access) enabled
  • Advanced Audit Policy: Audit Directory Service Access enabled
  • Domain Controller event forwarding to SIEM
  • Knowledge of legitimate domain controller hostnames and IPs
  • Directory Service Access auditing with SACL on domain object

Workflow

  1. Identify Legitimate Replication Sources: Document all domain controllers in the environment by hostname, IP, and computer account. Only these should perform directory replication.
  2. Enable Required Auditing: Configure Advanced Audit Policy to capture Event ID 4662 on domain controllers with specific GUID monitoring for replication rights.
  3. Monitor Replication Rights Access: Track access to three critical GUIDs -- DS-Replication-Get-Changes (1131f6aa-9c07-11d1-f79f-00c04fc2dcd2), DS-Replication-Get-Changes-All (1131f6ad-9c07-11d1-f79f-00c04fc2dcd2), and DS-Replication-Get-Changes-In-Filtered-Set (89e95b76-444d-4c62-991a-0facbeda640c).
  4. Detect Non-DC Replication Requests: Alert when any account NOT associated with a domain controller requests replication rights.
  5. Correlate with Network Traffic: DCSync generates replication traffic (MS-DRSR/RPC) from the attacker's machine to the DC. Monitor for DrsGetNCChanges RPC calls from non-DC IP addresses.
  6. Investigate Source Context: Examine the process, user account, and machine originating the replication request.
  7. Check for Credential Abuse: After DCSync detection, audit for subsequent use of extracted hashes (pass-the-hash, golden ticket creation).

Key Concepts

ConceptDescription
T1003.006OS Credential Dumping: DCSync
DCSyncMimicking domain controller replication to extract credentials
DsGetNCChangesRPC function used to request AD replication data
DS-Replication-Get-ChangesAD permission required (GUID: 1131f6aa-...)
DS-Replication-Get-Changes-AllPermission including confidential attributes (GUID: 1131f6ad-...)
MS-DRSRMicrosoft Directory Replication Service Remote Protocol
KRBTGT HashKey target of DCSync enabling Golden Ticket attacks
Event ID 4662Directory service object access audit event

Tools & Systems

ToolPurpose
Mimikatz (lsadump::dcsync)Primary DCSync attack tool
Impacket secretsdump.pyPython-based DCSync implementation
DSInternalsPowerShell module for AD replication
BloodHoundMap accounts with replication rights
Splunk / ElasticSIEM correlation of 4662 events
Microsoft Defender for IdentityNative DCSync detection
CrowdStrike FalconEDR-based DCSync detection

Detection Queries

Splunk -- DCSync Detection via Event 4662

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 Detection

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 Rule -- DCSync Activity

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

Common Scenarios

  1. Mimikatz DCSync: Attacker with Domain Admin privileges runs lsadump::dcsync /user:krbtgt to extract KRBTGT hash for Golden Ticket creation.
  2. Impacket secretsdump: Remote DCSync via secretsdump.py domain/user:password@dc-ip extracting all domain hashes.
  3. Delegated Replication Rights: Attacker grants themselves Replicating Directory Changes rights via ACL modification before performing DCSync.
  4. Azure AD Connect Abuse: Compromising the Azure AD Connect service account which has legitimate replication rights.
  5. DSInternals PowerShell: Using Get-ADReplAccount cmdlet to replicate specific account credentials.

Output Format

Hunt ID: TH-DCSYNC-[DATE]-[SEQ]
Alert Severity: Critical
Source Account: [Account requesting replication]
Source Machine: [Hostname/IP of requestor]
Target DC: [Domain controller receiving request]
Replication Rights: [GUIDs accessed]
Timestamp: [Event time]
Legitimate DC: [Yes/No]
Known Service Account: [Yes/No]
Risk Assessment: [Critical - non-DC replication detected]

Frequently asked questions about Detecting DCSync Attack

Similar skills