How falconforceteam/soaphound works
Project Overview and Purpose
• SOAPHound is a .NET command-line tool that collects Active Directory data over the AD Web Services (ADWS) protocol.
• It acts as an alternative to LDAP-based tools (like SharpHound) by wrapping LDAP queries in SOAP messages and communicating using NET TCP binding.
• The tool has various collection modes such as building a cache of domain objects, generating BloodHound compatible outputs (bhdump, certdump), and dumping AD integrated DNS data.
• It is essentially a collection/processing pipeline that takes command-line options and produces JSON files (and a cache) as outputs.
Analyzing the File Structure
• The top-level files (Program.cs, SOAPHound.sln, SOAPHound.csproj, packages.config) indicate a C# console application.
• The “ADWS” folder contains the core components to interface with Active Directory via ADWS. Files like ADWSConnector.cs represent a dedicated module for SOAP-based communications with Domain Controllers.
• The “Enums” folder holds various constants and enumerations that support the domain objects (LDAPProperties, DomainTrusts, etc).
• The “Processors” directory has separate processor modules (e.g., DomainProcessor, UserProcessor, OUProcessor, etc.) that encapsulate the business logic of extracting and processing different types of AD objects.
• The “OutputTypes” folder shows how the tool formats or structures the output data (e.g., CANodes, GPOs, etc).
• Additional utility classes and configuration files (e.g., Options.cs, FodyWeavers.xml) provide support (logging, weaving, command-line options parsing, etc).
Key Components and Their Roles
a. Main Application Entry (Program.cs & CLI Parser):
• Represents the starting point where command-line arguments (such as --buildcache, --bhdump, --dnsdump, --certdump, etc.) are processed.
• Routes the execution flow based on the selected mode and authentication options.
b. ADWS Communication Layer:
• Located in the ADWS folder, this includes ADWSConnector.cs and related classes.
• Manages the connection to the ADWS service on a Domain Controller.
• Encapsulates SOAP message creation, transmission, and receiving responses.
• Should be represented as an external service boundary reflecting its communication with an external ADWS server on the AD Domain Controller.
c. Processors:
• Each processor (e.g., DomainProcessor, OUProcessor, UserProcessor, GroupProcessor) handles a specific aspect of Active Directory data retrieval or cache building.
• They consume data from the ADWS Connector and process/transform it into an internal representation.
• They also potentially communicate with each other to build relationships (e.g., linking groups to users, containers to domains).
d. Output Generation Module:
• Housed under the OutputTypes folder, these modules take processed data and format it for final output (e.g., JSON for BloodHound consumption).
• They are responsible for generating cache files and various dumps (BloodHound, DNS, and ADCS data).
e. Supporting Libraries and Enumerations:
• The Enums folder along with auxiliary files like Options.cs act as internal dependencies that define properties, settings, and constants used across the application.
• They form the “glue” that standardizes data structures and configurations.
Relationships and Data Flows
• Based on these options, the application instantiates the ADWS Connector to establish a connection with the AD Domain Controller.
• The ADWS Connector sends SOAP-wrapped LDAP queries to retrieve data.
• Data returned from ADWS is passed into various processors (one processor per data type, such as Domain, User, OU, Group, etc.) to extract, transform, and (if needed) build caches.
• The processed data is directed into Output Modules (e.g., CANodes, GPOs) to produce JSON files or other formats for consumption by tools such as BloodHound.
• Additionally, configuration and enumerations flow into both the processors and the connection layer, ensuring that data types and settings are standardized.