Practice library / Active Directory and Windows attacks
Lab · Medium · 1.5 hoursFree account
AD Enumeration with PowerView
Map AD users, groups, ACLs, sessions and trusts with PowerView, and learn the signal each step leaves behind.
On this page 13 sections
- ·Why Enumerate with Object-Level Detail
- ·Prerequisites
- ·Build the target
- 1Load PowerView
- 2Enumerate Domain Users
- Locked: Enumerate Groups and Nested Membership
- Locked: Enumerate Computers and Organizational Units
- Locked: Find a Dangerous ACL
- Locked: Hunt User Sessions
- Locked: Check Local Admin Rights
- Locked: Discover Trusts and GPO Links
- Locked: Check Your Work
- Locked: Clean Up and Next Lab
PowerView maps Active Directory as a graph of rights, sessions, and trust relationships, not as a flat object list. A single dangerous ACL or a logged-in Domain Admin on the wrong workstation turns a limited user into a domain takeover in minutes. The exercises here load PowerView in a lab domain, enumerate users, groups, ACLs, sessions, and trusts, and map each query to the log a defender sees.
What You'll Learn
- Load PowerView in a lab domain and query Active Directory over LDAP
- Enumerate domain users, groups and nested group membership
- Enumerate computers and organizational units
- Find a misconfigured ACL that grants an unintended right over a privileged group
- Hunt user sessions and local admin rights across lab hosts
- Map each enumeration step to the log or EDR signal a defender watches for
Why Enumerate with Object-Level Detail
Active Directory Basics covers net, ldapsearch and BloodHound against a domain. Those tools show you objects. PowerView shows you relationships, not objects. It shows which account can reset which other account's password. It shows which group a GPO pushes into a workstation's local Administrators group. It shows which host a Domain Admin is logged into right now. An authorized tester builds an attack path from those relationships, not from a flat user list.
This lab works entirely through LDAP reads against a Domain Controller you are authorized to query. It makes no change to the domain. Every finding also gets a detection signal. The same LDAP and SMB traffic that PowerView generates is visible to a defender who is watching for it.
Prerequisites
- Active Directory Basics — this lab assumes you already know what a Domain Controller, an SPN and a Kerberos ticket are.
- Windows Command Line & PowerShell — you need to be comfortable running PowerShell cmdlets and reading
Format-Table/Select-Objectoutput. - Active Directory Fundamentals — recommended background reading on AD objects, groups and OUs if any of Step 2 through Step 4 is unfamiliar.
- A domain user account with no special rights. This lab never requires an administrative account.
Build the target
KaliRange hosts no targets, no virtual machines and no lab files. You run this lab on your own machine, against a domain that you build. The names and 10.0.10.x addresses below are the example addresses of this lab. Replace them with the addresses of your own domain.
Your lab domain must have these parts:
| Host | Role |
|---|---|
DC01 (10.0.10.10) | Domain Controller of CORP.LOCAL, Windows Server 2022 Standard, domain functional level Windows Server 2016. One domain, no child domain, no trust |
WKSTN01 (10.0.10.31) | Domain-joined Windows 10 Enterprise workstation in OU=Workstations. This is your attack host |
FILES01 (10.0.10.21) | Domain-joined member server, Windows Server 2019 Standard, in OU=Servers |
- The OUs
Domain Controllers,ServersandWorkstationsat the root ofDC=corp,DC=local. - The user
corp.local\j.martin, a standard user with no admin rights on any host. You sign in toWKSTN01as this user. Use your own password. Never reuse a real one. - The users
k.osei,svc_backupandadministrator. The description ofsvc_backupisbackup job account - temp pw ChangeMe2024! until reset(Step 2). - The group
IT-AdminsinCN=Users. It is a member ofDomain Admins, andk.oseiis a member ofIT-Admins(Step 3). - One non-default ACE:
svc_backupholdsWriteDaclonIT-Admins(Step 5). - An open session of
k.oseionFILES01, for example a mapped share fromWKSTN01. Keep it open while you run Step 6. - Two GPOs:
Default Domain PolicyandServers - Local Admins, a policy that links toOU=Servers(Step 8). Its Restricted Groups setting can addIT-Adminsto the local Administrators group. PowerView.ps1atC:\Tools\PowerView.ps1onWKSTN01. Get it from the public PowerView project and copy it there. PutSharpView.exe, the C# port of the same functions, next to it for use if PowerShell runs in Constrained Language Mode. Your antivirus may block the script. That is expected. Use an isolated lab host and a scoped exclusion only on that host.
Build such a domain from free, legal parts. Install evaluation copies of Windows Server and Windows 10 Enterprise from the Microsoft Evaluation Center (180 days) in virtual machines on your own computer, promote one server to a domain controller and join the others. Or start from GOAD ("Game of Active Directory"), a deliberately vulnerable Active Directory lab that Orange Cyberdefense publishes on GitHub. Isolate it from the internet. Its names differ from CORP.LOCAL, so change the names in the commands. Take a snapshot of each virtual machine before Step 1.
Authorized lab only. Run every command in this lab only against a domain that you own or have written permission to test, here CORP.LOCAL and the hosts listed above. Running the same enumeration against a domain you do not own, or do not have explicit written authorization to test, is unauthorized access in most jurisdictions.
Step 1: Load PowerView
Dot-source PowerView and confirm it can reach the domain
PowerView is a PowerShell script, not a module you install from a repository. Dot-sourcing it into your current session loads its functions without writing anything to disk beyond what is already staged.
. C:\Tools\PowerView.ps1
Get-DomainExample output:
Forest : CORP.LOCAL
DomainControllers : {DC01.CORP.LOCAL}
Children : {}
DomainMode : Windows2016Domain
DomainModeLevel : 8
Parent :
PdcRoleOwner : DC01.CORP.LOCAL
RidRoleOwner : DC01.CORP.LOCAL
InfrastructureRoleOwner : DC01.CORP.LOCAL
Name : CORP.LOCALWhy it matters. Get-Domain confirms PowerView can bind to the domain as j.martin before you run anything else. Every PowerView function after this one builds its LDAP search path from the same domain context.
What a defender sees. Dot-sourcing a script does not touch disk-write telemetry, but the powershell.exe process itself is visible. PowerShell Module Logging is Event ID 4103. Script Block Logging is Event ID 4104. If either is enabled on WKSTN01, the full text of PowerView.ps1 and every command you type lands in the PowerShell Operational log. Antimalware Scan Interface (AMSI) also scans the script content as it loads. A signature match shows up as a Windows Defender Event ID 1116 "detected" event.
Step 2: Enumerate Domain Users
List domain users and read the description field
description is a free-text field admins use for notes. It is a common place to find a stale password or a hint left behind by whoever set the account up.
Get-DomainUser -Properties samaccountname,description | Format-Table -AutoSizeExample output:
samaccountname description
-------------- -----------
j.martin
svc_backup backup job account - temp pw ChangeMe2024! until reset
k.osei
administrator Built-in account for administering the computer/domainWhy it matters. svc_backup's description leaks a password. Nobody rotated it after the note was written, so the password can still work. This is a password-in-plaintext finding, not a PowerView bug. PowerView only read a field every authenticated user in the domain can already read by default.
What a defender sees. This query is a single LDAP search for the description attribute across all user objects. On its own it looks like ordinary directory traffic. The signal is volume and pattern, not this one query. Microsoft Defender for Identity and similar tools baseline normal LDAP query behaviour per account. They alert when one account suddenly enumerates every user object's attributes in one pass. This is more notable from a workstation than from a server or admin jump box.
Sign in to continue
8 more sections are for signed-in members. It is free: sign in with Google.