-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Added Support for LDAPS When Retrieving LAPS Password from Windows Server 2025 #1942
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
Conversation
hey @Ibrahim8879 , Thanks for this PR! In the |
hi @gabrielg5 , thanks for the quick response. here's the details of my testing: As mentioned in the issue, the Server 2025 setup enforces LDAPS. In my environment, Server 2025 is configured to handle only LDAPS for LAPS password requests—LDAP requests are not allowed at all. When I tested your implementation in this environment, it initially tries to connect via LDAP and does not automatically switch to LDAPS, resulting in a timeout. That’s why I added the -ldaps flag—to ensure the connection uses LDAPS directly. I hope this clarifies the reasoning. I’ve also attached a screenshot for further clarification, showing LAPS password requests with and without the -ldaps flag. |
Hey, Creating a 2025 environment here to test. |
Sounds good — I’ll try implementing this since I already have the environment set up in the library. I’ll get back to you once I’ve tested it. |
Hey @gabrielg5 , |
hey @gabrielg5 , |
Hey @Ibrahim8879, hello! I was referring more to changing the ldap_login function impacket/impacket/examples/utils.py Line 262 in c384b5f
Think it's better in terms of classes responsibilities This is the one used by that example (and some others as well) to handle it. So, by changing this behavior there, we are also fixing the issue in a more global standard way. That function is handling errors with the non-SSL connection and retrying with LDAPS impacket/impacket/examples/utils.py Lines 285 to 292 in c384b5f
Currently only retrying when strongerAuthRequired is in the exception message; we should also consider this new scenario there
|
hi @gabrielg5 , |
Hey @Ibrahim8879, don't hate me that much for this... we've been talking internally with other maintainers and agreed that it is not desired that the tool takes decisions in behalf of the operator (like going through ldaps if ldap timeouts) I'm setting up an environment here to test and validate the PR asap Thanks and sorry again for this back and forth in this |
Also, to replicate your same scenario here, which configuration you have there making LDAP not reply?? |
Hi @gabrielg5 Sorry for the late response, I was busy with office work. It's all fine, this is a learning experience, so no problem at all. Regarding the configuration: I used Microsoft's guide to configure LDAP over SSL (LDAPS) by setting registry keys and applying GPOs. However, the issue with this approach is that sometimes it works as intended (forcing communication over LDAPS and blocking LDAP), but other times, it still allows LDAP connections. To ensure more consistent behavior for testing purposes, I instead added a firewall inbound rule to block LDAP traffic (port 389) directly. This is where the timeout issue starts, as I mentioned earlier, when LDAP is blocked at the firewall, there's no fallback mechanism to automatically check for LDAPS. |
ok, yeah! |
hi @gabrielg5 impacket/impacket/examples/utils.py Lines 278 to 279 in b6f5302
If the flag is not provided, the default ldap workflow is followed.
|
Hi @Ibrahim8879, last change requested before merging... Let's not make Thanks! |
Realized I could directly push that change... |
Description
Added support for LDAPS in GetLAPSPassword.py to ensure compatibility with Windows Server 2025, which enforces LDAPS over LDAP. Introduced a boolean flag
-ldaps
to enable LDAPS support when retrieving LAPS passwords.This PR addresses and resolves: #1880
Configuration
impacket version: v0.130.dev
Python version: 3.13.2
Target OS: Windows Server 2025 Datacenter Evaluation 24H2
Attacking OS: Kali
Debug Output With Command String
Screenshot