root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat ad-basic-enumeration.md
// Offensive

AD: Basic Enumeration

10 Nov 2026 · 6 min read
Overview — An Offensive room that walks through the first phase of an internal Active Directory assessment when you start with network access but no credentials. You map the subnet, identify the domain controller, look at SMB shares, list domain users over LDAP and RPC, read the password policy, and finish with a password-spraying test that yields the first valid domain account.
PlatformTryHackMe
CategoryOffensive
DifficultyEasy
RoomAD: Basic Enumeration

Task 1 — Introduction

On many internal engagements the client hands over network access and nothing else. Before any exploitation you need a picture of the domain: which hosts exist, which one is the domain controller (DC), which users and groups are defined, and how strict the password policy is. The room covers four goals: enumerate the domain and network, enumerate valid users, spray passwords for a first credential, and look for secrets left in readable places.

The lab is a small network reached through the AttackBox or a VPN. Two machines matter: a domain controller (MACHINE_IP in this write-up) and a workstation called WRK (WRK_IP). After connecting, confirm the route to the lab subnet exists:

ip route
route

If the lab subnet appears through the tun0 interface, you can reach both hosts.

Task 2 — Mapping Out the Network

Imagine the scope is a single /24 and you have no diagram. The first question is simply which addresses answer.

Host discovery

fping works like ping but accepts many targets and moves on after each probe instead of waiting on one host.

fping -agq LAB_SUBNET/24
  • -a prints only hosts that are alive.
  • -g expands the CIDR block into a list of targets.
  • -q hides per-probe noise and errors.

Four hosts replied. Two of them were infrastructure (the gateway and the VPN server) and out of scope, so the useful ones were the DC and the workstation. Save them to hosts.txt. Nmap can do the same job with a ping sweep: nmap -sn LAB_SUBNET/24.

Finding the domain controller

A DC advertises itself through its services. Kerberos (88), LDAP (389), SMB (445) and kpasswd (464) together are a strong sign, with RPC (135) and NetBIOS (139) alongside. Scan those ports with version detection and default scripts:

nmap -p 88,135,139,389,445,464 -sV -sC -iL hosts.txt
  • -sV identifies service versions; the LDAP banner leaks the domain name.
  • -sC runs default NSE scripts such as smb-os-discovery, which reports the OS, hostname and forest.
  • -iL reads targets from a file.

For a wider assessment, follow up with a full sweep (nmap -sS -p- -T3 -iL hosts.txt -oN full_port_scan.txt) so services on odd ports are not missed.

88/tcp  open  kerberos-sec Microsoft Windows Kerberos
389/tcp open  ldap         Microsoft Windows Active Directory LDAP (Domain: tryhackme.loc0., Site: Default-First-Site-Name)
445/tcp open  microsoft-ds Windows Server 2019 Datacenter 17763
|   Computer name: DC
|   Domain name: tryhackme.loc
|_  FQDN: DC.tryhackme.loc
The workstation showed 88, 389 and 464 as closed and only RPC/SMB open, which is what a domain-joined member machine looks like. One more detail: the DC requires SMB signing, while the workstation only enables it without requiring it. That matters later for relay attacks, though this room does not use it.

Q: What is the domain name of our target?
A: tryhackme.loc

Q: What version of Windows Server is running on the DC?
A: Windows Server 2019 Datacenter

Task 3 — Network Enumeration With SMB

SMB shares are often the easiest place to find leftovers: scripts, backups and notes. The ports worth knowing in an AD network:

PortServiceWhy it matters
88KerberosTicket-based attacks, user enumeration
135RPC endpoint mapperService discovery, DCOM-based movement
139 / 445NetBIOS / SMBShares, null sessions, relay and exploit targets
389 / 636LDAP / LDAPSDirectory queries, certificate-related abuse

Listing shares without credentials

A null session means connecting with no user and no password. smbclient behaves like an FTP client for SMB; -L lists shares and -N suppresses the password prompt.

smbclient -L //MACHINE_IP -N

Beyond the defaults (ADMIN$, C$, IPC$, NETLOGON, SYSVOL) three custom shares appeared: AnonShare, SharedFiles and UserBackups. smbmap adds the permission column, which tells you immediately what you can read or write:

smbmap -H MACHINE_IP
smbmap -H MACHINE_IP -r

All three custom shares were readable and writable anonymously. -r lists the top level of each readable share. The Nmap alternative is nmap -p445 --script smb-enum-shares MACHINE_IP.

Pulling files

smbclient //MACHINE_IP/SharedFiles -N
smb: \> ls
smb: \> get Mouse_and_Malware.txt
smbmap -H MACHINE_IP --download UserBackups/flag.txt

Writable anonymous shares are risky beyond data theft, because anyone can plant files that users will later open. Other tools in the same space: impacket-smbclient, crackmapexec and enum4linux -a (redirect its long output to a file).

Q: What is the flag hidden in one of the shares?
A: It sits in flag.txt inside UserBackups: FLAG

Task 4 — Domain Enumeration

Next goal: a list of real domain accounts. Several unauthenticated channels can give one.

LDAP anonymous bind

Some directories answer read-only queries without credentials. First check the root DSE, which reveals the naming contexts:

ldapsearch -x -H ldap://MACHINE_IP -s base

-x selects simple (here anonymous) authentication, -H the server URI, and -s base restricts the search to the base object. The output includes defaultNamingContext: DC=tryhackme,DC=loc. Then dump user objects under that base:

ldapsearch -x -H ldap://MACHINE_IP -b "dc=tryhackme,dc=loc" "(objectClass=person)"

enum4linux-ng

enum4linux-ng -A MACHINE_IP -oA results

-A runs every module (users, groups, shares, password policy, RID cycling, OS and NetBIOS info) and -oA writes YAML and JSON.

RPC null session

rpcclient -U "" -N MACHINE_IP
rpcclient $> enumdomusers

This returned about thirty accounts with their RIDs, for example Administrator (0x1f4), krbtgt (0x1f6), sshd, many first.last names, a few oddly named ones such as asrepuser1, and rduke.

RID cycling

Every account SID ends in a RID. Well-known ones: 500 Administrator, 501 Guest, 512 Domain Admins, 513 Domain Users, 514 Domain Guests; ordinary accounts normally start at 1000. If enumdomusers is blocked, query each RID directly:

for i in $(seq 500 2000); do echo "queryuser $i" | rpcclient -U "" -N MACHINE_IP 2>/dev/null | grep -i "User Name"; done

The loop asks for each RID, hides errors with 2>/dev/null, and keeps only the name line. It takes a couple of minutes.

Validating with Kerbrute

Lists from RPC or LDAP may include disabled, fake or stale names. Kerbrute checks each name against the KDC: a valid user triggers a different Kerberos pre-authentication response than an unknown one, and no failed logon is recorded, so it is quiet.

./kerbrute userenum --dc MACHINE_IP -d tryhackme.loc users.txt

In the room, 28 of 33 tested names were valid. Kerbrute is not preinstalled on the AttackBox; download a release binary and make it executable.

Q: What group is the user rduke part of?
A: Domain Users. The LDAP record shows primaryGroupID: 513, and echo 'querygroup 513' | rpcclient -U "" -N MACHINE_IP resolves it.

Q: What is this user's full name?
A: Raoul Duke (the cn attribute)

Q: Which username is associated with RID 1634?
A: katie.thomas, using echo 'queryuser 1634' | rpcclient -U "" -N MACHINE_IP

Task 5 — Password Spraying

Spraying inverts brute force: a few likely passwords are tried across many accounts, so no single account passes the lockout threshold. It works because people pick predictable patterns, IT teams reuse default passwords, and breach lists seed attackers with realistic guesses. Always read the policy first, because the lockout threshold decides how many attempts per window are safe.

Reading the password policy

rpcclient -U "" -N MACHINE_IP
rpcclient $> getdompwinfo

crackmapexec smb MACHINE_IP --pass-pol

The CrackMapExec output reports minimum length, history, maximum age, lockout threshold, lockout duration and the observation window. For this lab the values were:

SettingValue
Minimum password length7
ComplexityEnabled
Lockout threshold10 attempts
Lockout duration / reset counter2 minutes
The room's reading text shows a sample output with different numbers (length 18, 30 minutes). Trust what your own target returns; the questions are answered from the live values above.

Complexity enabled means a password needs three of four character classes (upper, lower, digit, symbol) and must not contain the account name. So the candidate list has to respect that: Password!, Password1, Password1!, P@ssword, Pa55word1. Five guesses against a threshold of ten stays well under the limit.

Spraying the workstation

crackmapexec smb WRK_IP -u users.txt -p passwords.txt | grep -v '\[-\]'

Filtering out the [-] failure lines leaves only successes. One account matched: rduke with Password1!. Note that CrackMapExec tries every password for each user in turn by default, so keep the list short relative to the threshold, or use a pass-per-round approach with pauses in real engagements.

Q: What is the minimum password length?
A: 7

Q: What is the locked account duration?
A: 2 minutes

Q: What valid credentials did you find by spraying? (username:password)
A: rduke:Password1!

Task 6 — Conclusion

Everything above needed no credentials, and ended with one. The next step in the series is authenticated enumeration with the account just found.

Key takeaways

  • Port fingerprints (88, 389, 445, 464) and the LDAP banner identify the DC and the domain name quickly.
  • Anonymous SMB, LDAP and RPC access each independently leak users or files; disable null sessions and anonymous binds.
  • RID cycling recovers accounts even when direct listing is blocked.
  • Validate harvested usernames with Kerbrute before spraying.
  • Read the lockout policy first; spray few passwords per window.
  • Defenders: long passphrases, banned-password lists, lockout monitoring and alerting on many failures across many accounts.