LAPS
Last updated
Last updated
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Local Administrator Password Solution (LAPS) is a tool used for managing a system where administrator passwords, which are unique, randomized, and frequently changed, are applied to domain-joined computers. These passwords are stored securely within Active Directory and are only accessible to users who have been granted permission through Access Control Lists (ACLs). The security of the password transmissions from the client to the server is ensured by the use of Kerberos version 5 and Advanced Encryption Standard (AES).
In the domain's computer objects, the implementation of LAPS results in the addition of two new attributes: ms-mcs-AdmPwd
and ms-mcs-AdmPwdExpirationTime
. These attributes store the plain-text administrator password and its expiration time, respectively.
You could download the raw LAPS policy from \\dc\SysVol\domain\Policies\{4A8A4E8E-929F-401A-95BD-A7D40E0976C8}\Machine\Registry.pol
and then use Parse-PolFile
from the GPRegistryPolicyParser package can be used to convert this file into human-readable format.
Moreover, the native LAPS PowerShell cmdlets can be used if they're installed on a machine we have access to:
PowerView can also be used to find out who can read the password and read it:
The LAPSToolkit facilitates the enumeration of LAPS this with several functions.
One is parsing ExtendedRights
for all computers with LAPS enabled. This will show groups specifically delegated to read LAPS passwords, which are often users in protected groups.
An account that has joined a computer to a domain receives All Extended Rights
over that host, and this right gives the account the ability to read passwords. Enumeration may show a user account that can read the LAPS password on a host. This can help us target specific AD users who can read LAPS passwords.
If there is no access to a powershell you can abuse this privilege remotely through LDAP by using
This will dump all the passwords that the user can read, allowing you to get a better foothold with a different user.
Once admin, it's possible to obtain the passwords and prevent a machine from updating its password by setting the expiration date into the future.
The password will still reset if an admin uses the Reset-AdmPwdPassword
cmdlet; or if Do not allow password expiration time longer than required by policy is enabled in the LAPS GPO.
The original source code for LAPS can be found here, therefore it's possible to put a backdoor in the code (inside the Get-AdmPwdPassword
method in Main/AdmPwd.PS/Main.cs
for example) that will somehow exfiltrate new passwords or store them somewhere.
Then, just compile the new AdmPwd.PS.dll
and upload it to the machine in C:\Tools\admpwd\Main\AdmPwd.PS\bin\Debug\AdmPwd.PS.dll
(and change the modification time).
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)