Az - PHS - Password Hash Sync
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)
From the docs: Wagwoord-hash-sinkronisering is one of the sign-in methods used to accomplish hybrid identity. Azure AD Connect sinkroniseer 'n hash, van die hash, van 'n gebruiker se wagwoord van 'n plaaslike Active Directory-instansie na 'n wolk-gebaseerde Azure AD-instansie.
It's the meest algemene metode used by companies to synchronize an on-prem AD with Azure AD.
All gebruikers and a hash van die wagwoord hashes are synchronized from the on-prem to Azure AD. However, duidelike teks wagwoorde or the oorspronklike hashes aren't sent to Azure AD. Moreover, Ingeboude security groups (like domain admins...) are nie gesinkroniseer to Azure AD.
The hashes sinkronisering occurs every 2 minute. However, by default, wagwoord vervaldatum and rekening verval are nie gesinkroniseer in Azure AD. So, a user whose on-prem wagwoord is verval (not changed) can continue to toegang Azure hulpbronne using the old password.
When an on-prem user wants to access an Azure resource, the authentisering vind plaas op Azure AD.
PHS is required for features like Identiteitsbeskerming and AAD Domain Services.
When PHS is configured some bevoorregte rekeninge are automatically gecreëer:
The account MSOL_<installationID>
is automatically created in on-prem AD. This account is given a Directory Synchronization Accounts role (see documentation) which means that it has replication (DCSync) permissions in the on-prem AD.
An account Sync_<name of on-prem ADConnect Server>_installationID
is created in Azure AD. This account can reset password of ANY user (synced or cloud only) in Azure AD.
Passwords of the two previous privileged accounts are stored in a SQL server on the server where Azure AD Connect is installed. Admins can extract the passwords of those privileged users in clear-text.
The database is located in C:\Program Files\Microsoft Azure AD Sync\Data\ADSync.mdf
.
It's possible to extract the configuration from one of the tables, being one encrypted:
SELECT private_configuration_xml, encrypted_configuration FROM mms_management_agent;
The encrypted configuration is encrypted with DPAPI and it contains the wagwoorde van die MSOL_*
user in on-prem AD and the password of Sync_* in AzureAD. Therefore, compromising these it's possible to privesc to the AD and to AzureAD.
You can find a full overview of how these credentials are stored and decrypted in this talk.
If the server where Azure AD connect is installed is domain joined (recommended in the docs), it's possible to find it with:
Jy kan ook adconnectdump gebruik om hierdie akrediteer te verkry.
Deur die Sync_*
rekening te kompromitteer, is dit moontlik om die wagwoord van enige gebruiker (insluitend Globale Administrators) te herstel.
Dit is ook moontlik om slegs die wagwoorde van wolk gebruikers te wysig (selfs al is dit onverwags)
Dit is ook moontlik om die wagwoord van hierdie gebruiker te dump.
'n Ander opsie sou wees om bevoorregte toestemmings aan 'n dienshoof toe te ken, wat die Sync gebruiker toestemmings het om te doen, en dan daardie dienshoof te benader as 'n manier van privesc.
Dit is moontlik om Naadlose SSO met PHS te gebruik, wat kwesbaar is vir ander misbruik. Kontroleer dit in:
Az - Seamless SSOLeer & oefen AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Leer & oefen GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)