Skip to content

Add SMB and LDAP signing bypass to ntlmrelayx (cross-user re-authentication) - #2345

Merged
anadrianmanrique merged 6 commits into
fortra:masterfrom
azoxlpf:feat/add-reauth-bypass
Oct 30, 2026
Merged

anadrianmanrique merged 6 commits into
fortra:masterfrom
azoxlpf:feat/add-reauth-bypass

Conversation

@azoxlpf

@azoxlpf azoxlpf commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Following https://blackfield.ch/blog/defeating-enforced-smb-signing/, which documents how an SMB2/3 re-authentication keeps the original signing key while the server never checks that the re-authenticating identity is the same one, I wanted the technique available in ntlmrelayx itself.

The write-up only ships it in a krbrelayx fork, so exploiting it today means taking the Kerberos route: adding an AD-integrated DNS record pointing at the relay and coercing with a confusable name. With --reauth-bypass, a plain NTLM relay is enough, no DNS record, no Kerberos plumbing, and a target that enforces SMB signing, a Domain Controller included, accepts the relayed session.

Recon :

image

Coerce :

image

Relay :

image

@azoxlpf

azoxlpf commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Following the SpecterOps article on bypassing enforced LDAP signing over NTLM relay (https://specterops.io/blog/2026/10/23/ldap-signing-bypass-ntlm-relay/), I decided to add the LDAP variant of the bypass to this same PR rather than open a separate one.

Reasoning: as a reviewer I personally prefer reviewing a single PR that covers a whole feature, instead of several PRs splitting the same feature across branches, having to switch branches every time just to test everything end to end is
annoying. The SMB and LDAP bypasses share the same --reauth-bypass account and the same idea (relay the captured auth under a signing key we own), so keeping them together felt natural.

That said, if @gabrielg5 @anadrianmanrique would rather have the LDAP part split into its own PR, just let me know and I'll break it out.

One note for the future: the LDAP bypass had to reimplement a bit of the read/build/write orchestration because ldapattack.py (and the LDAP relay client) are built on ldap3, while the single-record bypass needs impacket's own
LDAPConnection (for encrypt()/raw send). LDAPConnection already exposes a full CRUD (search/add/modify/delete), so refactoring ldapattack.py to use it instead of ldap3 would let the attacks and the bypass share the same code and remove that duplication. That's a larger, separate refactor and out of scope here, but worth doing down the line.

RBCD :

image

Shadow-creds :

image

@azoxlpf azoxlpf changed the title Add SMB signing bypass to ntlmrelayx (cross-user re-authentication) Add SMB and LDAP signing bypass to ntlmrelayx (cross-user re-authentication) Oct 23, 2026
@Romern

Romern commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

For LDAP you actually do not need an account, in my tests with LDAP servers with signing enforced just an anonymous sessions works, so --reauth-bypass ':' with the checks in config.py commented out.

@azoxlpf

azoxlpf commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

For LDAP you actually do not need an account, in my tests with LDAP servers with signing enforced just an anonymous sessions works, so --reauth-bypass ':' with the checks in config.py commented out.

Thanks! Confirmed and added --reauth-bypass ':'works, the anonymous SASL session still gets a usable signing key on a signing-enforced DC. Pushed it cleanly (areauth_anonymous` flag) rather than commenting the checks out, so an explicit empty credential is accepted while a partial one is still rejected.

One limitation though: in my lab anonymous LDAP search is disabled by default, so the base session opens anonymously but can't resolve the target object or read its current values. To cover that I added a read-free path: --shadow-target (and a new --delegate-target flag for RBCD) accept a full DN, which skips the lookup, and reads that fail fall back to a blind write. With that, anonymous Shadow Credentials / RBCD on an arbitrary object (e.g. a DC via GenericAll) works end to end even when anonymous search is blocked.

Shadow creds :

image

RBCD :

image

@anadrianmanrique anadrianmanrique self-assigned this Oct 26, 2026
@anadrianmanrique anadrianmanrique added enhancement Implemented features can be improved or revised high High priority item labels Oct 26, 2026
@Romern

Romern commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

a you're right, I tinkered too much that I thought that was all that was needed for a baseline 😅

@anadrianmanrique

Copy link
Copy Markdown
Collaborator

All tested bypass variants passed against the Windows target. Authentication was triggered from a separate domain member.

SMB signing bypass — PASS

python3 examples/ntlmrelayx.py
-t smb://target
-smb2support --no-multirelay
--reauth-bypass '<BASE_CREDENTIAL>'
-i -debug

dir \relay\IPC$

The target accepted cross-identity reauthentication while retaining the controlled session’s signing key. The resulting signed SMB session was usable.

LDAP signing bypass, authenticated base — PASS

python3 examples/ntlmrelayx.py
-t ldap://target
-smb2support --no-multirelay
--reauth-bypass '<BASE_CREDENTIAL>'
--delegate-access
--delegate-target '<TARGET_OBJECT_DN>'
--escalate-user ''
--no-da --no-acl --no-dump -debug

The authenticated signed base session opened successfully. The same-record relayed Bind and RBCD Modify bot succeeded, and independent read-back confirmed the write.

LDAP signing bypass, anonymous base — PASS

python3 examples/ntlmrelayx.py
-t ldap://target
-smb2support --no-multirelay
--reauth-bypass ':'
--delegate-access
--delegate-target '<TARGET_OBJECT_DN>'
--escalate-user '<GRANTEE_IDENTIFIER>'
--sid
--no-da --no-acl --no-dump -debug

The anonymous signed base session opened successfully. Anonymous attribute reading was denied, exercising the blind-write path. The relayed Bind and RBCD Modify succeeded, and independent verification confirmed the expected delegation entry.

@anadrianmanrique

Copy link
Copy Markdown
Collaborator

PR is ready to be merged now, @azoxlpf great work! thanks!

@anadrianmanrique
anadrianmanrique merged commit c8c1054 into fortra:master Oct 30, 2026
8 checks passed
@azoxlpf
azoxlpf deleted the feat/add-reauth-bypass branch October 30, 2026 16:21
godylockz pushed a commit to godylockz/impacket that referenced this pull request Nov 11, 2026
godylockz pushed a commit to godylockz/impacket that referenced this pull request Nov 22, 2026
Upstream: fortra#2073
HTTPAttack keeps CESAttack from fortra#2345 plus SCCMClientPushAttack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Implemented features can be improved or revised high High priority item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants