Let’s say we retrieved password/hash from LLMNR/NBT-NS poisoning.
Now it’s time for us to spray this password/hash for further access.
During password spraying, we always have to be cautious with account lockout.
There are several ways to pull the domain password policy.
We will learn about ways to enumerate password policy from both Linux and Windows, with or without credentials.
Linux - w Creds
With valid domain credentials, password policy can be obtained through CME or rpcclient.
Using CrackMapExec:
Linux - wo Creds - SMB NULL Sessions
Without the credentials, we may be able to obtain the password policy using SMB NULL Session or LDAP anonymous bind.
SMB NULL session allows an unauthenticated attacker to retrieve information from the domain.
We can use rpcclient to check DC for SMB NULL session access.
Once connected, issue commands like querydominfo
to confirm NULL session access:
To query password policy:
We can enumerate password policy using enum4linux as well:
Also, using enum4linux-ng, which is same as enum4linux but with data export function:
Windows - NULL Sessions
Use below command to establish a null session from a windows machine and confirm we can perform more of this type of attack:
If we have username/password, we can try to authenticate:
Linux - wo Creds - LDAP Anonymous Bind
LDAP anonymous bind allows unauthenticated attacker to retrieve information from the domain.
With LDAP anonymous bind configured, we can use such tools to obtain password policy:
- windapsearch.py
- ldapsearch
- ad-ldapdomaindump.py
Using ldapsearch:
We can see that minimum password length is 8, lockout threshold is 5 and password complexity is set as 1.
Windows - w Creds
If we can authenticate to domain from windows host, we use built-in windows binary such as net.exe to retrieve password policy.
We could also use tools such as:
- PowerView
- CME
- SharpMapExec
- SharpView
net.exe
PowerView
Strategy based on Password Policy
So using the various methods above, we can obtain password policy.
- Minimum password length = 8
- Account lockout threshold = 5
- Lockout duration = 30 minutes
- Accounts unlock automatically
- Password complexity enabled = User must choose a password with 3/4 of the following: uppercase, lowercase letter. number, special character.
Below is the default password policy:
Policy | Default Value |
---|---|
Enforce password history | 24 days |
Maximum password age | 42 days |
Minimum password age | 1 day |
Minimum password length | 7 |
Password must meet complexity requirements | Enabled |
Store passwords using reversible encryption | Disabled |
Account lockout duration | Not set |
Account lockout threshold | 0 |
Reset account lockout counter after | Not set |
Moving On
Now we obtained password policy.
With the list of usernames, we go for password spraying attack.