AD Enumeration

https://dev-angelist.gitbook.io/home/active-directory/ad-enumeration

To practice I created a local lab thanks to the following guide, then I run the enumeration of a Domain Controller (an unrealistic hypothesis because it is rarely directly exposed to the network).

In addition to what is indicated in the guide, i've added DNS and Web Server (IIS) services.

The target is a DC running Windows Server 2019, while the attacking machine is a Kali Linux machine (both machines are into a custom NAT_Network called: NAT_AD 192.168.57.0/24).

AD Lab Setup

AD Enumeration Methodology

Host Identification

sudo nmap -sn 192.168.57.0/24 #Host Discovery

Save it into /etc/hosts file: sudo echo "192.168.57.9 corp-dc" >> /etc/hosts (optional)

Open Ports Discovery

I will focus on potentially active and vulnerable services, in this case for example I have not configured the DNS so I will skip it.

80 - HTTP

We can use whatweb command to retrieve info regarding web server, a GET request using curl or visiting page via browser.

Kerberos protocol is a master topic of AD, but in this case i'm doing enumeration phase.

135 - Microsoft Remote Procedure Call (msrpc)

This protocol allows application to communicate with other machine into network.

We can user RPC Client for login and enumerate domain users

139 - NetBios

Protocol that facilitate communication for file and printer sharing into networks, it is the predecessor of SMB.

in this case we obtain NetBIOS Name, eventually server, user and MAC address info.

389 - LDAP

Lightweight directory access protocol (LDAP) is a protocol that makes it possible for applications to query user information rapidly. We can perform enumerion using various tools:

LdapSearch

Perform anonymous or credentialed enumeration of the LDAP directory:

LdapWhoami

Obtain user via Ldapwhoami

LdapDomainDump

Dump LDAP data in JSON and HTML formats for easier analysis:

445 - SMB

The SMB protocol is a network file sharing protocol that allows applications on a computer to read and write to files. SMB also requests services from server programs in a computer network. It's the most critical attack vector if it's not protected well.

The v1 is deprecated and have several vulnerabilities (Eternal Blue, WannaCry, etc).

It can run over multiple ports: 445, 137-139 (NetBIOS), and over UDP.

To test it, i've created a share folder called "SharedFiles" with a text file. This directory is shared with 'devan' with read/write rights (Properties->Share->AddUser: 'devan')

Location: \\CORP-DC\SharedFiles

Then, we can access to it on Devan's workstation machine using that location

We can enumerate SMB shares and access to system using these tools:


Last updated