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

Execution Hangs in Remote Host using dcomexe.py #1666

Open
sud0Ru opened this issue Dec 16, 2023 · 0 comments
Open

Execution Hangs in Remote Host using dcomexe.py #1666

sud0Ru opened this issue Dec 16, 2023 · 0 comments

Comments

@sud0Ru
Copy link

sud0Ru commented Dec 16, 2023

Configuration

impacket version: v0.11.0
Python version: 3.11.6
Target OS: Windows 10.0.19045

Debug Output With Command String

python3 ./dcomexec.py Administrator:P@$$w0rd@192.168.177.164 -debug
Impacket v0.11.0 - Copyright 2023 Fortra

[+] Impacket Library Installation Path: /usr/lib/python3/dist-packages/impacket
[*] SMBv3.0 dialect used
[+] Target system is 192.168.177.164 and isFQDN is False
[+] StringBinding: DESKTOP[59394]
[+] StringBinding: 192.168.177.164[59394]
[+] StringBinding chosen: ncacn_ip_tcp:192.168.177.164[59394]
[+] Target system is 192.168.177.164 and isFQDN is False
[+] StringBinding: DESKTOP[59394]
[+] StringBinding: 192.168.177.164[59394]
[+] StringBinding chosen: ncacn_ip_tcp:192.168.177.164[59394]
[+] Executing: /Q /c cd \ 1> \\127.0.0.1\ADMIN$\__17027 2>&1

Additional context

1. Issue:
When attempting to utilize dcomexe.py to execute a command on a remote host, the execution hangs after the cd command. Upon debugging and analyzing network traffic, it is evident that the ShellExecute function is called successfully. However, the issue appears when SMB client attempts to retrieve the command output file.

2. The cause of the issue:
It appears that the ShellWindows and ShellBrowserWindow COM objects in Windows 10 lack write permissions in the ADMIN$ or C$ shares.

3. Temporary solution:
As a quick and viable solution, modify the OUTPUT_FILENAME variable in dcomexec.py on line 62 to redirect the output to the Temp folder under the Admin$ share.
OUTPUT_FILENAME = 'Temp\\__' + str(time.time())[:5]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant