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

Fix impacket hard-coded timeout for PINGTimer #3654

Closed
ilija-lazoroski opened this issue Sep 4, 2023 · 7 comments
Closed

Fix impacket hard-coded timeout for PINGTimer #3654

ilija-lazoroski opened this issue Sep 4, 2023 · 7 comments
Assignees
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Medium Impact: Low

Comments

@ilija-lazoroski
Copy link
Contributor

Describe the bug

Using impacket's WMI there is a timeout that waits about 120 seconds and makes WMI Exploiter looks like it is hanging. As per fortra/impacket#1599 they would want a PR about this. This is related to #3543

Expected behavior

Make a PR in impacket about the hard-coded timeout and test it.
Add our own timeout in the WMI and test the plugin.

Machine version (please complete the following information):

  • OS: Windows
@ilija-lazoroski ilija-lazoroski added Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Impact: Low Complexity: Medium labels Sep 4, 2023
@XiaoliChan
Copy link

XiaoliChan commented Sep 5, 2023

Hello, I also have this issue, if the firewall reject the stringbinding port like ‘ncacn_ip_tcp:192.168.1.1[49666]’, it will hanging long time.

But different from you, I think this is caused by
https://github.com/fortra/impacket/blob/master/impacket/dcerpc/v5/dcomrt.py#L1294

As you can see, it doing hard-coding 300s after get stringbinding and making the RPC connection

I made the dcom change with this PR
mpgn/impacket#1

And I tested with

dcom = DCOMConnection(...)
dcom.set_connect.timeout(10)

Can confirm it works

@ilija-lazoroski
Copy link
Contributor Author

Hey @XiaoliChan, I think both of these are issues. I don't see why they would add 120 second ping timeout. In the fortra/impacket#1599 I am seeing 120s between "hanging" which really says that that is the first issue. I will try to get them a PR about it and check to see if I still get any timeout.

@XiaoliChan
Copy link

Hey @XiaoliChan, I think both of these are issues. I don't see why they would add 120 second ping timeout. In the fortra/impacket#1599 I am seeing 120s between "hanging" which really says that that is the first issue. I will try to get them a PR about it and check to see if I still get any timeout.

My solution is write a dcom firewall checker function to avoid the hanging

@ilija-lazoroski ilija-lazoroski self-assigned this Dec 22, 2023
@ilija-lazoroski
Copy link
Contributor Author

Hey @XiaoliChan,

I can confirm that you were right. The ping timer doesn't cause the hanging and the dcom firewall checker does avoid the hanging. Thanks a lot for the help.

Mind asking why you haven't submit PR to the impacket repo about this? Are you planning to do so and if not you mind if I do it?

@XiaoliChan
Copy link

XiaoliChan commented Dec 25, 2023

Mind asking why you haven't submit PR to the impacket repo about this? Are you planning to do so and if not you mind if I do it?

HAHA, because my solution is to add a global variable because the function in dcomrt.py is freaking hard to trace it, but I think it's ugly coding XD

Reference:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error, flaw, misbehavior or failure in the Monkey or Monkey Island. Complexity: Medium Impact: Low
Projects
Status: Done
Development

No branches or pull requests

2 participants