conpass
Continuous password spraying for Active Directory, as fast as the password policy allows, without locking accounts out.
conpass reads every user's effective password policy (domain policy or fine-grained PSO) and bad password counter on the PDC Emulator, then tries each password as soon as it is safe for that user. Passwords can be added to the password file while it runs.
Blog posts
- English: https://en.hackndo.com/password-spraying-lockout/
- French: https://www.login-securite.com/blog/spray-passwords-avoid-lockouts
Warning
conpass does its best to find the effective policy of each account, but a policy it cannot see (for example a PSO it is not allowed to read) can still lead to lockouts. Use it with caution in production environments. In an emergency:
Search-ADAccount -LockedOut | Unlock-ADAccount
Installation
conpass requires Python 3.10 or later.
pipx install conpass
# or, from the sources
pipx install git+https://github.com/login-securite/conpass
Usage
conpass -d hackn.lab -u pixis -p 'P4ssw0rd' -P passwords.txt
Every password of passwords.txt is sprayed on every enabled user, one password on all users before the next one. Users who have no attempt left wait for their observation window to elapse, without blocking the others. The file is watched: passwords added to it later are queued too, and conpass keeps running until Ctrl+C.
Common options:
| Option | Description |
|---|---|
-d, --domain |
Domain to spray (FQDN) |
-u, --username / -p, --password / -H, --hashes |
Domain account used to read users and policies. Use DOMAIN\user to authenticate in another trusted domain |
-D, --dc-ip |
Any domain controller: the PDC Emulator is found from there |
--dns-ip |
DNS server, by default --dc-ip |
--ldaps |
Only use LDAPS (see below) |
-P, --password-file |
Passwords to spray, one per line. A 32 hexadecimal characters line is sprayed as an NT hash |
-U, --user-file |
Only spray these users |
-a, --user-as-pass |
Also try each username as password |
-s, --security-threshold |
Attempts always left unused below the lockout threshold (default 2, minimum 1) |
-db, --database |
SQLite database of tested credentials (default ~/.config/conpass/conpass.db) |
--show |
Display the credentials found for a domain |
--disable-spray |
Only display the policies and users |
-m, --max-threads |
Number of parallel workers (default 10) |
Resuming and results
Every test is recorded in the database, so an interrupted session can be resumed: passwords already tested on a user are skipped, and users whose password was found are not sprayed again.
conpass -d hackn.lab --show
LDAP signing and channel binding
By default conpass connects with LDAP on port 389, authenticating with NTLM and signing and sealing every message, which works whether or not the domain controller requires LDAP signing. If it fails, LDAPS (port 636) is tried, with the channel binding token, which works whether or not the domain controller requires channel binding. --ldaps only uses LDAPS.
Offline mode
Without domain credentials, give the users and the policy to assume. No lockout state can be read, so conpass relies on its own count of failures only:
conpass -d hackn.lab -D 10.0.0.1 -U users.txt -t 5 -o 1800 -P passwords.txt
How it avoids lockouts
The logic follows what domain controllers actually do:
- Everything goes through the PDC Emulator.
badPwdCountandbadPasswordTimeare not replicated: a failure on another DC is forwarded to the PDC, which holds the authoritative counter and decides the lockout. conpass finds the PDC (fSMORoleOwner, or the_ldap._tcp.pdc._msdcsDNS record), reads the counters there and authenticates there, so the counter it reads is the counter its attempts move. This also avoids the cases where a DC does not forward failures to the PDC. - Nothing is reset by a timer. When
badPasswordTimeis older than the observation window, the next failure restarts the counter at 1, whateverbadPwdCountstill contains. conpass computes the effective counter the same way, on the PDC clock. - The counter is read before every attempt, so failures of the users themselves are taken into account, and a local estimate of conpass' own failures is kept as a floor in case a read lags behind.
- Locked out accounts are detected with
msDS-User-Account-Control-Computed(the lockout bit ofuserAccountControlis never set), and are only retried once their lockout is over. - An attempt lost on a dropped connection is never replayed blindly: it is counted as a failure first.
- Spraying stops at the first lockout. Attempts already running at that moment may still lock one account each, so a wrong policy can lock out up to one account per worker.
What it detects
- Valid passwords, including when the logon is refused for another reason: expired password, password to change, expired or disabled account, logon hours or workstation restrictions. These answers are only given once the password is validated.
- Previous passwords. The DC does not count a failure with one of the two previous passwords (N-1, N-2): when
badPasswordTimedoes not move after a failure, the password is reported as a previous one. They often reveal how a user builds passwords. - NTLM grace period. For a few minutes after a password change, NTLM still accepts the previous password. A success on a recently changed password is confirmed with Kerberos, which rejects the previous password without counting a failure. Successes that Kerberos cannot confirm are flagged.
Accounts in Protected Users cannot authenticate with NTLM and are skipped.
Development
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check . && ruff format --check .
The tests include a simulated PDC applying the lockout rules above, with users failing their own logons and dropped connections, to check that spraying never locks an account out.
License
MIT
Metadata
Release files for conpass 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| conpass-0.3.0.tar.gz | 36.5 kB | Without provenance | Details for conpass-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| conpass-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for conpass-0.3.0-py3-none-any.whl |
Total release size: 75.9 kB
Release files / conpass-0.3.0.tar.gz
| Download URL | conpass-0.3.0.tar.gz |
|---|---|
| Size | 36.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a363e6239db5be432fe2e7a12a16f3a63b3a54712936e2d67e197662b989d07f
|
|
BLAKE2b-256 checksum How to use checksums |
f3479a7f60aa0488cd216a9daca5b520b16817e38a33d7e1eb84132b94f0c351
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Release files / conpass-0.3.0-py3-none-any.whl
| Download URL | conpass-0.3.0-py3-none-any.whl |
|---|---|
| Size | 39.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1c56f02874c2cfaf5c63673a97cb0f7b4f17b68bf8bcdaf8adeb0656a82737c
|
|
BLAKE2b-256 checksum How to use checksums |
268be2bb7de45d824a93c9488b79d0c88decb79c3356b7bc996cbd979a4752cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.5
|
Security for conpass 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.