Skip to content

Fix Kerberos LDAP auth when LDAP signing is enforced and LDAPS is unavailable#250

Open
Pebl3 wants to merge 1 commit into
dirkjanm:bloodhound-cefrom
Pebl3:bloodhound-ce
Open

Fix Kerberos LDAP auth when LDAP signing is enforced and LDAPS is unavailable#250
Pebl3 wants to merge 1 commit into
dirkjanm:bloodhound-cefrom
Pebl3:bloodhound-ce

Conversation

@Pebl3

@Pebl3 Pebl3 commented Apr 26, 2026

Copy link
Copy Markdown

When a DC has LdapServerIntegrity=2 but no TLS certificate, LDAPS is unavailable and all auth fails. This fixes Kerberos auth over plain LDAP in that scenario.

Two changes:

  1. Set GSS_C_CONF_FLAG | GSS_C_INTEG_FLAG in the AP_REQ authenticator checksum. The DC rejects binds that don't advertise integrity support (same flags impacket's own LDAP client uses).
  2. After a successful bind, wrap the ldap3 socket with GSSAPISocketWrapper, which applies GSS_Wrap_LDAP/GSS_Unwrap_LDAP to every PDU. Required because the DC sends GSSAPI-framed responses once a signing-capable session is established.

@AhmadAlawneh3

Copy link
Copy Markdown

Hi @Pebl3, I've built a follow-up that adds NTLM session signing for the same LDAP-signing-enforced-without-LDAPS scenario your PR #250 fixes for Kerberos. The approach mirrors your GSSAPISocketWrapper pattern. Rather than open a second PR that depends on yours, would you be OK with me opening a combined PR that supersedes #250? Your Kerberos commit would be cherry-picked unchanged with you as author, and my NTLM commit would land on top. Goal is to make it easier for @dirkjanm to review and ship both fixes together. Happy to do it either way, just want your call before I move.

@Pebl3

Pebl3 commented May 18, 2026

Copy link
Copy Markdown
Author

Hi @Pebl3, I've built a follow-up that adds NTLM session signing for the same LDAP-signing-enforced-without-LDAPS scenario your PR #250 fixes for Kerberos. The approach mirrors your GSSAPISocketWrapper pattern. Rather than open a second PR that depends on yours, would you be OK with me opening a combined PR that supersedes #250? Your Kerberos commit would be cherry-picked unchanged with you as author, and my NTLM commit would land on top. Goal is to make it easier for @dirkjanm to review and ship both fixes together. Happy to do it either way, just want your call before I move.

sure go ahead

@AhmadAlawneh3

Copy link
Copy Markdown

Opened #254 which supersedes this PR — your commit is included unchanged as the first commit, with NTLM signing/sealing added on top.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants