Skip to main content

Summary

Enumerates domain controllers from the current or specified domain using DomainController.FindAll(). Retrieves detailed information including IP addresses, OS versions, and Global Catalog status.
  • Needs Admin: False
  • Version: 2
  • Author: @djhohnstein

Arguments

  • domain (Optional String) - Target domain name (defaults to current domain)

Usage

Raw Output:
Formatted Output: net_dclist

Detailed Summary

Agent Execution Flow

1. Directory Context Creation

  • Creates DirectoryContext for domain controller enumeration
  • Uses current domain context if no domain specified
  • Targets specific domain if parameter provided

2. Domain Controller Discovery

  • Uses DomainController.FindAll() to discover all domain controllers
  • Returns collection of domain controller objects
  • Queries Active Directory for controller information

3. Domain Controller Information Extraction

  • Iterates through each discovered domain controller
  • Extracts computer name, domain, forest, and OS information
  • Determines Global Catalog server status

4. IP Address Resolution

  • Attempts DNS resolution for each domain controller
  • Concatenates multiple IP addresses with comma separation
  • Falls back to dc.IPAddress if DNS resolution fails
  • Handles cases where domain controllers have multiple IPs

5. Response Serialization

  • Serializes domain controller array to JSON
  • Returns structured data for browser interface processing

Data Structures

NetDomainController

Browser Interface Integration

The JavaScript processes the JSON response into an interactive table with:
  • Shares Button: Launches net_shares command for each DC
  • Copy Icons: Allows copying computer names and IP addresses
  • Global Catalog Indicator: Database icon for Global Catalog servers
  • Sortable Columns: Name, domain, forest, IP, and OS version

Domain Controller Properties

  • Computer Name: Fully qualified domain name of the DC
  • IP Address: All network interfaces (IPv4/IPv6)
  • Domain: The domain the DC serves
  • Forest: The forest the domain belongs to
  • OS Version: Windows Server version and build
  • Global Catalog: Whether DC hosts Global Catalog database

Active Directory Integration

Uses .NET Framework’s System.DirectoryServices.ActiveDirectory namespace:
  • DirectoryContext: Establishes connection context
  • DomainController.FindAll(): Discovers all domain controllers
  • DomainController Properties: Accesses DC metadata
  • DNS Resolution: Resolves hostnames to IP addresses

APIs Used

MITRE ATT&CK Mapping

  • T1590 - Gather Victim Network Information
    • T1590.002 - DNS

Security Considerations

  • Information Disclosure: Reveals critical AD infrastructure details
  • Network Reconnaissance: Provides IP addresses and hostnames
  • Attack Planning: Enables targeting of high-value domain controllers
  • Detection Vectors: AD queries may be logged and monitored

Limitations

  1. Requires domain-joined context or valid credentials
  2. May fail if current user lacks domain query permissions
  3. DNS resolution dependent on network connectivity
  4. Cross-domain queries may require trust relationships
  5. Some DC properties may be restricted based on permissions

Error Conditions

  • Access Denied: Insufficient permissions to query domain
  • Domain Not Found: Specified domain doesn’t exist or isn’t reachable
  • Network Unreachable: Cannot connect to domain controllers
  • DNS Resolution Failure: Cannot resolve DC hostnames to IPs
  • Trust Relationship: Cross-domain queries fail due to trust issues