Hello, folks! @nickvourd is calling, your friendly neighborhood Red Power Ranger! Welcome to another blog post where we explore the magic world of Active Directory exploitation. Girlz and boyz, get ready for the next round!
Introduction
A few months ago, I gave a presentation at Security BSides Athens 2024 about my all-time favorite attack, which I frequently use during “unstealthy” Penetration Tests. I refer to it as “unstealthy” because this TTP tends to be a bit “loud” if you’re trying to stay under the radar.
NTLM relay is an old-fashioned attack but remains relevant today for intercepting authentication traffic and allowing attackers to impersonate the client against the same or a different service. Most people are familiar with classic NTLM relay attacks, which often abuse the lack of SMB signing or misconfigurations in MSSQL.
However, what if I told you that you can start a Penetration Test with a low-privileged Domain user from a Windows 10/11 workstation and gain local Admin privileges in less than 60 seconds? It sounds too good to be true, right? According to my friend @tkalahan, this attack feels like a cheat. If certain conditions are met, you can easily accomplish it. I agree with Thanos; this attack can be a game changer during internal engagements.
Today, I’ll be presenting the NTLM relay attack from WebDAV to LDAP protocol, sharing my perspective and going into more detail than I did in my BSides presentation. Before diving into the explanation and technical details, I want to give a big shoutout to @AndrewOliveau and Matt Creel. I first learned about this attack from them, which inspired me to research and experiment further.
The Most Important
Before anything else, the most crucial requirement for this attack to succeed is that the Domain Controller must have the default configuration where LDAP Signing is NOT Enforced and/or LDAPS Channel Binding is set to “NEVER”. This oversight allows an adversary to abuse LDAP, a powerful protocol, to add, move, copy, delete, and edit specific objects, as well as modify their specific attributes, among other actions.
By utilizing NetExec or the LdapSignCheck BOF, you can easily identify whether LDAP Signing is Enforced and/or LDAPS Channel Binding is set to “When Supported” oder “Always” on Domain Controllers. To run NetExec, you need credentials, while to execute LdapSignCheck, you must have C2 remote connection via a beacon. The full command for NetExec is:
In my experience, 9 out of 10 clients don’t enforce LDAP Signing and/or set LDAPS Channel Binding to “When Supported” or “Always”. While Microsoft has released Windows Server 2025 and patched this configuration by default, many clients have not yet upgraded. In my view, the lack of compatibility with the legacy systems that thousands of clients continue to use, along with potential issues from these changes, makes things quite difficult. However, it will be fascinating to see how this attack survives in the future.
The Outcome Of This Attack
Before proceeding to the WebDAV part, it is important to understand the outcome of this attack. By “outcome”, I mean the result after the coerced authentication and NTLM relay. As mentioned in the Introduction section, with NTLM relay, attackers can impersonate a client against the same or a different service. By leveraging the LDAP protocol, an attacker can modify specific attributes of specific objects.
As you can see, this attack can lead to Shadow Credentials or Resource-Based Constrained Delegation (RBCD). Let me briefly explain what these terms mean in case you’re not familiar with them. Both configurations share some similarities. First, they both involve the Kerberos protocol, and second, they require their attributes to be edited with appropriate values to become vulnerable.
Shadow Credentials: This involves editing the value of the msDS-KeyCredentialLink attribute to include a public key for which we already own the private key.
Resource-Based Constrained Delegation (RBCD): This involves editing the value of the msDS-AllowedToActOnBehalfOfOtherIdentity attribute to include a security descriptor of an owned domain machine account. This way, you can grant access delegation control rights.
How It Works
According to Microsoft, when a user object attempts to edit certain sensitive attributes, they will receive an “Insufficient Rights” error. This happens because, if users had the permission to modify sensitive attributes like msDS-KeyCredentialLink, it would pose a security risk. For instance, an attacker could abuse this permission to establish persistence within the account. The following list outlines the non-sensitive attributes a user object can edit for themselves:
displayName: The user’s display name.
telephoneNumber: Contact phone number.
mail: Email address.
streetAddress: Physical address.
Beschreibung: A brief description about the user.
mobile: Mobile phone number.
pager: Pager number (if applicable).
userPasswort: The user’s own password (if self-service password reset is enabled).
homePhone: Home phone number.
givenName: First name.
sn: Last name (surname).
title: Job title.
This is why I mentioned earlier that, by leveraging the LDAP protocol, you can edit specific objects and their specific attributes. If you have GenericWrite, GenericAll, or similar permissions on another user object, you gain full control over all of their attributes, including sensitive ones. However, this scenario would be classified as a traditional RBCD or Shadow Credentials attack, which is outside the scope of our discussion.
Moreover, user objects with the highest privileges in an Active Directory environment, such as Domain Admins, Enterprise Admins etc., have permission to edit their own attributes. The following images demonstrate the use of the PyWhiskers tool by @_nwodtuhs, comparing a Domain Administrator (1) with a low-privilege Domain user (2). The Domain Administrator can modify his/her own msDS-KeyCredentialLink attribute, while the user named n.kiriazis is unable to perform the relevant action.
Living in a world of dragons and dungeons, my question is simple: if a user object cannot modify their own sensitive attributes and lacks the special or elevated permissions to do so, how does the attack actually work? Drum roll… 🥁
The first time I came across this detail was in the “Useful Knowledge” section of the PyWhiskers README. It’s an interesting detail, don’t you think? According to this information, by employing a coerced authentication method like PetitPotam, PrinterBug, ShadowCoerce and others, to relay authentication from one machine to another, an attacker can leverage the machine account to modify its sensitive attributes such as msDS-KeyCredentialLink oder msDS-AllowedToActOnBehalfOfOtherIdentity.
Hello My Oldest Friend
Web Distributed Authoring and Versioning (WebDAV) is an extension of the Hypertext Transfer Protocol (HTTP) that specifies how fundamental file operations like copying, moving, deleting, and creating are conducted using HTTP. The name of the WebDAV service is WebClient.
The situation is similar; I believe Microsoft continues to maintain this deprecated service in some newer Windows versions primarily for compatibility reasons, as many applications, particularly third-party ones, still rely on it.
The following table illustrates which Windows versions have the WebClient service installed by default.