Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to bind when DC with ldap signing +channel binding enabled #46

Closed
enj5oy opened this issue Jan 24, 2024 · 15 comments
Closed

Unable to bind when DC with ldap signing +channel binding enabled #46

enj5oy opened this issue Jan 24, 2024 · 15 comments

Comments

@enj5oy
Copy link

enj5oy commented Jan 24, 2024

Unable to establish a connection using valid credentials when LDAP signing and channel binding are enabled
2024-01-24_22-57

@BastienFaure
Copy link
Contributor

BastienFaure commented Jan 25, 2024

I pushed a small change in the code that should give you more insight about why the bind failed. Can you checkout the latest version locally and give it another shot ?

Most likely, your LDAP server requires you to bind over LDAPS, give it a try by changing your url to ldaps://192.168.0.4, it's just that we did not do a smart job by providing a generic error message.

@enj5oy
Copy link
Author

enj5oy commented Jan 28, 2024

@BastienFaure
2024-01-28_19-41

@BastienFaure
Copy link
Contributor

Check it again, I have added even more verbosity, you should know have an understandable slug on why the bind failed, on top of this verbose error message;

@enj5oy
Copy link
Author

enj5oy commented Jan 29, 2024

@BastienFaure same error. I believe it is necessary to update the LDAP library, similar to what has been done in the Certipy project (https://github.com/ly4k/Certipy/blob/2780d5361121dd4ec79da3f64cfb1984c4f779c6/certipy/lib/ldap.py#L123)
2024-01-29_22-13

@BastienFaure
Copy link
Contributor

It says that you have invalid credentials. How are you authenticating exactly ?

@enj5oy
Copy link
Author

enj5oy commented May 7, 2024

Username + domain + password.
I use correct credentials

@3ldidi94
Copy link

Same issue here... I also use correct credentials: domain + username + password and I get the following error message: Unable to bind to the LDAP server: invalidCredentials (80090346: LdapErr: DSID-0C0907FB, comment: AcceptSecurityContext error, data 80090346, v4f7c)

@BastienFaure
Copy link
Contributor

are you able to bind to the LDAP server using other tools ? If the server returns invalidCredentials, then most likely your credentials are not working guys. I can't really do anything unless I can reproduce.

@3ldidi94
Copy link

3ldidi94 commented Jun 2, 2024

I was on a hardenned environment that I can't access anymore at the moment but I was 100% confident about my credentials as the same credz were working with other tools. However, the tools from impacket framework were not working either. I will try to create a similar lab environement and conduct some tests using ldeep to reproduce the issue and I will let you know if I am able to reproduc it.

@BastienFaure
Copy link
Contributor

What tools did work ? Do you an example of command you did run and completed successfully ?

@3ldidi94
Copy link

3ldidi94 commented Jun 4, 2024

The credentials works through the SMB protocol or using Powershell on a windows machine, so it is not an issue regarding credentials but maybe the way ldap library that manage ldap connection and that should manage channel binding.

I found this ldap3 lib and channel binding this article and Certipy tool ask to install a patched ldap3 module to have it working :

Certipy v4.8.2 - by Oliver Lyak (ly4k)

[-] Got error: To use LDAP channel binding, install the patched ldap3 module: pip3 install git+https://github.com/ly4k/ldap3

@enj5oy
Copy link
Author

enj5oy commented Jun 7, 2024

are you able to bind to the LDAP server using other tools ? If the server returns invalidCredentials, then most likely your credentials are not working guys. I can't really do anything unless I can reproduce.

For reproduce this problem, enable ldaps signing and channel binding in your domain controller.
https://4sysops.com/archives/secure-domain-controllers-with-ldap-channel-binding-and-ldap-signing/

@3ldidi94
Copy link

I found this customized ldap3 lib for ldap-channel-binding domain controller (not tested yet, just sharing info that can be useful) : customized ldap3 lib

This library is used in another project that must deal with channel binding:
pywerview

From the Readme of the project, we can find this information about dealing with channel-binding:
The version adds this PR by
@ThePirateWhoSmellsOfSunflowers
and this one by @CravateRouge.

@tiyeuse
Copy link
Collaborator

tiyeuse commented Jun 25, 2024

PR #86 should solve this issue.

@tiyeuse
Copy link
Collaborator

tiyeuse commented Jul 11, 2024

Closing this issue.

@tiyeuse tiyeuse closed this as completed Jul 11, 2024
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

No branches or pull requests

4 participants