# Password Policy

The password policy helps ensure that a user's password is strong and is changed periodically so that it becomes impossible for an attacker to crack the password.

By default, the password policy is configured like this:

| **Policy**                                  | **Default value** |
| ------------------------------------------- | ----------------- |
| Enforce password history                    | 24 passwords      |
| 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           |

From an attacker's point of view it is useful to list the password policy in force on the domain and then be able to do either:

* Bruteforce
* Guessing
* Spraying
* Cracking

{% tabs %}
{% tab title="UNIX" %}

```python
cme smb 192.168.1.0/24 -u <USERNAME> -p '<PASSWORD>' --pass-pol
```

{% endtab %}

{% tab title="Windows cmd" %}

```powershell
net accounts
```

{% endtab %}

{% tab title="Windows Powershell" %}

```powershell
get-addomain | get-adobject -propertcies * | select *pwd*er
```

{% endtab %}

{% tab title="Modules AD" %}
This command gets the default password policy for the specified domain.

```powershell
Get-ADDefaultDomainPasswordPolicy -Identity domain.local
```

{% endtab %}

{% tab title="PowerView" %}

```powershell
Get-DomainPolicy
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.hacktive.bebzounette.com/active-directory/untitled/password-policy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
