Repository navigation
MS ADCAP
MS-ADCAP (Active Directory Web Services: Custom Action Protocol) exposes RSAT-equivalent primitives on tcp/9389. Soaphound.py implements three of them from the TopologyManagement endpoint, enough to replicate the most common forest-management RSAT calls from a Linux attacker host.
The ADWS service hosts several logical endpoints, each with its own set of CustomActions. Soaphound.py currently ships only TopologyManagement:
| Endpoint | Typical RSAT equivalent | Status in Soaphound.py |
|---|---|---|
| TopologyManagement |
Get-ADForest, Set-ADObject, Set-ADForestMode, Enable-ADOptionalFeature
|
Implemented (--adcap-* flags) |
| AccountManagement |
New-ADUser, New-ADComputer, Set-ADAccountPassword
|
Declared, not implemented (NotImplementedError) |
| Resource / ResourceFactory (WS-Transfer) | Generic object create/delete over SOAP | Partial — ADWSConnect.put() is used by the primitives above |
The implementation lives under src/soaphound/ad/adws.py and src/soaphound/ad/soap_templates.py.
| Flag | Purpose |
|---|---|
--adcap-get-forest |
Call MS-ADCAP GetADForest and dump the full forest topology (sites, DCs, domains, UPN suffixes) as JSON on stdout. |
--adcap-translate NAME |
Call MS-ADCAP TranslateName. Default is offered=NameSamCompatible (2), desired=NameFullyQualifiedDN (1) — effectively the WS version of IADsNameTranslate. |
--adcap-change-feature GUID |
Call MS-ADCAP ChangeOptionalFeature on the forest feature identified by GUID. Enables the feature by default. |
--adcap-change-feature-dn DN |
Distinguished name of the context used by --adcap-change-feature. Defaults to CN=Partitions,CN=Configuration,<rootDN>, which is the forest-level container for scope features such as the Recycle Bin. |
The three mode flags above are mutually exclusive and short-circuit the BloodHound collect path.
soaphound \
-u alice -p 'Password123!' \
-d corp.local \
-dc dc01.corp.local -dc-ip 10.0.0.10 \
--adcap-get-forestExample output (abridged):
{
"ForestName": "corp.local",
"ForestMode": 7,
"RootDomain": "corp.local",
"Sites": ["Default-First-Site-Name", "Paris"],
"GlobalCatalogs": ["dc01.corp.local", "dc02.corp.local"],
"UPNSuffixes": ["corp.local", "corp.example"]
}Translate the SAM-compatible name CORP\alice to its full DN:
soaphound \
-u alice -p 'Password123!' \
-d corp.local \
-dc dc01.corp.local -dc-ip 10.0.0.10 \
--adcap-translate 'CORP\alice'Example output:
CN=Alice Example,OU=Users,DC=corp,DC=local
The Active Directory Recycle Bin optional feature GUID is 766ddcd8-acd0-445e-f3b9-a7f9b6744f2a. Enabling it is a forest-level change written on the CN=Partitions,CN=Configuration,<rootDN> container, which is the default --adcap-change-feature-dn:
soaphound \
-u domainadmin -p 'LongPass123!' \
-d corp.local \
-dc dc01.corp.local -dc-ip 10.0.0.10 \
--adcap-change-feature '766ddcd8-acd0-445e-f3b9-a7f9b6744f2a'A non-forest-level feature requires overriding the DN explicitly:
soaphound \
--adcap-change-feature '<feature-guid>' \
--adcap-change-feature-dn 'CN=NTDS Settings,CN=DC01,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=corp,DC=local' \
-u domainadmin -p 'LongPass123!' \
-d corp.local -dc dc01.corp.local -dc-ip 10.0.0.10The call requires an identity with WRITE_PROPERTY on the target DN. For the Recycle Bin specifically, the forest-wide write is reserved to the Enterprise Admins group by default.
- Transport: single
tcp/9389session, SOAP CustomAction with awsa:Actionofhttp://schemas.microsoft.com/2008/1/ActiveDirectory/.../ChangeOptionalFeature(or the matchingGetADForest,TranslateName). - DC-side events:
5156on connection;5137on container modification whenChangeOptionalFeaturesucceeds;5136on the attribute write. -
GetADForestandTranslateNameare read-only — no5136/5137. - An ADWS detection stack that only inspects LDAP (
tcp/389) will miss these writes entirely.
- MS-ADCAP: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adcap/
- MS-ADDM (Active Directory Web Services: Data Model and Common Elements): https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-addm/
- Microsoft Recycle Bin guidance: https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/adac/introduction-to-active-directory-administrative-center-enhancements--level-100-
-
src/soaphound/ad/adws.py— in-tree CustomAction client implementation