TL;DR
- 目的:Detect dangerous ACL misconfigurations in Active Directory using ldap3 to identify GenericAll, WriteDACL, and WriteOwner abuse paths
- 适用:AD/网络/红队场景(项目全量测试)
- 输入:AD 域 + BloodHound 数据
- 输出:渗透证据链 + 复现步骤
- 红线:仅 A 模式项目全量测试,B 模式禁用;禁止未授权使用
- 关联:上游:003-src-session-start → 下游:097-exploiting-active-directory-with-bloodhound, 096-executing-active-directory-attack-simulation, 100-exploiting-constrained-delegation-abuse
Analyzing Active Directory ACL Abuse
Overview
Active Directory Access Control Lists (ACLs) define permissions on AD objects through Discretionary Access Control Lists (DACLs) containing Access Control Entries (ACEs). Misconfigured ACEs can grant non-privileged users dangerous permissions such as GenericAll (full control), WriteDACL (modify permissions), WriteOwner (take ownership), and GenericWrite (modify attributes) on sensitive objects like Domain Admins groups, domain controllers, or GPOs.
This skill uses the ldap3 Python library to connect to a Domain Controller, query objects with their nTSecurityDescriptor attribute, parse the binary security descriptor into SDDL (Security Descriptor Definition Language) format, and identify ACEs that grant dangerous permissions to non-administrative principals. These misconfigurations are the basis for ACL-based attack paths discovered by tools like BloodHound.
When to Use
- When investigating security incidents that require analyzing active directory acl abuse
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Python 3.9 or later with ldap3 library (
pip install ldap3)
- Domain user credentials with read access to AD objects
- Network connectivity to Domain Controller on port 389 (LDAP) or 636 (LDAPS)
- Understanding of Active Directory security model and SDDL format
Workflow
Connect to Domain Controller: Establish an LDAP connection using ldap3 with NTLM or simple authentication. Use LDAPS (port 636) for encrypted connections in production.
Query target objects: Search the target OU or entire domain for objects including users, groups, computers, and OUs. Request the nTSecurityDescriptor, distinguishedName, objectClass, and sAMAccountName attributes.
Parse security descriptors: Convert the binary nTSecurityDescriptor into its SDDL string representation. Parse each ACE in the DACL to extract the trustee SID, access mask, and ACE type (allow/deny).
Resolve SIDs to principals: Map security identifiers (SIDs) to human-readable account names using LDAP lookups against the domain. Identify well-known SIDs for built-in groups.
Check for dangerous permissions: Compare each ACE's access mask against dangerous permission bitmasks: GenericAll (0x10000000), WriteDACL (0x00040000), WriteOwner (0x00080000), GenericWrite (0x40000000), and WriteProperty for specific extended rights.
Filter non-admin trustees: Exclude expected administrative trustees (Domain Admins, Enterprise Admins, SYSTEM, Administrators) and flag ACEs where non-privileged users or groups hold dangerous permissions.
Map attack paths: For each finding, document the potential attack chain (e.g., GenericAll on user allows password reset, WriteDACL on group allows adding self to group).
Generate remediation report: Output a JSON report with all dangerous ACEs, affected objects, non-admin trustees, and recommended remediation steps.
Output Format
{
"domain": "corp.example.com",
"objects_scanned": 1247,
"dangerous_aces_found": 8,
"findings": [
{
"severity": "critical",
"target_object": "CN=Domain Admins,CN=Users,DC=corp,DC=example,DC=com",
"target_type": "group",
"trustee": "CORP\\helpdesk-team",
"permission": "GenericAll",
"access_mask": "0x10000000",
"ace_type": "ACCESS_ALLOWED",
"attack_path": "GenericAll on Domain Admins group allows adding arbitrary members",
"remediation": "Remove GenericAll ACE for helpdesk-team on Domain Admins"
}
]
}
Tools & Systems
- BloodHound — AD attack path graph
- Impacket — Python AD exploitation toolkit
- CrackMapExec — AD/SMB enumeration & exploitation
- Certipy — AD CS exploitation
- NetExec — Modern CrackMapExec fork
- evilginx2 — AiTM credential harvesting
- Mimikatz — Windows credential extraction
All tools require prior 002-src-session-start confirmation for A mode. B mode禁用所有攻击工具。
Workflow
- Recon — BloodHound collection via SharpHound or bloodhound-python
- Path analysis — Identify shortest path to DA via BloodHound UI
- Initial access — Phishing (evilginx) or valid creds (compromised)
- Lateral movement — CrackMapExec / Impacket / NetExec across hosts
- Privilege escalation — ADCS, Kerberoast, Shadow Credentials, etc.
- DA/DC compromise — DCSync or mimikatz sekurlsa::logonpasswords
- Cleanup — Remove artifacts, clear logs (if authorized)
Advanced Techniques
ACL Abuse Chains
GenericAll + WriteDACL combinations can yield DA in 3 hops. Use BloodHound's "Shortest Paths to Domain Admins" query.
Cross-Forest Attacks
SID filtering misconfigurations allow cross-forest privilege escalation via trust relationship abuse.
1---2name: analyzing-active-directory-acl-abuse3description: Perform analyzing active directory acl abuse assessment during authorized security testing. Use this skill when indicators of the vulnerability class are present in the target environment.4license: Apache-2.05---67## TL;DR89- **目的**:Detect dangerous ACL misconfigurations in Active Directory using ldap3 to identify GenericAll, WriteDACL, and WriteOwner abuse paths10- **适用**:AD/网络/红队场景(项目全量测试)11- **输入**:AD 域 + BloodHound 数据12- **输出**:渗透证据链 + 复现步骤13- **红线**:**仅 A 模式项目全量测试**,B 模式禁用;禁止未授权使用14- **关联**:上游:003-src-session-start → 下游:097-exploiting-active-directory-with-bloodhound, 096-executing-active-directory-attack-simulation, 100-exploiting-constrained-delegation-abuse1516# Analyzing Active Directory ACL Abuse1718## Overview1920Active Directory Access Control Lists (ACLs) define permissions on AD objects through Discretionary Access Control Lists (DACLs) containing Access Control Entries (ACEs). Misconfigured ACEs can grant non-privileged users dangerous permissions such as GenericAll (full control), WriteDACL (modify permissions), WriteOwner (take ownership), and GenericWrite (modify attributes) on sensitive objects like Domain Admins groups, domain controllers, or GPOs.2122This skill uses the ldap3 Python library to connect to a Domain Controller, query objects with their nTSecurityDescriptor attribute, parse the binary security descriptor into SDDL (Security Descriptor Definition Language) format, and identify ACEs that grant dangerous permissions to non-administrative principals. These misconfigurations are the basis for ACL-based attack paths discovered by tools like BloodHound.232425## When to Use2627- When investigating security incidents that require analyzing active directory acl abuse28- When building detection rules or threat hunting queries for this domain29- When SOC analysts need structured procedures for this analysis type30- When validating security monitoring coverage for related attack techniques3132## Prerequisites3334- Python 3.9 or later with ldap3 library (`pip install ldap3`)35- Domain user credentials with read access to AD objects36- Network connectivity to Domain Controller on port 389 (LDAP) or 636 (LDAPS)37- Understanding of Active Directory security model and SDDL format3839## Workflow401. **Connect to Domain Controller**: Establish an LDAP connection using ldap3 with NTLM or simple authentication. Use LDAPS (port 636) for encrypted connections in production.41422. **Query target objects**: Search the target OU or entire domain for objects including users, groups, computers, and OUs. Request the `nTSecurityDescriptor`, `distinguishedName`, `objectClass`, and `sAMAccountName` attributes.43443. **Parse security descriptors**: Convert the binary nTSecurityDescriptor into its SDDL string representation. Parse each ACE in the DACL to extract the trustee SID, access mask, and ACE type (allow/deny).45464. **Resolve SIDs to principals**: Map security identifiers (SIDs) to human-readable account names using LDAP lookups against the domain. Identify well-known SIDs for built-in groups.47485. **Check for dangerous permissions**: Compare each ACE's access mask against dangerous permission bitmasks: GenericAll (0x10000000), WriteDACL (0x00040000), WriteOwner (0x00080000), GenericWrite (0x40000000), and WriteProperty for specific extended rights.49506. **Filter non-admin trustees**: Exclude expected administrative trustees (Domain Admins, Enterprise Admins, SYSTEM, Administrators) and flag ACEs where non-privileged users or groups hold dangerous permissions.51527. **Map attack paths**: For each finding, document the potential attack chain (e.g., GenericAll on user allows password reset, WriteDACL on group allows adding self to group).53548. **Generate remediation report**: Output a JSON report with all dangerous ACEs, affected objects, non-admin trustees, and recommended remediation steps.5556## Output Format5758```json59{60 "domain": "corp.example.com",61 "objects_scanned": 1247,62 "dangerous_aces_found": 8,63 "findings": [64 {65 "severity": "critical",66 "target_object": "CN=Domain Admins,CN=Users,DC=corp,DC=example,DC=com",67 "target_type": "group",68 "trustee": "CORP\\helpdesk-team",69 "permission": "GenericAll",70 "access_mask": "0x10000000",71 "ace_type": "ACCESS_ALLOWED",72 "attack_path": "GenericAll on Domain Admins group allows adding arbitrary members",73 "remediation": "Remove GenericAll ACE for helpdesk-team on Domain Admins"74 }75 ]76}77```7879## Tools & Systems8081- **BloodHound** — AD attack path graph82- **Impacket** — Python AD exploitation toolkit83- **CrackMapExec** — AD/SMB enumeration & exploitation84- **Certipy** — AD CS exploitation85- **NetExec** — Modern CrackMapExec fork86- **evilginx2** — AiTM credential harvesting87- **Mimikatz** — Windows credential extraction8889All tools require prior `002-src-session-start` confirmation for A mode. B mode禁用所有攻击工具。9091## Workflow92931. **Recon** — BloodHound collection via SharpHound or bloodhound-python942. **Path analysis** — Identify shortest path to DA via BloodHound UI953. **Initial access** — Phishing (evilginx) or valid creds (compromised)964. **Lateral movement** — CrackMapExec / Impacket / NetExec across hosts975. **Privilege escalation** — ADCS, Kerberoast, Shadow Credentials, etc.986. **DA/DC compromise** — DCSync or mimikatz sekurlsa::logonpasswords997. **Cleanup** — Remove artifacts, clear logs (if authorized)100101102## Advanced Techniques103104### ACL Abuse Chains105GenericAll + WriteDACL combinations can yield DA in 3 hops. Use BloodHound's "Shortest Paths to Domain Admins" query.106107### Cross-Forest Attacks108SID filtering misconfigurations allow cross-forest privilege escalation via trust relationship abuse.