Services (SVCCTL)
Theory
Windows services can also be leveraged to run arbitrary commands since they execute a command when started. When using sc, it will try to connect to the Service Control Manager (SVCCTL) remote service program through RPC in several ways:
By using MS-SCMR protocols over RPC to connect EMP at port 135. WIll ask for the SVCCTL RPC Endpoint wich is a dynamic port
Try to reach SVCCTL Through SMB named pipes (\PIPE\svcctl) on port 445 (SMB) or 139 (SMB over NetBIOS)
Practice
Service.py
The Impacket script service.py can be use to interact with services remotely.
We also can execute commands instead of a binary
You will get an error starting the service but the commands will still be executed
Scshell.py
The script scshell.py can automate the process to spawn a shell
Resources
Last updated