Skip to content

Commit da5a15e

Browse files
authored
Merge pull request #1189 from HackTricks-wiki/update_Make_Sure_to_Use_SOAP_y____An_Operators_Guide_to_S_20250726_012531
Make Sure to Use SOAP(y) – An Operators Guide to Stealthy AD...
2 parents c289ddd + d713a47 commit da5a15e

File tree

3 files changed

+168
-59
lines changed

3 files changed

+168
-59
lines changed

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@
260260
- [Ad Certificates](windows-hardening/active-directory-methodology/ad-certificates.md)
261261
- [AD information in printers](windows-hardening/active-directory-methodology/ad-information-in-printers.md)
262262
- [AD DNS Records](windows-hardening/active-directory-methodology/ad-dns-records.md)
263+
- [Adws Enumeration](windows-hardening/active-directory-methodology/adws-enumeration.md)
263264
- [ASREPRoast](windows-hardening/active-directory-methodology/asreproast.md)
264265
- [BloodHound & Other AD Enum Tools](windows-hardening/active-directory-methodology/bloodhound.md)
265266
- [Constrained Delegation](windows-hardening/active-directory-methodology/constrained-delegation.md)
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Active Directory Web Services (ADWS) Enumeration & Stealth Collection
2+
3+
{{#include ../../banners/hacktricks-training.md}}
4+
5+
## What is ADWS?
6+
7+
Active Directory Web Services (ADWS) is **enabled by default on every Domain Controller since Windows Server 2008 R2** and listens on TCP **9389**. Despite the name, **no HTTP is involved**. Instead, the service exposes LDAP-style data through a stack of proprietary .NET framing protocols:
8+
9+
* MC-NBFX → MC-NBFSE → MS-NNS → MC-NMF
10+
11+
Because the traffic is encapsulated inside these binary SOAP frames and travels over an uncommon port, **enumeration through ADWS is far less likely to be inspected, filtered or signatured than classic LDAP/389 & 636 traffic**. For operators this means:
12+
13+
* Stealthier recon – Blue teams often concentrate on LDAP queries.
14+
* Freedom to collect from **non-Windows hosts (Linux, macOS)** by tunnelling 9389/TCP through a SOCKS proxy.
15+
* The same data you would obtain via LDAP (users, groups, ACLs, schema, etc.) and the ability to perform **writes** (e.g. `msDs-AllowedToActOnBehalfOfOtherIdentity` for **RBCD**).
16+
17+
> NOTE: ADWS is also used by many RSAT GUI/PowerShell tools, so traffic may blend with legitimate admin activity.
18+
19+
## SoaPy – Native Python Client
20+
21+
[SoaPy](https://github.com/logangoins/soapy) is a **full re-implementation of the ADWS protocol stack in pure Python**. It crafts the NBFX/NBFSE/NNS/NMF frames byte-for-byte, allowing collection from Unix-like systems without touching the .NET runtime.
22+
23+
### Key Features
24+
25+
* Supports **proxying through SOCKS** (useful from C2 implants).
26+
* Fine-grained search filters identical to LDAP `-q '(objectClass=user)'`.
27+
* Optional **write** operations ( `--set` / `--delete` ).
28+
* **BOFHound output mode** for direct ingestion into BloodHound.
29+
* `--parse` flag to prettify timestamps / `userAccountControl` when human readability is required.
30+
31+
### Installation (operator host)
32+
33+
```bash
34+
python3 -m pip install soapy-adws # or git clone && pip install -r requirements.txt
35+
```
36+
37+
## Stealth AD Collection Workflow
38+
39+
The following workflow shows how to enumerate **domain & ADCS objects** over ADWS, convert them to BloodHound JSON and hunt for certificate-based attack paths – all from Linux:
40+
41+
1. **Tunnel 9389/TCP** from the target network to your box (e.g. via Chisel, Meterpreter, SSH dynamic port-forward, etc.). Export `export HTTPS_PROXY=socks5://127.0.0.1:1080` or use SoaPy’s `--proxyHost/--proxyPort`.
42+
43+
2. **Collect the root domain object:**
44+
45+
```bash
46+
soapy ludus.domain/jdoe:'P@ssw0rd'@10.2.10.10 \
47+
-q '(objectClass=domain)' \
48+
| tee data/domain.log
49+
```
50+
51+
3. **Collect ADCS-related objects from the Configuration NC:**
52+
53+
```bash
54+
soapy ludus.domain/jdoe:'P@ssw0rd'@10.2.10.10 \
55+
-dn 'CN=Configuration,DC=ludus,DC=domain' \
56+
-q '(|(objectClass=pkiCertificateTemplate)(objectClass=CertificationAuthority) \\
57+
(objectClass=pkiEnrollmentService)(objectClass=msPKI-Enterprise-Oid))' \
58+
| tee data/adcs.log
59+
```
60+
61+
4. **Convert to BloodHound:**
62+
63+
```bash
64+
bofhound -i data --zip # produces BloodHound.zip
65+
```
66+
67+
5. **Upload the ZIP** in the BloodHound GUI and run cypher queries such as `MATCH (u:User)-[:Can_Enroll*1..]->(c:CertTemplate) RETURN u,c` to reveal certificate escalation paths (ESC1, ESC8, etc.).
68+
69+
### Writing `msDs-AllowedToActOnBehalfOfOtherIdentity` (RBCD)
70+
71+
```bash
72+
soapy ludus.domain/jdoe:'P@ssw0rd'@dc.ludus.domain \
73+
--set 'CN=Victim,OU=Servers,DC=ludus,DC=domain' \
74+
msDs-AllowedToActOnBehalfOfOtherIdentity 'B:32:01....'
75+
```
76+
77+
Combine this with `s4u2proxy`/`Rubeus /getticket` for a full **Resource-Based Constrained Delegation** chain.
78+
79+
## Detection & Hardening
80+
81+
### Verbose ADDS Logging
82+
83+
Enable the following registry keys on Domain Controllers to surface expensive / inefficient searches coming from ADWS (and LDAP):
84+
85+
```powershell
86+
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics' -Name '15 Field Engineering' -Value 5 -Type DWORD
87+
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name 'Expensive Search Results Threshold' -Value 1 -Type DWORD
88+
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' -Name 'Search Time Threshold (msecs)' -Value 0 -Type DWORD
89+
```
90+
91+
Events will appear under **Directory-Service** with the full LDAP filter, even when the query arrived via ADWS.
92+
93+
### SACL Canary Objects
94+
95+
1. Create a dummy object (e.g. disabled user `CanaryUser`).
96+
2. Add an **Audit** ACE for the _Everyone_ principal, audited on **ReadProperty**.
97+
3. Whenever an attacker performs `(servicePrincipalName=*)`, `(objectClass=user)` etc. the DC emits **Event 4662** which contains the real user SID – even when the request is proxied or originates from ADWS.
98+
99+
Elastic pre-built rule example:
100+
101+
```kql
102+
(event.code:4662 and not user.id:"S-1-5-18") and winlog.event_data.AccessMask:"0x10"
103+
```
104+
105+
## Tooling Summary
106+
107+
| Purpose | Tool | Notes |
108+
|---------|------|-------|
109+
| ADWS enumeration | [SoaPy](https://github.com/logangoins/soapy) | Python, SOCKS, read/write |
110+
| BloodHound ingest | [BOFHound](https://github.com/bohops/BOFHound) | Converts SoaPy/ldapsearch logs |
111+
| Cert compromise | [Certipy](https://github.com/ly4k/Certipy) | Can be proxied through same SOCKS |
112+
113+
## References
114+
115+
* [SpecterOps – Make Sure to Use SOAP(y) – An Operators Guide to Stealthy AD Collection Using ADWS](https://specterops.io/blog/2025/07/25/make-sure-to-use-soapy-an-operators-guide-to-stealthy-ad-collection-using-adws/)
116+
* [SoaPy GitHub](https://github.com/logangoins/soapy)
117+
* [BOFHound GitHub](https://github.com/bohops/BOFHound)
118+
* [Microsoft – MC-NBFX, MC-NBFSE, MS-NNS, MC-NMF specifications](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nbfx/)
119+
120+
{{#include ../../banners/hacktricks-training.md}}
Lines changed: 47 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,88 @@
1-
# BloodHound & Other AD Enum Tools
1+
# BloodHound & Other Active Directory Enumeration Tools
22

33
{{#include ../../banners/hacktricks-training.md}}
44

5-
## AD Explorer
6-
7-
[AD Explorer](https://docs.microsoft.com/en-us/sysinternals/downloads/adexplorer) is from Sysinternal Suite:
8-
9-
> An advanced Active Directory (AD) viewer and editor. You can use AD Explorer to navigate an AD database easily, define favourite locations, view object properties, and attributes without opening dialog boxes, edit permissions, view an object's schema, and execute sophisticated searches that you can save and re-execute.
10-
11-
### Snapshots
12-
13-
AD Explorer can create snapshots of an AD so you can check it offline.\
14-
It can be used to discover vulns offline, or to compare different states of the AD DB across the time.
15-
16-
You will be requires the username, password, and direction to connect (any AD user is required).
5+
{{#ref}}
6+
adws-enumeration.md
7+
{{#endref}}
178

18-
To take a snapshot of AD, go to `File` --> `Create Snapshot` and enter a name for the snapshot.
9+
> NOTE: This page groups some of the most useful utilities to **enumerate** and **visualise** Active Directory relationships. For collection over the stealthy **Active Directory Web Services (ADWS)** channel check the reference above.
1910
20-
## ADRecon
11+
---
2112

22-
[**ADRecon**](https://github.com/adrecon/ADRecon) is a tool which extracts and combines various artefacts out of an AD environment. The information can be presented in a **specially formatted** Microsoft Excel **report** that includes summary views with metrics to facilitate analysis and provide a holistic picture of the current state of the target AD environment.
13+
## AD Explorer
2314

24-
```bash
25-
# Run it
26-
.\ADRecon.ps1
27-
```
15+
[AD Explorer](https://docs.microsoft.com/en-us/sysinternals/downloads/adexplorer) (Sysinternals) is an advanced **AD viewer & editor** which allows:
2816

29-
## BloodHound
17+
* GUI browsing of the directory tree
18+
* Editing of object attributes & security descriptors
19+
* Snapshot creation / comparison for offline analysis
3020

31-
From [https://github.com/BloodHoundAD/BloodHound](https://github.com/BloodHoundAD/BloodHound)
21+
### Quick usage
3222

33-
> BloodHound is a single page Javascript web application, built on top of [Linkurious](http://linkurio.us/), compiled with [Electron](http://electron.atom.io/), with a [Neo4j](https://neo4j.com/) database fed by a C# data collector.
23+
1. Start the tool and connect to `dc01.corp.local` with any domain credentials.
24+
2. Create an offline snapshot via `File ➜ Create Snapshot`.
25+
3. Compare two snapshots with `File ➜ Compare` to spot permission drifts.
3426

35-
BloodHound uses graph theory to reveal the hidden and often unintended relationships within an Active Directory or Azure environment. Attackers can use BloodHound to easily identify highly complex attack paths that would otherwise be impossible to quickly identify. Defenders can use BloodHound to identify and eliminate those same attack paths. Both blue and red teams can use BloodHound to easily gain a deeper understanding of privilege relationships in an Active Directory or Azure environment.
27+
---
3628

37-
So, [Bloodhound ](https://github.com/BloodHoundAD/BloodHound)is an amazing tool which can enumerate a domain automatically, save all the information, find possible privilege escalation paths and show all the information using graphs.
29+
## ADRecon
3830

39-
Booldhound is composed of 2 main parts: **ingestors** and the **visualisation application**.
31+
[ADRecon](https://github.com/adrecon/ADRecon) extracts a large set of artefacts from a domain (ACLs, GPOs, trusts, CA templates …) and produces an **Excel report**.
4032

41-
The **ingestors** are used to **enumerate the domain and extract all the information** in a format that the visualisation application will understand.
33+
```powershell
34+
# On a Windows host in the domain
35+
PS C:\> .\ADRecon.ps1 -OutputDir C:\Temp\ADRecon
36+
```
4237

43-
The **visualisation application uses neo4j** to show how all the information is related and to show different ways to escalate privileges in the domain.
38+
---
4439

45-
### Installation
40+
## BloodHound (graph visualisation)
4641

47-
After the creation of BloodHound CE, the entire project was updated for ease of use with Docker. The easiest way to get started is to use its pre-configured Docker Compose configuration.
42+
[BloodHound](https://github.com/BloodHoundAD/BloodHound) uses graph theory + Neo4j to reveal hidden privilege relationships inside on-prem AD & Azure AD.
4843

49-
1. Install Docker Compose. This should be included with the [Docker Desktop](https://www.docker.com/products/docker-desktop/) installation.
50-
2. Run:
44+
### Deployment (Docker CE)
5145

5246
```bash
5347
curl -L https://ghst.ly/getbhce | docker compose -f - up
48+
# Web UI ➜ http://localhost:8080 (user: admin / password from logs)
5449
```
5550

56-
3. Locate the randomly generated password in the terminal output of Docker Compose.
57-
4. In a browser, navigate to http://localhost:8080/ui/login. Login with the username **`admin`** and a **`randomly generated password`** you can find in the logs of docker compose.
51+
### Collectors
5852

59-
After this you will need to change the randomly generated password and you will have the new interface ready, from which you can directly download the ingestors.
53+
* `SharpHound.exe` / `Invoke-BloodHound` – native or PowerShell variant
54+
* `AzureHound` – Azure AD enumeration
55+
* **SoaPy + BOFHound** – ADWS collection (see link at top)
6056

61-
### SharpHound
57+
#### Common SharpHound modes
6258

63-
They have several options but if you want to run SharpHound from a PC joined to the domain, using your current user and extract all the information you can do:
64-
65-
```
66-
./SharpHound.exe --CollectionMethods All
67-
Invoke-BloodHound -CollectionMethod All
59+
```powershell
60+
SharpHound.exe --CollectionMethods All # Full sweep (noisy)
61+
SharpHound.exe --CollectionMethods Group,LocalAdmin,Session,Trusts,ACL
62+
SharpHound.exe --Stealth --LDAP # Low noise LDAP only
6863
```
6964

70-
> You can read more about **CollectionMethod** and loop session [here](https://support.bloodhoundenterprise.io/hc/en-us/articles/17481375424795-All-SharpHound-Community-Edition-Flags-Explained)
71-
72-
If you wish to execute SharpHound using different credentials you can create a CMD netonly session and run SharpHound from there:
73-
74-
```
75-
runas /netonly /user:domain\user "powershell.exe -exec bypass"
76-
```
65+
The collectors generate JSON which is ingested via the BloodHound GUI.
7766

78-
[**Learn more about Bloodhound in ired.team.**](https://ired.team/offensive-security-experiments/active-directory-kerberos-abuse/abusing-active-directory-with-bloodhound-on-kali-linux)
67+
---
7968

8069
## Group3r
8170

82-
[**Group3r**](https://github.com/Group3r/Group3r) is a tool to find **vulnerabilities** in Active Directory associated **Group Policy**. \
83-
You need to **run group3r** from a host inside the domain using **any domain user**.
71+
[Group3r](https://github.com/Group3r/Group3r) enumerates **Group Policy Objects** and highlights misconfigurations.
8472

8573
```bash
86-
group3r.exe -f <filepath-name.log>
87-
# -s sends results to stdin
88-
# -f send results to file
74+
# Execute inside the domain
75+
Group3r.exe -f gpo.log # -s to stdout
8976
```
9077

78+
---
79+
9180
## PingCastle
9281

93-
[**PingCastle**](https://www.pingcastle.com/documentation/) **evaluates the security posture of an AD environment** and provides a nice **report** with graphs.
82+
[PingCastle](https://www.pingcastle.com/documentation/) performs a **health-check** of Active Directory and generates an HTML report with risk scoring.
9483

95-
To run it, can execute the binary `PingCastle.exe` and it will start an **interactive session** presenting a menu of options. The default option to use is **`healthcheck`** which will establish a baseline **overview** of the **domain**, and find **misconfigurations** and **vulnerabilities**.
84+
```powershell
85+
PingCastle.exe --healthcheck --server corp.local --user bob --password "P@ssw0rd!"
86+
```
9687

9788
{{#include ../../banners/hacktricks-training.md}}
98-
99-
100-

0 commit comments

Comments
 (0)