Enumerating Security Controls
After gaining a foothold in an AD environment, enumerate the defensive state of hosts to understand what security controls are in place. The products in use affect which tools work for AD enumeration, exploitation, and post-exploitation. Understanding protections informs tool selection and helps plan a course of action โ either avoiding or modifying certain tools. Protections may vary across machines in the same environment; policies applied to some hosts may not apply to others.
Windows Defender
Windows Defender (Microsoft Defender after Windows 10 May 2020 Update) blocks many common offensive tools (e.g. PowerView) by default. Check its status with the built-in Get-MpComputerStatus cmdlet.
Checking Defender Status
Get-MpComputerStatus
Key fields to check:
| Field | Meaning |
|---|---|
RealTimeProtectionEnabled | Real-time scanning is active |
AntivirusEnabled | AV engine is enabled |
AntispywareEnabled | Anti-spyware engine is enabled |
BehaviorMonitorEnabled | Behavioral analysis is active |
IoavProtectionEnabled | Scans files downloaded via IE/Edge |
OnAccessProtectionEnabled | Scans files on access |
If RealTimeProtectionEnabled is True, Defender is actively scanning โ tools may need obfuscation or bypass techniques.
AppLocker
AppLocker is Microsoftโs application whitelisting solution. It gives administrators control over which applications and files users can run, providing granular control over:
- Executables
- Scripts
- Windows Installer files
- DLLs
- Packaged apps and packed app installers
Common AppLocker Configurations
Organizations often block cmd.exe and PowerShell.exe and restrict write access to certain directories. A common mistake is blocking only the default 64-bit PowerShell path while leaving others accessible:
| Blocked Path | Often Overlooked Alternatives |
|---|---|
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe | %SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe |
PowerShell_ISE.exe |
Enumerating AppLocker Policies
Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections
Look for:
- Deny rules โ what executables/paths are blocked and for which groups
- Allow rules โ what paths are allowed (e.g.
%PROGRAMFILES%\*,%WINDIR%\*) - User/group scope โ rules targeting Domain Users vs. Administrators
PowerShell Constrained Language Mode
Constrained Language Mode (CLM) restricts many PowerShell features needed for offensive operations:
- Blocks COM objects
- Only allows approved .NET types
- Blocks XAML-based workflows
- Blocks PowerShell classes
Checking Language Mode
$ExecutionContext.SessionState.LanguageMode
| Mode | Meaning |
|---|---|
FullLanguage | No restrictions โ all features available |
ConstrainedLanguage | Restricted โ many offensive techniques blocked |
LAPS (Local Administrator Password Solution)
Microsoft LAPS randomizes and rotates local administrator passwords on Windows hosts to prevent lateral movement. Key enumeration goals:
- Which domain users/groups can read LAPS passwords
- Which machines have LAPS installed (and which do not)
LAPSToolkit
The LAPSToolkit provides several useful functions for LAPS enumeration.
Find Delegated Groups
Parses ExtendedRights for all computers with LAPS enabled. Shows groups specifically delegated to read LAPS passwords (often users in protected groups):
Find-LAPSDelegatedGroups
Find Extended Rights
Checks rights on each LAPS-enabled computer for groups with read access and users with โAll Extended Rights.โ Users with this right can read LAPS passwords and may be less protected than users in delegated groups. An account that has joined a computer to the domain receives All Extended Rights over that host:
Find-AdmPwdExtendedRights
Get LAPS Passwords
Search for LAPS-enabled computers, password expiration times, and the cleartext passwords (if your user has access):
Get-LAPSComputers
Summary
| Control | Enumeration Command | What to Look For |
|---|---|---|
| Windows Defender | Get-MpComputerStatus | RealTimeProtectionEnabled, AV/antispyware status |
| AppLocker | Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections | Deny rules, blocked paths, overlooked PowerShell locations |
| PS Constrained Language Mode | $ExecutionContext.SessionState.LanguageMode | ConstrainedLanguage vs FullLanguage |
| LAPS | Find-LAPSDelegatedGroups, Find-AdmPwdExtendedRights, Get-LAPSComputers | Delegated groups, extended rights, password access |