[WMI] Reuse DCOM fix - #1390
Open
XiaoliChan wants to merge 2 commits into
Open
Conversation
…MConnection When running over the wmi protocol the module now reuses the protocol's authenticated IWbemLevel1Login instead of creating its own DCOMConnection to the same target - whose disconnect would clash with the protocol's own on impacket versions that do not guard the INTERFACE.CONNECTIONS thread entry (KeyError: ThreadPoolExecutor-x_x). Over smb nothing changes: the module still creates its own DCOMConnection since the protocol has none.
…nd DCOMConnection Same pattern as the rdp module fix: BitLockerWMI creates its own DCOMConnection to the same target the wmi protocol already holds one for, and disconnecting it removes the shared INTERFACE.CONNECTIONS thread entry, so the protocol-level disconnect afterwards raises KeyError on impacket versions that do not guard it. Reuse the protocol's IWbemLevel1Login instead - over smb nothing changes.
XiaoliChan
requested review from
Marshall-Hallenbeck,
NeffIsBack,
mpgn and
zblurx
as code owners
September 6, 2026 11:37
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
rdpandbitlockermodules were creating their own DCOMConnection when running over the wmi protocol, which already holds one. Two DCOMConnections to the same target share impacket's global registries (INTERFACE.CONNECTIONS,PORTMAPS, OXID resolver): whichever disconnects first deletes the shared entries, and the other's disconnect raisesKeyError. Both modules now reuse the protocol's authenticatedconnection.iWbemLevel1Logininstead — one DCOM per target, the lifecycle stays with the protocol.Type of change
Setup guide for the review
Just install imapcket
Screenshots (if appropriate):
Checklist:
poetry run ruff check ., use--fixto automatically fix what it can)tests/e2e_commands.txtfile if necessary (new modules or features are required to be added to the e2e tests)