Active Directory Password not Required
Hello,
This is something that is not widely known but you can have a blank password on your Active Directory user account even with a password policy in place, or some Password Setting Objects applying.This is due to an attribute named “UserAccountControl” that con override the standard behavior. This attribute is constituted of several bits, with each one a different impact, you can find a full description here :
http://www.selfadsi.org/ads-attributes/user-userAccountControl.htm
The one that we’ll talk about today is “UF_PASSWD_NOTREQD”. if you set this bit to 1 on an Active directory account, this account will be allowed to have a blank password if an admin set it.
Active Directory Password not Required – Demo
As you can see, an admin can set an empty password if the “PasswordNotRequired” is set to $true.
And now, we can logon without taping a password:
This is kind of a security hole in your Active Directory, especially when this is a domain admin account login on a domain controller.
Active Directory Password not Required – Get a List
You can get a list of all the Active Directory users that don’t require password with a simple PowerShell line:
Get-ADUser -Filter {PasswordNotRequired -eq $true}
Note: This requires the Active Directory PowerShell module.
Active Directory Password not Required – Correct the accounts
You can correct the users with:
Get-ADUser -Identity Admin3 | Set-ADUser -PasswordNotRequired $false
Note: You need to set a real password before, or you will get this kind of error:
Set-ADUser : The password does not meet the length, complexity, or history requirement of the domain.
The password you set needs to respect the current password policy which the user depends on.
You could use this to correct all accounts in your AD starting with assigning your query line to a variable:
$noPasswordRequired = Get-ADUser -Filter {PasswordNotRequired -eq $true}
Check how many accounts you may be looking at:
$noPasswordRequired | measure
Then correctly reassign the whole list at once.
$noPasswordRequired | % {Set-ADUser -Identity $_ -PasswordNotRequired $false}
To test the waters, you might start with just the first account in the list and verify that it works.
$noPasswordRequired[0] | % {Set-ADUser -Identity $_ -PasswordNotRequired $false}
$noPasswordRequired[0] | Get-ADUser -Properties PasswordNotRequired
Which may produce something like the following, where we see PasswordNotRequired is now False:
DistinguishedName : CN=Admin3,OU=Admins,DC=domain,DC=com
Enabled : False
GivenName : Admin
Name : Admin3
ObjectClass : user
ObjectGUID : 1x1xxx11-x11x-111x-1xx1-1x1x1x1xx1x1
PasswordNotRequired : False
SamAccountName : Admin3
SID : S-1-2-34-5678901234-5678901234-5678901234-5678
Surname : Admin
UserPrincipalName : Admin3@domain.com