Skip to content

Unable to connect to LDAP, verify your credentials #10

Description

@anasbousselham

Hi,
It's possible to used it without ldap flags.?!
Thanks

Activity

  1. yellow-starburst commented on Feb 17, 2022

    @yellow-starburst

    yes it is possible to be used without ldap flags.
    Can you close the ticket now?

  2. anasbousselham commented on Feb 17, 2022

    @anasbousselham
    Author

    I have this error without any flag!

  3. rvazarkar commented on Feb 17, 2022

    @rvazarkar
    Contributor

    Are you running this through netonly? Do you have a proper domain authentication?

  4. x3rz commented on Feb 19, 2022

    @x3rz

    I have this error without any flag!

    Same issue for me without supplying any creds it is showing me that error

  5. gabemarshall commented on Feb 24, 2022

    @gabemarshall

    @rvazarkar I'm also experiencing this. I'm running it through netonly and have proper domain auth (Powerview works fine, old versions of Invoke-Bloodhound work).

    CleanShot 2022-02-24 at 12 13 47

  6. lungdart commented on Feb 24, 2022

    @lungdart

    Same situation here on the HTB forest machine.

    image

    When I checkout the old version of SharpHound from the bloodhound repo commit 6a95882e0e88c398f97f2a82a956eef5b3b10ae8, the identical command works (But then starts throwing stack traces later on)

    I guess I'll keep going back into the commits until I can find a stable version...

  7. walula commented on Feb 28, 2022

    @walula

    still got the same issue, has anyone found a workaround yet?

  8. rvazarkar commented on Feb 28, 2022

    @rvazarkar
    Contributor
            ///     Tests the current LDAP config to ensure its valid by pulling a domain object
            /// </summary>
            /// <returns>True if connection was successful, else false</returns>
            public bool TestLDAPConfig(string domain)
            {
                var filter = new LDAPFilter();
                filter.AddDomains();
    
                var resDomain = GetDomain(domain)?.Name ?? domain;
                
                var result = QueryLDAP(filter.GetFilter(), SearchScope.Subtree, CommonProperties.ObjectID, resDomain)
                    .DefaultIfEmpty(null).FirstOrDefault();
    
                return result != null;
            }
    

    This is how we test for a valid LDAP connection: we query for domain objects and make sure we can get at least one. For whatever reason, that test is failing and we're getting nothing back. If you run with -v 0 it might give you some more insight as to where the check is failing, you can report back with that information

  9. walula commented on Mar 1, 2022

    @walula

    The verbose option only shows the TRACE info of the "TestConnection link" in the TestConnection() Function.

    ./sh.exe -v 0
    2022-03-01T01:29:38.8844100-08:00|INFORMATION|Resolved Collection Methods: Group, LocalAdmin, Session, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote
    2022-03-01T01:29:38.9000386-08:00|TRACE|Entering initialize link
    2022-03-01T01:29:38.9000386-08:00|INFORMATION|Initializing SharpHound at 1:29 AM on 3/1/2022
    2022-03-01T01:29:38.9000386-08:00|TRACE|Entering TestConnection link
    2022-03-01T01:29:39.0719120-08:00|ERROR|Unable to connect to LDAP, verify your credentials
    2022-03-01T01:29:39.0719120-08:00|TRACE|Exiting TestConnection link
    
    

    Using powershell AD functionality and/or powerview it's possible to retrive objects in the domain.
    Also it looks like that the issue is mainly related to the HTB Forest machine, i still have to try in other environments

  10. rvazarkar commented on Mar 2, 2022

    @rvazarkar
    Contributor

    I beleive I know whats causing this, I'll have a new build soon

  11. YB1-cyber commented on Mar 4, 2022

    @YB1-cyber

    @rvazarkar
    I joined the "unable to connect to LDAP" club , and also a friend of mine...
    so if you can update here , it'll nice

    BTW
    I wonder:
    A) Can you tell why the .ps1 collector had been removed ?
    B) Will SharpHound.ps1 support the new format (matching bloodhound 4.1+) when we get it back ?

  12. rvazarkar commented on Mar 7, 2022

    @rvazarkar
    Contributor

    Should be fixed in v1.0.3. Reopen if the problem is still there

    @YB1-cyber it was removed because I ran out of time when doing this release, and yes it will

  13. chinformer commented on Mar 18, 2022

    @chinformer

    Hey, I can confirm this is still affecting v1.0.3. I've just compiled the -dev 1.0.3 version (x64) no other changes and when supplying --ldapusername and --ldappassword the error is:

    2022-03-18T16:18:27.4755485+00:00|INFORMATION|Resolved Collection Methods: Group, LocalAdmin, GPOLocalGroup, Session, LoggedOn, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote
    
    2022-03-18T16:18:27.4876460+00:00|INFORMATION|Initializing sharpyhounds at 16:18 on 18/03/2022
    
    2022-03-18T16:18:27.9424135+00:00|ERROR|Unable to connect to LDAP, verify your credentials
    
  14. n0kovo commented on Apr 16, 2022

    @n0kovo

    +1
    Same issue with 1.0.3 (x64)

  15. 8 remaining items

  16. Trailingslashes commented on Jul 27, 2023

    @Trailingslashes

    @pkyria14, I had to reboot the windows machine to get this command to work.

  17. ProjectsFromB commented on Jan 12, 2024

    @ProjectsFromB

    Anyone have any luck or workarounds?

  18. JunglistHyperD commented on Jan 31, 2024

    @JunglistHyperD

    Hi im also getting this error. Specifically

    *Evil-WinRM* PS C:\Users\FSmith\Documents> ./Sharphound.exe -c all, gpolocalgroup -v 0
    2024-01-31T18:10:30.6811548-08:00|INFORMATION|This version of SharpHound is compatible with the 4.3.1 Release of BloodHound
    2024-01-31T18:10:30.8217740-08:00|INFORMATION|Resolved Collection Methods: Group, LocalAdmin, GPOLocalGroup, Session, LoggedOn, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote
    2024-01-31T18:10:30.8373984-08:00|TRACE|Entering initialize link
    2024-01-31T18:10:30.8373984-08:00|INFORMATION|Initializing SharpHound at 6:10 PM on 1/31/2024
    2024-01-31T18:10:30.8373984-08:00|TRACE|Entering TestConnection link
    2024-01-31T18:10:58.9768518-08:00|TRACE|[CommonLib LDAPUtils]Testing LDAP connection for domain (null)
    2024-01-31T18:10:58.9768518-08:00|TRACE|[CommonLib LDAPUtils]Creating ldap connection for DC with filter (objectclass=domain)
    2024-01-31T18:10:58.9768518-08:00|DEBUG|[CommonLib LDAPUtils]Unable to create ldap connection for domain (null)
    2024-01-31T18:10:58.9768518-08:00|WARNING|[CommonLib LDAPUtils]LDAP connection is null for filter (objectclass=domain) and domain Default Domain
    2024-01-31T18:10:58.9768518-08:00|TRACE|[CommonLib LDAPUtils]Result object from LDAP connection test is null
    2024-01-31T18:10:58.9768518-08:00|ERROR|Unable to connect to LDAP, verify your credentials
    2024-01-31T18:10:58.9768518-08:00|TRACE|Exiting TestConnection link
    *Evil-WinRM* PS C:\Users\FSmith\Documents> 

    Is this issue a dupe of something or should it be reopened if still unresolved 😌

  19. JonasBK commented on Jan 31, 2024

    @JonasBK
    Contributor

    Hi @BaronSam3di,
    Try the latest SharpHound version here: https://github.com/BloodHoundAD/SharpHound/releases/latest

  20. stuartw1 commented on Mar 18, 2024

    @stuartw1
    Contributor

    I had this error message today. My target environment had 389 disabled and 636 open for LDAPS

    I used the -SecureLDAP flag, but this didnt work and returned an "unable to connect to LDAP" error until I tried -DisableCertVerification and -DisableSigning, which made it work perfectly. Interestingly I had to provide domain, ldapusername and ldappassword too, with ldapusername set to user.name@internal.example.com rather than INTERNAL\user.name

    Perhaps the error message could be expanded - either to include if it is a connection security fault, or to suggest trying flags that drop security validation measures if appropriate. It would be good if the logs contained the port that was being tried also.

  21. vcap-kali commented on Apr 3, 2024

    @vcap-kali

    people are asking for workarounds, and I still observe this on HTB Sauna and Forest as of today, WHY is this issue closed then @JonasBK ?!

    still getting the "ERROR|Unable to connect to LDAP, verify your credentials"

    .\SharpHound.exe --DisableCertVerification --DisableSigning --Domain EGOTISTICAL-BANK.LOCAL --ldapusername svc_loanmgr --ldappassword '...'

  22. superswan commented on Apr 8, 2024

    @superswan

    Same issue with SharpHound 2.3.3 and 1.1.1

    PS C:\Users\vim\Downloads\sharphound-v2.3.3> .\SharpHound.exe --version
    2024-04-07T18:57:38.3685762-07:00|INFORMATION|This version of SharpHound is compatible with the 5.0.0 Release of BloodHound
    SharpHound 2.3.3
    PS C:\Users\vim\Downloads\sharphound-v2.3.3> .\SharpHound.exe -c localadmin
    2024-04-07T18:58:44.0134919-07:00|INFORMATION|This version of SharpHound is compatible with the 5.0.0 Release of BloodHound
    2024-04-07T18:58:44.1537624-07:00|INFORMATION|Resolved Collection Methods: LocalAdmin
    2024-04-07T18:58:44.1699613-07:00|INFORMATION|Initializing SharpHound at 6:58 PM on 4/7/2024
    2024-04-07T18:58:57.9663013-07:00|WARNING|[CommonLib LDAPUtils]Failed to setup LDAP Query Filter: Error creating LDAP connection: GetDomain call failed for
    2024-04-07T18:58:57.9663013-07:00|ERROR|Error running SharpHound: Failed to setup LDAP Query Filter
       at SharpHoundCommonLib.LDAPUtils.<QueryLDAP>d__40.MoveNext()
       at System.Linq.Enumerable.<DefaultIfEmptyIterator>d__93`1.MoveNext()
       at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
       at SharpHoundCommonLib.LDAPUtils.TestLDAPConfig(String domain)
       at Sharphound.SharpLinks.TestConnection(IContext context) in D:\a\SharpHound\SharpHound\src\Sharphound.cs:line 148
       at Sharphound.Program.<>c__DisplayClass0_0.<<Main>b__1>d.MoveNext() in D:\a\SharpHound\SharpHound\src\Sharphound.cs:line 532
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at CommandLine.ParserResultExtensions.<WithParsedAsync>d__20`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Sharphound.Program.<Main>d__0.MoveNext() in D:\a\SharpHound\SharpHound\src\Sharphound.cs:line 406
    

    It appears to be a permissions issue, above output was ran as local admin user from console session. Runs fine as SYSTEM under remote shell.

  23. nga1hte commented on Apr 11, 2024

    @nga1hte

    people are asking for workarounds, and I still observe this on HTB Sauna and Forest as of today, WHY is this issue closed then @JonasBK ?!

    still getting the "ERROR|Unable to connect to LDAP, verify your credentials"

    .\SharpHound.exe --DisableCertVerification --DisableSigning --Domain EGOTISTICAL-BANK.LOCAL --ldapusername svc_loanmgr --ldappassword '...'

    Resetting the machine works for me.

  24. htinaunglu commented on Apr 14, 2024

    @htinaunglu

    people are asking for workarounds, and I still observe this on HTB Sauna and Forest as of today, WHY is this issue closed then @JonasBK ?!

    still getting the "ERROR|Unable to connect to LDAP, verify your credentials"

    .\SharpHound.exe --DisableCertVerification --DisableSigning --Domain EGOTISTICAL-BANK.LOCAL --ldapusername svc_loanmgr --ldappassword '...'

    Came here for exact issue

  25. k0rg commented on Apr 15, 2024

    @k0rg

    I had this error message today. My target environment had 389 disabled and 636 open for LDAPS

    I used the -SecureLDAP flag, but this didnt work and returned an "unable to connect to LDAP" error until I tried -DisableCertVerification and -DisableSigning, which made it work perfectly. Interestingly I had to provide domain, ldapusername and ldappassword too, with ldapusername set to user.name@internal.example.com rather than INTERNAL\user.name

    Perhaps the error message could be expanded - either to include if it is a connection security fault, or to suggest trying flags that drop security validation measures if appropriate. It would be good if the logs contained the port that was being tried also.

    This is what worked for me: adding the two LDAP flags and changing the username from DOMAIN\username to username@domain.com

  26. StavrosCaptain commented on Jul 30, 2024

    @StavrosCaptain

    If you have problem with Sharphound as above, do the following (example from sauna machine in HTB):

    a) bloodhound-python -u svc_loanmgr -p '<PASSWORD>' -d EGOTISTICALBANK.LOCAL -ns 10.10.10.175 -c All
    b) zip info.zip *.json
    c) drag&drop the .zip file in BloodHound

    To install bloodhound-python:
    sudo apt install bloodhound
    sudo pip install bloodhound-python

  27. PurpleLinux commented on Oct 25, 2024

    @PurpleLinux

    Just a quick note to anyone perusing, if you don't ad the -d <domain> flag, you will also get this error

  28. PeanTaster commented on Sep 3, 2025

    @PeanTaster

    Same issue with version 2.7.1

    Does not work when connected via winrm. Via RDP works fine

    *Evil-WinRM* PS C:\Users\john.doe\Documents> ./SharpHound.exe -c all
    2025-09-03T01:22:07.0147059+00:00|INFORMATION|This version of SharpHound is compatible with the 5.0.0 Release of BloodHound
    2025-09-03T01:22:07.2123392+00:00|INFORMATION|Resolved Collection Methods: Group, LocalAdmin, GPOLocalGroup, Session, LoggedOn, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote, UserRights, CARegistry, DCRegistry, CertServices, LdapServices, WebClientService, SmbInfo, NTLMRegistry
    2025-09-03T01:22:07.2451080+00:00|INFORMATION|Initializing SharpHound at 1:22 AM on 9/3/2025
    2025-09-03T01:22:07.4242785+00:00|INFORMATION|Resolved current domain to domain.local
    2025-09-03T01:22:07.6603284+00:00|INFORMATION|[CommonLib LdapConnectionPool]We will not be able to connect to domain domain.local by any strategy, leaving it.
    System.DirectoryServices.Protocols.DirectoryOperationException: An operation error occurred.
    
    Server stack trace:
       at System.DirectoryServices.Protocols.LdapConnection.ConstructResponse(Int32 messageId, LdapOperation operation, ResultAll resultType, TimeSpan requestTimeOut, Boolean exceptionOnTimeOut)
       at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
    
    Exception rethrown at [0]:
       at System.DirectoryServices.Protocols.LdapConnection.EndSendRequest(IAsyncResult asyncResult)
       at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.ExecutionTimeSampler.<SampleExecutionTime>d__11`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.Timeout.<ExecuteWithTimeout>d__2`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.AdaptiveTimeout.<ExecuteWithTimeout>d__18`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.LdapConnectionPool.<SendRequestWithTimeout>d__42.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.LdapConnectionPool.<>c__DisplayClass38_0.<<TestLdapConnection>b__0>d.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at SharpHoundCommonLib.Helpers.<RetryOnException>d__26`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.LdapConnectionPool.<TestLdapConnection>d__38.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.LdapConnectionPool.<CreateLdapConnection>d__36.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at SharpHoundCommonLib.LdapConnectionPool.<CreateNewConnection>d__34.MoveNext()
    2025-09-03T01:22:07.6603284+00:00|ERROR|Unable to connect to LDAP: All attempted connections failed
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions