Detect Multi-hop Proxy in Microsoft Sentinel
Adversaries may chain together multiple proxies to disguise the source of malicious traffic. Techniques include Tor onion routing, ProxyChains, SOCKS proxy chaining, operational relay box (ORB) networks, and peer-to-peer routing to make attribution difficult. Defenders can typically only see the last hop before their network boundary.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1090 Proxy
- Sub-technique
- T1090.003 Multi-hop Proxy
- Canonical reference
- https://attack.mitre.org/techniques/T1090/003/
KQL Detection Query
let TorPorts = dynamic([9001, 9030, 9040, 9050, 9051, 9150, 9151]);
let KnownProxyTools = dynamic(["tor.exe", "tor2web", "proxychains", "proxifier.exe", "3proxy.exe", "srelay.exe", "microsocks", "redsocks"]);
let SuspiciousProxyArgs = dynamic(["proxychains", "socks5", "socks4", "tor2web", "-D ", "DynamicForward", "ProxyJump", "-o ProxyCommand"]);
// Detection 1: Known proxy tool process creation
let ProxyProcesses = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (KnownProxyTools)
or ProcessCommandLine has_any (SuspiciousProxyArgs)
| extend DetectionType = "ProxyToolLaunch"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionType;
// Detection 2: Network connections to Tor ports
let TorConnections = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where RemotePort in (TorPorts)
| where RemoteIPType == "Public"
| extend DetectionType = "TorPortConnection"
| project Timestamp, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine,
RemoteIP, RemotePort, RemoteUrl, DetectionType;
// Detection 3: SSH used as multi-hop proxy (dynamic forwarding / ProxyJump)
let SSHProxyChain = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("ssh.exe", "ssh", "plink.exe")
| where ProcessCommandLine has_any ("-D ", "-w ", "ProxyJump", "-J ", "-o ProxyCommand", "DynamicForward")
| extend DetectionType = "SSHMultiHopProxy"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionType;
// Union all detections
ProxyProcesses
| union TorConnections
| union SSHProxyChain
| sort by Timestamp desc Detects multi-hop proxy usage across three detection vectors using Microsoft Defender for Endpoint tables: (1) Known proxy tool processes such as tor.exe, proxychains, proxifier.exe, 3proxy.exe being launched or command lines containing proxy-related arguments; (2) Network connections to well-known Tor ports (9001, 9030, 9050, 9051, 9150, 9151) to public IPs; (3) SSH/Plink invocations using dynamic port forwarding or ProxyJump flags that enable multi-hop tunneling. Results are unioned and tagged with a DetectionType for analyst triage.
Data Sources
Required Tables
False Positives & Tuning
- Security researchers or penetration testers legitimately running Tor or proxy tools in authorized lab environments
- Privacy-conscious employees using Tor Browser for legitimate personal browsing on non-managed devices that surface telemetry
- SSH administrators using dynamic port forwarding (-D) or ProxyJump (-J) for legitimate bastion-host access patterns
- VPN client software that internally routes through SOCKS5 on ports overlapping with Tor defaults (e.g., 9050)
- Developer environments running local proxy tools (Proxifier, Privoxy) for testing API calls through corporate proxies
Other platforms for T1090.003
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Launch Tor Process as SOCKS Proxy
Expected signal: Sysmon Event ID 1: Process Create with Image path in %TEMP%\tortest\tor\tor.exe and CommandLine containing --SocksPort 9050. Sysmon Event ID 3: Multiple outbound TCP connections to public IPs on ports 9001 and 9030 (Tor directory and guard connections). Sysmon Event ID 11: File creation events for tor.exe and torrc in non-standard temp path.
- Test 2ProxyChains Multi-hop Configuration and Execution
Expected signal: Linux auditd/syslog: Process creation for proxychains4 with command line referencing the config file. Sysmon for Linux (if deployed) Event ID 1: Process Create for proxychains4 with full command line. Network connection attempts through the configured SOCKS chain. File creation event for /tmp/test_proxychains.conf.
- Test 3SSH Dynamic Port Forwarding (Multi-hop SOCKS Proxy)
Expected signal: Sysmon Event ID 1 (Linux) or Security Event ID 4688 (Windows with OpenSSH): Process Create for ssh with CommandLine containing '-D 1080' or '-J jumphost.example.com'. Sysmon Event ID 3: Outbound TCP connection to 192.0.2.1:22 and jumphost.example.com:22. The -D flag creates a listening socket on local port 1080 visible in netstat/socket monitoring.
- Test 4SOCKS Proxy via Netcat/Ncat Relay Chain Simulation
Expected signal: Sysmon Event ID 1: Multiple ncat.exe or nc.exe process creation events with -l (listen) and -c (command/forward) flags. Sysmon Event ID 3: Network listen and connection events on ports 18080 and 18081. Security Event ID 4688 (if command line auditing enabled): ncat.exe process creation with forwarding arguments.
References (12)
- https://attack.mitre.org/techniques/T1090/003/
- https://en.wikipedia.org/wiki/Onion_routing
- https://cloud.google.com/blog/topics/threat-intelligence/china-nexus-espionage-orb-networks
- https://unit42.paloaltonetworks.com/manageengine-godzilla-nglite-kdcsponge/
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa21-200a
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-129a
- https://www.welivesecurity.com/2018/10/17/greyenergy-updated-arsenal-dangerous-threat-actors/
- https://www.torproject.org/about/history/
- https://github.com/rofl0r/proxychains-ng
- https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1090.003/T1090.003.md
Unlock Pro Content
Get the full detection package for T1090.003 including response playbook, investigation guide, and atomic red team tests.