Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / WINDOWS / LATERAL MOVEMENT

Port Forwarding

This note documents detection patterns related to Port Forwarding within Windows environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security4688Process creationCriticalPrimary signal for native and third-party port forwarding. Hunt for netsh interface portproxy, ssh -L, ssh -R, ssh -D, plink.exe, chisel, socat, frp, rinetd, meterpreter, ligolo, stunnel, and custom relays. Review full command line, parent process, integrity level, and user context.
Sysmon1Process creationCriticalBest host-level visibility for forwarding commands, dropped tunnel binaries, parent-child chains, and repeated operator use. Useful for detecting both transient tunnels and persistent forwarding infrastructure.
Sysmon3Network connectionCriticalCore behavioral signal. Port forwarding often produces a listener-side process that also establishes outbound connections to another host. Correlate source listener, destination IP/port, and same PID/process lineage.
Security5156Windows Filtering Platform permitted connectionHighUseful when Sysmon is absent. Can confirm inbound and outbound connections tied to forwarding tools, svchost.exe, ssh.exe, or unknown binaries.
Sysmon13Registry value setCriticalPrimary registry signal for native Windows netsh interface portproxy. Captures writes under HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\.... Strong evidence of persistent port proxy rules.
Sysmon12Registry object create/deleteHighUseful for creation or deletion of PortProxy subkeys and related tunnel persistence scaffolding.
Security4657Registry value modifiedHighNative registry auditing equivalent if enabled. Valuable when Sysmon is unavailable.
PowerShell4104Script block loggingCriticalCaptures PowerShell-based forwarding, socket relays, netsh invocation, firewall rule creation, SSH tunneling wrappers, or custom pivot scripts.
PowerShell4103Module loggingHighUseful for cmdlet-level confirmation such as New-NetFirewallRule, Start-Process, New-Object System.Net.Sockets.TcpListener, and custom relay logic.
System7045Service installedHighSome tunnel tools install helper services or persistence wrappers. Investigate service-backed port forwarding or hidden tunnel daemons.
System7040Service start type changedMediumImportant when attackers enable required services such as iphlpsvc or modify tunnel-related services to survive reboot.
Security4697Service installedHighNative service installation signal with subject-user context when auditing is enabled. Useful for service-backed tunnel implants.
Sysmon7Image loadedMediumCan reveal SSH/tunnel helpers, custom DLL-backed relays, or networking libraries loaded by suspicious processes.
Sysmon11File createHighTunnel binaries, config files, SSH keys, helper scripts, and staging artifacts are often dropped shortly before forwarding is enabled.
Microsoft-Windows-Windows Firewall With Advanced Security/Firewall2004 / 2005 / 2006 (environment dependent)Firewall rule changesHighHelpful when attackers add allow rules around the same time as port forwarding. Exact event availability varies by configuration and OS version.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
New local listener on unusual portHigh ports or uncommon service ports suddenly listening on workstation/serverCriticalOne of the strongest generic pivot indicators. Validate whether the host is expected to expose that port and whether it appeared recently.
Same process both listens and connects outwardOne PID accepts inbound traffic and also connects to another host/portCriticalCanonical forwarding behavior. Extremely valuable in EDR or Sysmon 3 correlation.
New netsh interface portproxy rulev4tov4, v4tov6, v6tov4, or v6tov6 entries appear unexpectedlyCriticalVery strong signal of native Windows forwarding. Often overlooked because no obvious third-party binary is required.
iphlpsvc enabled or started unexpectedlyIP Helper service modified or started near PortProxy creationHighNative netsh portproxy depends on IP Helper. Correlate with service changes and registry writes.
Firewall rule added near forwarding setupNew inbound allow rule for forwarded/listener portHighAttackers frequently pair forwarding with firewall changes to ensure reachability.
Listener bound to loopback only127.0.0.1 or ::1 listener later used by a second-stage clientHighCommon stealth tactic. Not externally visible, but still useful for local relay or covert chaining.
Forwarder binary in user-writable pathAppData, Temp, Public, ProgramData, DownloadsCriticalStrong malicious signal for plink/chisel/frp/custom tunnels.
SSH/plink activity from non-admin workstationDeveloper-style tunneling commands on an unusual endpointHighCan indicate covert pivoting or operator staging. Baseline is essential.
Port forwarding appears after foothold activityTunnel setup shortly after credential theft, remote exec, or service creationCriticalVery common attacker progression: foothold → stabilize → pivot infrastructure.
Long-lived established sessions to internal targetsOne host repeatedly relays traffic to otherwise inaccessible subnetsHighSuggests the machine is acting as a pivot node.
Service-backed forwarderService binary or DLL silently maintains listenerHighIndicates persistence, not just temporary operator activity.
SOCKS/dynamic forwarding behaviorLocal high port open, multiple destinations reached through same processHighOften associated with SSH -D, ligolo-ng, Cobalt Strike SOCKS, or similar pivot tooling.

Common Tools

ToolUsage
netshNative Windows interface portproxy forwarding; persists via registry and commonly abused because it blends in with built-in tooling.
sshSupports local (-L), remote (-R), and dynamic (-D) port forwarding; often used on Windows via OpenSSH or on Linux pivot hosts.
plink.exePuTTY-based SSH client often used for scripted port forwarding on Windows endpoints.
chiselHTTP/WebSocket-based tunneling and forwarding tool commonly used for red-team pivoting.
ligolo-ngAgent/proxy-based tunneling used to reach internal networks through a compromised host.
socatGeneral-purpose relay that can forward TCP/UDP locally or remotely.
frpFast reverse proxy often used to expose internal services outward or bridge segments.
rinetdSimple TCP forwarding daemon sometimes used for lightweight relay setups.
Meterpreterportfwd and SOCKS capabilities for operator pivoting.
Cobalt StrikeSOCKS proxy and pivot listeners for internal routing and lateral movement.
Custom socket relays / PowerShell tunnelsAttackers frequently build ad hoc relays with .NET sockets, TcpListener, or wrapper scripts to avoid known tool signatures.

Relevant Artifacts

  • Security log 4688 for process creation with full command line where available
  • Sysmon 1, 3, 11, 12, 13 for process execution, network connections, file drop, and PortProxy registry changes
  • Security 5156 for connection approval telemetry if Sysmon is unavailable
  • PowerShell logs 4103 / 4104 for script-based forwarding, firewall changes, or custom socket relay logic
  • System 7040 / 7045 and Security 4697 for service-backed forwarding or required service changes
  • Registry:
    • HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v4tov4\tcp
    • HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v4tov6\tcp
    • HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v6tov4\tcp
    • HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v6tov6\tcp
  • Registry/service dependency:
    • HKLM\SYSTEM\CurrentControlSet\Services\iphlpsvc
  • Firewall-related registry context:
    • HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy
  • Native inspection commands:
    • netsh interface portproxy show all
    • sc qc iphlpsvc
    • netstat -ano
    • Get-NetTCPConnection
  • Prefetch where applicable:
    • NETSH.EXE
    • SSH.EXE
    • PLINK.EXE
    • CHISEL.EXE
    • SOCAT.EXE
  • Amcache/ShimCache for execution evidence and binary paths of forwarding tools
  • MFT / USN Journal for dropped tunnel binaries, configs, scripts, or key material
  • SRUM for post-forwarding network usage on workstations where available
  • EDR process/socket lineage to prove same process handled both listen and relay phases
  • Firewall logs, proxy logs, and network telemetry for confirming data passed through the pivot host
  • Service configuration and persistence artifacts if the forwarder is wrapped as a service or scheduled task

MITRE ATT&CK References

  • T1090 Proxy
  • T1090.001 Internal Proxy
  • T1090.002 External Proxy
  • T1090.003 Multi-hop Proxy
  • T1090.004 Domain Fronting / protocol-adjacent proxy behavior (contextual depending on tooling)
  • T1572 Protocol Tunneling
  • T1047 Windows Management Instrumentation (contextual if WMI used to deploy the forwarder)
  • T1569.002 Service Execution (contextual if tunnel deployed as a service)

Decision Tree

  1. Is the suspicious event present?
    • Look for 4688 / Sysmon 1 showing netsh interface portproxy, ssh -L/-R/-D, plink, chisel, ligolo, or other relay tooling.
    • Check for Sysmon 13 / 12 registry writes under PortProxy.
  2. What host and process generated it?
    • Identify the exact host, user, integrity level, parent process, and full command line.
    • Determine whether the process is a built-in utility (netsh, ssh) or a dropped third-party binary.
  3. Is there a listener?
    • Validate with Sysmon 3, EDR socket telemetry, netstat, or connection logs whether a local listener was established.
    • Record bind address, local port, and whether the listener is loopback-only or externally reachable.
  4. Is there an outbound relay destination?
    • Confirm whether the same process or a tightly linked child process connected to another system.
    • Map destination IP, port, protocol, and timing relative to inbound activity.
  5. Is this persistent or temporary?
    • For native Windows forwarding, inspect PortProxy registry keys and the state of IP Helper (iphlpsvc).
    • For third-party tools, check for services, scheduled tasks, Run keys, Startup folder, config files, or helper scripts.
  6. Pivot:
    • Source host → process execution
      • Hunt for file drops, configs, SSH keys, helper scripts, and repeated tunnel invocations.
    • Network → internal access expansion
      • Identify which internal systems became reachable only after the forwarder was established.
    • Adjacent admin changes
      • Check for firewall rules, service installation, credential use, LocalAccountTokenFilterPolicy, ADMIN$ access, or remote exec nearby.
  7. Confirm scope and intent
    • Was this developer/admin activity, enterprise remote support, or attacker pivot infrastructure?
    • Determine whether the host acted as a single-use tunnel endpoint or a durable pivot node.

Example Detection Templates

KQL

// Native and tool-based port forwarding command-line hunt
let terms = dynamic(["portproxy","ssh -L","ssh -R","ssh -D","plink","chisel","ligolo","socat","frp","rinetd","portfwd"]);
union isfuzzy=true SecurityEvent, Sysmon
| where EventID in (4688, 1)
| extend Image = coalesce(tostring(NewProcessName), tostring(Image), tostring(Process)),
         CommandLine = coalesce(tostring(CommandLine), tostring(ProcessCommandLine)),
         ParentImage = coalesce(tostring(ParentProcessName), tostring(ParentImage))
| where CommandLine has_any (terms) or Image has_any ("netsh.exe","ssh.exe","plink.exe","chisel.exe","ligolo.exe","socat.exe","frpc.exe","frps.exe")
| project TimeGenerated, Computer, User=coalesce(tostring(SubjectUserName), tostring(User), tostring(UserName)), Image, CommandLine, ParentImage, EventID
| order by TimeGenerated desc
// Native Windows PortProxy registry hunt
Sysmon
| where EventID in (12, 13)
| where TargetObject has @"\SYSTEM\CurrentControlSet\Services\PortProxy\"
| project TimeGenerated, Computer, User, EventID, TargetObject, Details, Image, ProcessGuid, ProcessId
| order by TimeGenerated desc
// Correlate forwarding process creation with later network activity from same host/process
let Forwarders = Sysmon
| where EventID == 1
| extend Image = tostring(Process), CommandLine = tostring(CommandLine), ProcessId = tostring(ProcessId)
| where CommandLine has_any ("portproxy","ssh -L","ssh -R","ssh -D","plink","chisel","ligolo","socat","frp","portfwd")
   or Image has_any ("netsh.exe","ssh.exe","plink.exe","chisel.exe","ligolo.exe","socat.exe","frpc.exe","frps.exe")
| project FwdTime=TimeGenerated, Computer, ProcessId, Image, CommandLine, ParentImage=tostring(ParentProcessName), User=tostring(User);
let Net = Sysmon
| where EventID == 3
| extend ProcessId = tostring(ProcessId)
| project NetTime=TimeGenerated, Computer, ProcessId, DestinationIp, DestinationPort, SourceIp, SourcePort, Protocol, Image=tostring(Image);
Forwarders
| join kind=leftouter (Net) on Computer, ProcessId
| where NetTime between (FwdTime .. FwdTime + 30m)
| project FwdTime, NetTime, Computer, User, Image, CommandLine, ParentImage, SourceIp, SourcePort, DestinationIp, DestinationPort, Protocol
| order by FwdTime desc
// Hunt for IP Helper service changes around PortProxy creation
let PortProxyChanges = Sysmon
| where EventID in (12, 13)
| where TargetObject has @"\SYSTEM\CurrentControlSet\Services\PortProxy\"
| project PPTime=TimeGenerated, Computer, User, TargetObject;
let ServiceChanges = union isfuzzy=true SystemEvent, SecurityEvent
| where EventID in (7040, 7045, 4697)
| project SvcTime=TimeGenerated, Computer, EventID, RenderedDescription=tostring(EventData);
PortProxyChanges
| join kind=leftouter (ServiceChanges) on Computer
| where SvcTime between (PPTime - 10m .. PPTime + 10m)
| project PPTime, SvcTime, Computer, User, TargetObject, EventID, RenderedDescription
| order by PPTime desc

EQL

/* Tooling or native commands commonly used for port forwarding */
process where
  process.command_line like "*portproxy*" or
  process.command_line like "*ssh -L*" or
  process.command_line like "*ssh -R*" or
  process.command_line like "*ssh -D*" or
  process.command_line like "*plink*" or
  process.command_line like "*chisel*" or
  process.command_line like "*ligolo*" or
  process.command_line like "*socat*" or
  process.command_line like "*frp*"
/* PortProxy registry creation following netsh command */
sequence by host.name with maxspan=5m
  [ process where process.command_line like "*netsh*portproxy*" ]
  [ registry where registry.path like "*\\SYSTEM\\CurrentControlSet\\Services\\PortProxy\\*" ]
/* Forwarding process followed by outbound network connections */
sequence by host.name, process.pid with maxspan=30m
  [ process where process.command_line like "*ssh -L*" or process.command_line like "*ssh -R*" or process.command_line like "*chisel*" or process.command_line like "*plink*" or process.command_line like "*ligolo*" ]
  [ network where true ]

Sigma

title: Suspicious Port Forwarding Activity
id: 9f7a2c44-6d1d-4b47-a0f3-port-forwarding
status: experimental
description: Detects native Windows PortProxy and common tool-based port forwarding commands frequently associated with pivoting or covert transport infrastructure.
references:
  - https://attack.mitre.org/techniques/T1090/
  - https://attack.mitre.org/techniques/T1572/
author: Vergil
date: 2026-03-07
logsource:
  product: windows
  category: process_creation
detection:
  selection_cmd:
    CommandLine|contains:
      - 'portproxy'
      - 'ssh -L'
      - 'ssh -R'
      - 'ssh -D'
      - 'plink'
      - 'chisel'
      - 'ligolo'
      - 'socat'
      - 'frp'
      - 'portfwd'
  selection_img:
    Image|endswith:
      - '\netsh.exe'
      - '\ssh.exe'
      - '\plink.exe'
      - '\chisel.exe'
      - '\ligolo.exe'
      - '\socat.exe'
      - '\frpc.exe'
      - '\frps.exe'
  condition: selection_cmd or selection_img
fields:
  - Image
  - CommandLine
  - ParentImage
  - User
falsepositives:
  - Legitimate administrator tunneling
  - Developer SSH tunnels
  - Approved remote support tooling
  - Network engineering diagnostics
level: high
tags:
  - attack.command_and_control
  - attack.t1090
  - attack.t1572
title: Native Windows PortProxy Registry Modification
id: 4c5fd447-e1fd-4ed9-b8f0-portproxy-registry
status: experimental
description: Detects registry modifications associated with native Windows netsh interface portproxy forwarding.
references:
  - https://attack.mitre.org/techniques/T1090/
author: Vergil
date: 2026-03-07
logsource:
  product: windows
  category: registry_set
detection:
  selection:
    TargetObject|contains: '\SYSTEM\CurrentControlSet\Services\PortProxy\'
  condition: selection
fields:
  - TargetObject
  - Details
  - Image
  - User
falsepositives:
  - Legitimate portproxy administration
level: high
tags:
  - attack.command_and_control
  - attack.t1090

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Native forwarding controlMonitor and tightly restrict use of netsh interface portproxy; regularly review PortProxy registry keysHighNative PortProxy is powerful because it survives reboot and blends with legitimate Windows tooling.
Registry auditingAlert on changes under HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\*HighEssential for detecting persistent native forwarding. Many defenders miss this entirely.
IP Helper service governanceBaseline and monitor iphlpsvc start type and state changesMediumPortProxy depends on IP Helper; unexpected enablement or start activity can provide valuable context.
Process command-line monitoringLog and alert on ssh -L/-R/-D, plink, chisel, ligolo, socat, and similar forwarding syntaxHighCore visibility for transient operator tunnels that leave no registry footprint.
Firewall change monitoringCorrelate forwarding activity with new inbound allow rules or firewall policy changesHighA forwarding rule plus firewall modification is a strong combined signal.
Application controlRestrict unapproved tunneling tools and unsigned networking binaries from user-writable pathsHighReduces attacker flexibility and raises detection opportunities.
Network egress controlsLimit which hosts can initiate outbound connections to internal segments or unusual external portsHighMakes pivot infrastructure harder to sustain.
Listener baseliningContinuously monitor for new listening ports and unexpected bind behavior on workstations and serversHighStrong general pivot detection, especially where process telemetry is incomplete.
Service / scheduled task reviewHunt for tunnel persistence wrapped as services, tasks, Run keys, or Startup entriesMediumThird-party tunnel tools are often made durable with common Windows persistence mechanisms.
Endpoint visibilityPrefer EDR or Sysmon configurations that can correlate process lineage with socket activityCriticalBest method for proving the host is acting as a relay rather than merely making ordinary outbound connections.