🆕 Introducing HTB CDEP: Certified Detection Engineering Principal Learn More

Hunting AD Attacks

mini-module tag Mini-Module

This module will teach you how to hunt common active directory attacks. Each section has 3 sections: Attack, Detection, and Mitigation. In this way, you'll understand how the attack works and learn to detect it.

Created by letsdefendio

Hard Defensive

Summary

The Hunting AD Attacks module is designed for

  • Incident responders and
  • Threat hunters. Throughout this module, students will develop
  • Hunting common AD attacks, - Understanding AD attacks and detection ways, and
  • Finding evidence in AD.

Recommended prior knowledge:

  • Basic knowledge about blue team

Introduction to Active Directory


Active Directory (AD) is a directory service developed by Microsoft for Windows domain networks. It is a centralized database that stores information about resources on a network, such as users, computers, and applications, and provides a hierarchical structure to organize and manage these resources.

AD is used to manage and control access to network resources, such as files, printers, and other shared resources. It provides a centralized authentication and authorization mechanism, allowing users to access resources on the network using a single set of credentials. AD also provides a single point of management for network administrators, allowing them to easily manage and control access to network resources.

AD is an important component of many enterprise networks and is widely used in organizations of all sizes. It integrates with other Microsoft technologies, such as Exchange and SharePoint, to provide a comprehensive solution for managing user authentication, authorization, and access to resources on the network. Additionally, it supports the use of Group Policy Objects (GPOs) to enforce security and compliance policies, as well as provide an infrastructure for software distribution and patch management.

The main core of Active Directory is Kerberos. It is a protocol used for authentication, authorization process for large scale environments. We will cover basic terms in Active Directory as well as how Kerberos authentication works.


What is Kerberos?

Kerberos is the default authentication service for Microsoft Windows domains. It is intended to be more "secure" than NTLM by using third party ticket authorization as well as stronger encryption. Even though NTLM has a lot more attack vectors to choose from it still has a handful of underlying vulnerabilities just like Kerberos which still makes it a target for threat actors. It runs on UDP port 88.

Common Terminologies:

Key Distribution Center (KDC): The Key Distribution Center is a service for issuing TGTs and service tickets that consist of the Authentication Service and the Ticket Granting Service.

  • Ticket Granting Ticket (TGT): A ticket-granting ticket is an authentication ticket used to request service tickets from the TGS for specific resources from the domain.

  • Authentication Service (AS): The Authentication Service issues TGTs to be used by the TGS in the domain to request access to other machines and service tickets.

  • Ticket Granting Service (TGS): Ticket Granting Service in Active Directory is responsible for granting Service Tickets (STs) to clients that have already obtained a Ticket Granting Ticket (TGT) from the Authentication Server (AS).

  • Service Principal Name (SPN): A Service Principal Name is an identifier given to a service instance to associate a service instance with a domain service account. Windows requires that services have a domain service account which is why a service needs an SPN set.

Lets imagine an active directory user needs to access a file share. The user simply opens the share and enter his/her credentials if they have permissions to access the share. In backend, here's how The whole authentication flow works:

1- The client requests authentication from KDC. This authentication request would be in plain text.

2- KDC sends a TGT and a session key if the client exists in the database. If the client is not in the database, the authentication fails.

3- The client asks for the service ticket of the fileshare along with the TGT sent earlier by the KDC.

4- KDC sends the ticket encrypted with the session key. The client can use the session key sent earlier by KDC to decrypt the service ticket.

5- The client requests the Fileshare server for access using the service ticket.

6- The Fileshare server authenticates the client. It sends a ticket that will grant access to the file share.

The service ticket has a specific expiration time. You can use the same session ticket to access services until it expires. The default lifetime of a Kerberos ticket is 600 minutes.

This was just a basic overview to make you familiar with the basics of how Active Directory authentication works. If you are a beginner and want to learn more about how kerberos work, checkout this awesome blog: https://blog.netwrix.com/2022/08/18/what_is_kerberos/

Sign Up / Log In to Unlock the Module

Please Sign Up or Log In to unlock the module and access the rest of the sections.