A handful of bits in the Active Directory userAccountControl attribute can quietly allow blank passwords, store passwords in a decryptable form or exempt accounts from rotation for years, and most domains carry accounts with at least one of them set. These flags are usually left behind by provisioning tools, legacy applications and service accounts created long ago, and they rarely show up in day-to-day administration. This guide explains how the flags work, which ones matter most, how to find flagged accounts with built-in PowerShell and LDAP queries, and how to clear them without breaking services. It is written for Active Directory administrators and identity security teams. Broader domain hardening is in the Active Directory and Entra ID Hardening Guide.
Key takeaways
- Three flags deserve a standing report. PASSWD_NOTREQD (0x0020), ENCRYPTED_TEXT_PWD_ALLOWED (0x0080) and DONT_EXPIRE_PASSWORD (0x10000) each weaken password protection in a different way, and each can be found with one query.
- Password not required can mean a blank password. The flag lets an account work with an empty password even when domain policy demands length and complexity, although most flagged accounts do have a password.
- Clearing reversible encryption is only half the fix. Existing reversibly stored passwords stay that way until the password is changed, so remediation is flag removal plus a reset.
- Service accounts need a plan, not a toggle. Forcing expiry on a service account without a rotation process causes outages; move services to group managed service accounts (gMSA) where possible.
- Watch for the flags coming back. Event 4738 records each change to these flags, and a recurring query catches provisioning processes that keep setting them.
How userAccountControl flags work
userAccountControl is a bitmask on user and computer objects: each property is one bit, and the attribute value is the sum of the bits that are set. A normal enabled user is 512 (NORMAL_ACCOUNT); the same account with "password never expires" is 66048 (512 + 65536). Because the value is a sum, queries must test individual bits rather than compare the whole number.
| Flag | Hex | Decimal | Risk when set on a user account |
|---|---|---|---|
| ACCOUNTDISABLE | 0x0002 | 2 | Useful for filtering; disabled accounts with risky flags matter if re-enabled |
| PASSWD_NOTREQD | 0x0020 | 32 | Account can have a blank password regardless of policy |
| ENCRYPTED_TEXT_PWD_ALLOWED | 0x0080 | 128 | Password stored using reversible encryption |
| NORMAL_ACCOUNT | 0x0200 | 512 | Expected on standard user accounts |
| DONT_EXPIRE_PASSWORD | 0x10000 | 65536 | Password exempt from maximum age |
| SMARTCARD_REQUIRED | 0x40000 | 262144 | Protective; removal should be monitored |
| TRUSTED_FOR_DELEGATION | 0x80000 | 524288 | Unconstrained Kerberos delegation |
| NOT_DELEGATED | 0x100000 | 1048576 | Protective; set on sensitive accounts |
| USE_DES_KEY_ONLY | 0x200000 | 2097152 | Restricts Kerberos keys to DES |
| DONT_REQ_PREAUTH | 0x400000 | 4194304 | No Kerberos pre-authentication (AS-REP roasting exposure) |
| TRUSTED_TO_AUTH_FOR_DELEGATION | 0x1000000 | 16777216 | Protocol transition for constrained delegation |
Values are from Microsoft's UserAccountControl flags reference. Two details avoid wrong conclusions: PASSWD_CANT_CHANGE (0x0040) is not stored in the attribute (it is a permission on the object), and LOCKOUT and PASSWORD_EXPIRED should be read from the computed attribute msDS-User-Account-Control-Computed, not from userAccountControl.
Password not required (PASSWD_NOTREQD)
Microsoft documents PASSWD_NOTREQD as "no password is required". A Microsoft field engineer's analysis explains the practical effect: an account with this flag can work with a blank password even where domain policy sets a minimum length. Microsoft Defender for Identity reports it under its unsecure account attributes assessment and notes that an attacker can easily access such an account, especially a privileged one.
- How it appears: identity management and provisioning tools that create the account with the flag, set a password and never clear the flag; scripts that create accounts before a password exists; and pre-staged computer accounts before they join the domain. Active Directory Users and Computers clears it correctly.
- Expected exceptions: interdomain trust accounts carry the flag by default, because trust objects do not use normal password policy. Exclude them from remediation.
- Real exposure: most flagged accounts have a non-blank password. The flag still matters because a later password reset can set a blank value, and because the accounts that are blank are typically forgotten.
- Finding the blank ones: there is no query for a blank password. Clearing the flag on an enabled account fails if its current password is blank, because the result would not meet policy. That failure is your signal; investigate and reset those accounts.
Reversible encryption
ENCRYPTED_TEXT_PWD_ALLOWED (shown in tools as "Store password using reversible encryption") causes the domain controller to keep a copy of the password that can be decrypted. The domain-wide equivalent is the Group Policy setting Computer Configuration\Windows Settings\Security Settings\Account Policies\Password Policy\Store passwords using reversible encryption, which Microsoft lists as Disabled by default and recommends keeping Disabled. Microsoft states it is needed only for CHAP through remote access or IAS, or IIS Digest Authentication.
- Why it matters: anyone who obtains directory secrets, for example from a domain controller backup or through replication rights abused with DCSync (ATT&CK T1003.006), can recover the actual password rather than a hash. See the How to Find Accounts With DCSync Rights in Active Directory and Remove Them.
- The reset rule: Microsoft notes that disabling the setting only affects new passwords; passwords already stored reversibly remain so until changed. Clear the flag, then reset or force a change.
- Check fine-grained policies: password settings objects carry their own reversible encryption setting. See Fine-Grained Password Policies in Active Directory.
- Legacy dependency: if CHAP or Digest still depends on it, plan to replace that protocol; do not leave the flag in place indefinitely for one application.
Password never expires
DONT_EXPIRE_PASSWORD exempts an account from the maximum password age. For people, current NIST guidance favours changing passwords on evidence of compromise rather than on a fixed schedule, so the flag on its own is a lead, not a verdict. It becomes a real risk when combined with age and privilege: a never-expiring password set ten years ago on a service account in a privileged group, possibly with an SPN that exposes it to Kerberoasting, is a high-priority finding. The step-by-step discovery, triage and verification procedure is in How to find AD accounts with password never expires; this guide covers how it fits with the other flags.
- Prioritise by combination: never expires plus
pwdLastSetolder than your risk threshold, plusadminCount= 1 or privileged group membership, plus an SPN. - Do not flip it on service accounts blindly: the account's password will then expire under domain policy and the service will fail at the next logon after expiry.
- Replace, then remove: move the service to a gMSA, or put the account under a managed rotation process, before clearing the flag.
Other risky flags
| Flag | Why it is risky | Where to go deeper |
|---|---|---|
| DONT_REQ_PREAUTH | Allows AS-REP roasting (T1558.004): encrypted material can be requested for the account and guessed offline | Kerberoasting and AS-REP Roasting Defence Guide |
| USE_DES_KEY_ONLY | Forces obsolete DES Kerberos keys; Defender for Identity recommends removing it | Kerberos RC4 Deprecation |
| TRUSTED_FOR_DELEGATION | Unconstrained delegation: the service can impersonate any user who authenticates to it | How to find unconstrained delegation in Active Directory |
| SMARTCARD_REQUIRED removed | Account falls back to a password that may predate smart card enforcement; Defender for Identity recommends a reset | Reset the password when the flag is removed |
Finding flagged accounts
Use read-only queries first and export the results. LDAP bitwise filters use the matching rule OID 1.2.840.113556.1.4.803 (LDAP_MATCHING_RULE_BIT_AND), and Microsoft states the value must be decimal, not hexadecimal.
| Purpose | LDAP filter | PowerShell (ActiveDirectory module) |
|---|---|---|
| Password not required | (&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=32)) | Get-ADUser -Filter 'PasswordNotRequired -eq $true' |
| Reversible encryption | (&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=128)) | Get-ADUser -Filter 'AllowReversiblePasswordEncryption -eq $true' |
| Password never expires | (&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=65536)) | Get-ADUser -Filter 'PasswordNeverExpires -eq $true' |
| No Kerberos pre-authentication | (&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=4194304)) | Get-ADUser -Filter 'DoesNotRequirePreAuth -eq $true' |
| DES-only keys | (&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=2097152)) | Get-ADUser -Filter 'UseDESKeyOnly -eq $true' |
- Enrich each result: add
Enabled,pwdLastSet,lastLogonTimestamp,adminCount,servicePrincipalName,memberOf, description and manager, so owners can be found and risk ranked. - Include computers and other object types where relevant: remove the
objectCategory=personclause to see pre-staged computer accounts with PASSWD_NOTREQD, then exclude trust accounts. - Use posture tools as a cross-check: Defender for Identity's unsecure account attributes assessment lists reversible encryption, password not required, no pre-authentication and DES flags. See How to build a service account inventory from Active Directory for ownership.
Remediation without outages
The ActiveDirectory module's Set-ADAccountControl exposes each flag as a parameter (-PasswordNotRequired, -AllowReversiblePasswordEncryption, -PasswordNeverExpires, -DoesNotRequirePreAuth, -UseDESKeyOnly) and supports -WhatIf for a dry run.
- Export the baseline: save each account's current
userAccountControlvalue. This is your rollback record: re-applying the saved value restores the previous state. - Classify: people, service accounts, application or integration accounts, computers and trust accounts. Find an owner for every non-person account; disable unowned, unused accounts first rather than fixing them.
- Low-risk first: clear PASSWD_NOTREQD on enabled user accounts in batches with
-WhatIf, then for real, logging success or failure. Failures indicate blank passwords: reset those accounts. Clearing the flag does not change existing passwords. - Reversible encryption: confirm no CHAP or Digest dependency with the owner, clear the flag, then reset the password or set "User must change password at next logon" for people.
- Pre-authentication and DES: confirm with the application owner, clear the flags in a test window, and for DES ensure AES encryption types are enabled and the password is reset so AES keys exist.
- Never expires on service accounts: migrate to a gMSA where the application supports it (Windows services, scheduled tasks, IIS application pools and applications with native support); otherwise rotate under a documented process before removing the flag. See the Group Managed Service Accounts (gMSA) Guide.
- Pilot and watch: after each batch, monitor authentication failures (event 4625 on member servers, 4771 for Kerberos pre-authentication failures on domain controllers) and application health for at least one business cycle before the next batch.
- Fix the source: re-run the queries after a few weeks. Accounts that reappear point to a provisioning tool or script that sets the flag; fix that process.
Detection and measurement
Enable the Audit User Account Management subcategory on domain controllers so that event 4738 ("A user account was changed") is generated. Its User Account Control field lists each change, and Microsoft's monitoring guidance calls out these strings:
| Event 4738 text | Alert guidance |
|---|---|
| 'Password Not Required' Enabled | Should not typically be enabled for user accounts: alert |
| 'Encrypted Text Password Allowed' Enabled | Should not typically be enabled for user accounts: alert |
| 'Don't Expire Password' Enabled | Alert for privileged and critical accounts, or all accounts if policy forbids it |
| 'Don't Require Preauth' Enabled, 'Use DES Key Only' Enabled | Weakens Kerberos authentication: alert |
| 'Smartcard Required' Disabled | Alert for accounts where it should stay enabled |
Pair 4738 with event 4720 (account created) to catch provisioning that creates flagged accounts. More event IDs are in the Active Directory Security Monitoring and Event IDs Guide.
- Metric: enabled accounts with PASSWD_NOTREQD (excluding trusts), target zero.
- Metric: accounts with reversible encryption, target zero or a documented exception list.
- Metric: privileged accounts with never-expiring passwords older than your threshold.
- Metric: share of service accounts migrated to gMSA.
- Metric: number of risky-flag 4738 events per month and the median time to review them.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | AC-2, IA-5, IA-5(1), CM-6, AU-2 | Account management, authenticator management, password-based authentication, configuration settings, event logging |
| NIST CSF 2.0 | PR.AA-01, PR.PS-01 | Manage identities and credentials; apply configuration management |
| MITRE ATT&CK | T1078.002, T1558.004, T1003.006 | Abuse of domain accounts, AS-REP roasting, recovery of secrets through DCSync |
| ISO/IEC 27001:2022 Annex A | A.5.17, A.8.5 | Authentication information and secure authentication |
Common failure patterns
- Clearing reversible encryption without a reset: the flag is gone, but the decryptable copy of the password remains until it changes.
- Mass-clearing never expires: a script removes the flag from every account and service accounts start failing when their old passwords hit maximum age.
- Ignoring disabled accounts: a disabled account with a blank password and PASSWD_NOTREQD becomes usable the moment someone re-enables it.
- Fixing symptoms, not the provisioning tool: the identity management system sets PASSWD_NOTREQD on every new account and the count climbs back within weeks.
- Using hex values in LDAP filters: the bitwise matching rule needs decimal values, so a hex filter returns nothing and creates false confidence.
- No owner for service accounts: nobody can confirm whether a flag is still needed, so risky settings survive every review.
Practitioner checklist
- Run the five discovery queries monthly and export results with owner, privilege and password age.
- Clear PASSWD_NOTREQD on enabled accounts and reset any account where clearing fails.
- Remove reversible encryption from accounts and fine-grained policies, then force a password change.
- Keep the domain "Store passwords using reversible encryption" policy Disabled.
- Remove DONT_REQ_PREAUTH and USE_DES_KEY_ONLY unless an owner documents a current need.
- Migrate service accounts with never-expiring passwords to gMSA or managed rotation before removing the flag.
- Save each account's original
userAccountControlvalue before changes, as the rollback record. - Alert on risky-flag changes in event 4738 and fix the provisioning process behind recurring flags.
Standards and references
- Microsoft Learn: Use the UserAccountControl flags to manipulate user account properties
- Microsoft Learn: 4738(S) A user account was changed
- Microsoft Learn: Store passwords using reversible encryption
- Microsoft Learn: Defender for Identity unsecure account attributes assessment
- Microsoft Learn: Set-ADAccountControl
- Microsoft Learn: Search filter syntax
- Microsoft Learn: Group Managed Service Accounts overview
- Microsoft (archived blog): Understanding and remediating PASSWD_NOTREQD
Related NHI Mgmt Group resources: Active Directory and Entra ID Hardening Guide · How to find AD accounts with password never expires · Active Directory ACL and Delegation Hygiene Guide · Group Managed Service Accounts (gMSA) Guide