Active Directory (AD) is at the heart IT infrastructures. It manages identities, access and network resources. However, it is often poorly secured, making it a prime target for attackers.
An Active Directory compromise can have disastrous consequences. An attacker who gains control can access the entire network, steal data and deploy malicious softwares. In this article, we take a look at best practices for securing your Active Directory. In particular, we’ll look at common vulnerabilities and attacks, as well as configuration flaws that can compromise the security of your AD.
Active Directory (AD) is a directory service developed by Microsoft. It is the backbone of identity and access management in Windows environments.
Its main objective is to centralise the authentication and administration of resources (users, machines, applications, permissions) within a network.
AD is based on a hierarchical structure organised into domains, forests, organisational units (OUs) and objects:
The Domain Controller (DC) is a server that hosts AD and manages user authentication. Its role is to check credentials (username and password) and apply security policies via Group Policy Objects (GPOs).
GPOs can be used to define specific configurations on network machines, such as password rules, connection parameters or access restrictions.
Finally, in terms of authentication, Active Directory relies on two main protocols: Kerberos and NTLM (NT LAN Manager).
Active Directory is a critical component of an organisation’s network. It controls access to critical resources: sensitive files, applications, servers and workstations. If compromised, it can jeopardise the entire information system.
An attacker who manages to gain access with a standard user account may try to obtain higher rights. To do this, he can exploit vulnerabilities or misconfigurations: Kerberoasting, misconfigured kerberos delegations, lateral movements, domain controller takeovers, etc.
To reduce these risks, it is essential to secure Active Directory proactively. This involves reducing the attack surface, strict segmentation of access and systems, hardening of systems and advanced intrusion detection.
Let’s take a closer look.
Active Directory security is based on a defence-in-depth approach, and one of the fundamental principles for limiting risks is the partitioning of components.
In an environment where cyber-attacks are becoming increasingly sophisticated, uncontrolled access to the AD can have disastrous consequences for the organisation.
The Tier Model, recommended by ANSSI, enables a strict segmentation to be applied between privilege levels and critical resources.
The aim is simple: to prevent a compromise at user workstations (the most exposed) from leading to privileges being escalated to domain controllers.
Segmentation based on the Tier Model offers a number of strategic advantages in terms of cyber security:
The Tier Model is based on a hierarchy of privileges and resources administered within the organisation. It is structured in three tiers:
The effectiveness of the Tier Model is based on strict isolation between each tier. A fundamental principle is that a Tier must never administer a higher-level Tier. Here are the essential rules to ensure effective segmentation:
The rigorous application of the Tier Model drastically reduces the possibility of an Active Directory environment being compromised. Indeed, an organisation that effectively partitions its resources and applies strict administrative controls significantly reduces the risks associated with lateral movements and elevation of privileges.
However, this model is not the only solution, but must be combined with other security best practices.
Active Directory is a prime target for attackers seeking to escalate their privileges or move laterally in a network.
Several techniques are used to exploit well-known vulnerabilities in AD services (AD CS, AD DS, AD FS). It is therefore crucial to apply strict controls to reduce the attack surface and minimise the risks.
Kerberoasting is an attack that allows an attacker with a valid account to extract Kerberos service tickets and attempt to crack them offline to recover passwords in clear text.
This works because the service tickets are encrypted with the password hash of the associated service account. If this account uses a weak password, the attacker can break it with tools such as Hashcat and gain access.
To reduce the risk of this vulnerability, the following security controls should be implemented:
AS-REP Roasting is an attack that targets user accounts configured with the ‘Do not require Kerberos pre-authentication’ option.
An attacker with no privileges can request an authentication ticket (AS-REP) for these accounts and retrieve a response encrypted with the user’s password hash. If this account uses a weak password, the attacker can break it with Hashcat and gain access to the account.
To reduce the risk of this vulnerability, the following security controls should be implemented:
The presence of the MachineAccountQuota
attribute comes from a default configuration in Active Directory. This attribute allows any authenticated user to create up to 10 machine accounts in the domain.
An attacker with no privileges can exploit this by registering a new computer, thereby obtaining a machine account with its own credentials. This machine can then be used to carry out various attacks within the domain (including delegation attacks).
To reduce the risk of this vulnerability, simply prevent unprivileged users from adding machines to the domain by setting the MachineAccountQuota
attribute to 0.
Unconstrained Delegation is a risky configuration that allows a machine to usurp the identity of users connecting to it in order to access other services.
Unlike Constrained Delegation, which limits these rights to specific services, Unconstrained Delegation allows access to any service.
When a user authenticates to a machine with this configuration, their Kerberos ticket (TGT) is stored in the memory of the LSASS process. An attacker who compromises this computer can extract these tickets and use them to impersonate the user and elevate their privileges. If a domain administrator has logged in, the attacker can retrieve his ticket and take full control of the environment.
There are also techniques for forcing a user to authenticate, which makes this attack even more dangerous.
To reduce the risk of this vulnerability, the following security controls should be implemented:
Applying security fixes to an Active Directory environment is an essential first step, but it is not enough to guarantee effective protection. Many of Microsoft’s default configurations are not optimised for security, leaving vulnerabilities that can be exploited by attackers.
It is therefore necessary to reinforce the security posture by implementing additional measures such as restricting administrative access, monitoring connections and hardening communication protocols.
LDAP Channel Binding & Signing is a security feature that uses cryptographic mechanisms to strengthen the authentication and confidentiality of Lightweight Directory Access Protocol (LDAP) communications.
By enabling LDAP Signing, LDAP connections are secured against Man in the Middle (MitM) attacks, preventing an attacker from intercepting or modifying the data exchanged between a client and a domain controller.
In addition, enabling LDAP Channel Binding reduces the risk of identity theft by requiring a stricter binding between the TLS connection and the underlying LDAP session.
SMB (Server Message Block) Signing is a security mechanism that ensures the integrity and authenticity of SMB communications by digitally signing each message exchanged between a client and a server.
By enabling this feature, each SMB request is associated with a cryptographic signing, preventing SMB Relay attacks where an attacker could intercept and replay authenticated communications.
The Protected Users security group is a feature introduced with Windows Server 2012 R2. It automatically applies enhanced security restrictions to accounts added to it. These restrictions include prohibiting the use of weak authentication methods (such as NTLM, Kerberos with DES/RC4, or unconstrained delegation); thus preventing several types of attack, including Pass the Hash and Pass the Ticket.
Including privileged accounts (such as domain administrators) in this group considerably reduces the attack surface by imposing more secure authentication and limiting the validity period of Kerberos tickets.
Local Administrator Password Solution (LAPS) is a Microsoft solution for automatically managing passwords for local administrator accounts on workstations and servers. LAPS generates and stores unique, complex and regularly renewed passwords for each machine.
Effective Active Directory monitoring enables suspicious behaviour to be identified quickly and action taken before an attacker compromises the environment.
Implementing detailed logging and real-time monitoring of critical events is essential to maintaining robust security.
The Windows audit log must be activated to record events linked to connections, changes to Active Directory objects and the creation of accounts.
However, storing these logs locally is insufficient: centralisation with a SIEM (Security Information and Event Management) is necessary to detect and correlate incidents in real time.
Once the logs have been collected, rules need to be defined to identify suspicious activities and trigger automatic alerts.
Certain events should be monitored closely, as they often indicate an attempted compromise:
Integrating automatic alerts on these actions allows security teams to intervene quickly before an attack spreads.
Group Policy Objects (GPOs) play a key role in the configuration and management of workstations and servers within a domain. Attackers often try to modify them to disable protections, create backdoors or propagate malicious payloads.
It is therefore essential to :
An Active Directory penetration test is an essential exercise for assessing vulnerabilities in the environment and testing the robustness of security controls.
By adopting a proactive approach, vulnerabilities can be corrected before they are exploited, thereby limiting the risk of compromise and ensuring greater resilience in the face of cyber attacks.
Securing Active Directory is an ongoing task. Initial configuration is not enough: constant monitoring and regular testing are needed to anticipate threats.
A well-protected AD is based on several pillars: reduction of privileges, hardening of configurations, active monitoring and security audits. By applying these best practices, businesses can limit risks and strengthen their resilience in the face of cyber attacks.
Authors: Alexis PARET – Pentester & Amin TRAORÉ – CMO @Vaadata