-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Exec methods do not clean up as intended resulting in hanging indefinitely #96
Comments
Can be reproduced by executing |
Hey there @NeffIsBack wmiexec.pyFor wmiexec.py, it's either closed in the Lines 68 to 69 in 0b59a5b
Or Line 72 in 0b59a5b
Line 76 in 0b59a5b
So it self.iWbemServices.disconnect()
self.dcom.disconnect() at some point. So this method shouldn't be blocking. mmc.pyRegarding mmc.py, there's a missing cleaning call, you're right, and a missing A raise call should be called after the Exception: Lines 140 to 142 in 0b59a5b
As such: except Exception as e:
lsassy_logger.debug("Error : {}".format(e), exc_info=True)
self.clean()
raise Exception(e) Then, a Lines 170 to 176 in 0b59a5b
As such: self.__executeShellCommand[0].Invoke(self.__executeShellCommand[1], 0x409, DISPATCH_METHOD, dispParams, 0, [], [])
self.clean()
return True ConclusionIf you add the |
Hey there, I just tried my fix, and it seems to be working fine. If you have any other issue, please let me know. |
Sorry, didn't have the time to get back to you.
Glad i could help :) |
Version(s)
Describe the bug
While testing our test suite at NetExec i encountered the problem, that the lsassy module keeps hanging indefinitely when it fails.
Taking some time to debug it appears that exec_methods, once executed, aren't "cleaned up" properly (the
clean()
function of the exec method is never called. This leads to the dcom connection staying open and therefore the weird dcom timer stopping the main thread from executing (see screenshots below).This can be solved by simply adding
exec_method.clean()
after execution in line 291:lsassy/lsassy/dumpmethod/__init__.py
Line 291 in 0b59a5b
This will call the clean up and therefore termination of the dcom connection and its timer.
Expected behavior
The connection being terminated for each exec method.
Additional Info
As i am not that deep into lsassy i can't say that adding that line won't break any exec_method, as
clean()
is not implemented in the exec protocol interfaceIExec
. This should probably get added there.Screenshots
Without calling
clean()
:With the added
exec_method.clean()
line:Debugging:
Added print statement for debugging:
The text was updated successfully, but these errors were encountered: