Detect External Proxy in Splunk
Adversaries may use an external proxy to act as an intermediary for network communications to a command and control server to avoid direct connections to their infrastructure. Tools like HTRAN, ZXProxy, and ZXPortMap enable traffic redirection through proxies or port redirection. External connection proxies mask the destination of C2 traffic and are typically implemented with port redirectors. Compromised systems outside the victim environment, cloud-based resources, or VPS infrastructure may be used. Victim systems communicate directly with the external proxy, which then forwards traffic to the actual C2 server.
MITRE ATT&CK
- Tactic
- Command and Control
- Technique
- T1090 Proxy
- Sub-technique
- T1090.002 External Proxy
- Canonical reference
- https://attack.mitre.org/techniques/T1090/002/
SPL Detection Query
index=wineventlog (sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" (EventCode=1 OR EventCode=3))
| eval process_lower=lower(Image)
| eval cmdline_lower=lower(CommandLine)
| eval DestPort=coalesce(DestinationPort, DestPort)
| eval DestIP=coalesce(DestinationIp, DestinationIP)
```-- Flag 1: Known proxy tool names in process image or command line --```
| eval KnownProxyTool=if(
match(process_lower, "(htran|zxproxy|zxportmap|proxychains|revsocks|chisel|frpc|frps|\.\bfrp\b|3proxy|shadowsocks|ss-local|privoxy|stunnel|iodine|dns2tcp|ptunnel|socat)") OR
match(cmdline_lower, "(htran|zxproxy|zxportmap|proxychains|revsocks|chisel|frpc|frps|3proxy|shadowsocks|ss-local|privoxy|stunnel|socat)"),
1, 0)
```-- Flag 2: SSH dynamic port forwarding (SOCKS proxy) --```
| eval SSHSocksProxy=if(
(match(process_lower, "(\\\\ssh\.exe|\\\\plink\.exe)") OR process_lower="ssh") AND
match(cmdline_lower, "(-[fnqt]*d\s+\d+|-nn\s+-d|-nt\s+-d)"),
1, 0)
```-- Flag 3: Generic SOCKS proxy arguments --```
| eval SocksArgs=if(
match(cmdline_lower, "(socks5://|socks4://|-socks[45]?\s|--socks[45]?)"),
1, 0)
```-- Flag 4: Outbound connection to proxy ports from non-browser --```
| eval ProxyPortConn=if(
EventCode=3 AND
(DestPort=1080 OR DestPort=3128 OR DestPort=8080 OR DestPort=8888 OR
DestPort=9050 OR DestPort=9051 OR DestPort=4444 OR DestPort=1337 OR
DestPort=31337 OR DestPort=8443 OR DestPort=4443) AND
NOT match(process_lower, "(chrome|firefox|msedge|iexplore|opera|brave|curl|wget)") AND
NOT match(DestIP, "^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.|127\.)"),
1, 0)
| eval SuspicionScore=KnownProxyTool + SSHSocksProxy + SocksArgs + ProxyPortConn
| where SuspicionScore > 0
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine,
DestinationIp, DestinationPort,
KnownProxyTool, SSHSocksProxy, SocksArgs, ProxyPortConn, SuspicionScore
| sort - SuspicionScore, - _time Detects external proxy usage for C2 communications using Sysmon Event ID 1 (Process Creation) and Event ID 3 (Network Connection) logs. Assigns a suspicion score based on four detection categories: known proxy tool names in process or command line, SSH dynamic port forwarding, explicit SOCKS proxy arguments, and outbound connections to common proxy ports from non-browser processes. Higher suspicion scores indicate stronger indicators of malicious proxy usage.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Legitimate SSH tunneling by administrators for database or management access via -D dynamic port forwarding
- Security researchers or penetration testers using proxy tools in authorized assessments
- Corporate proxy infrastructure where internal tools connect to a central proxy server on port 3128 or 8080
- VPN clients or privacy tools (Tor Browser, Shadowsocks) used legitimately on endpoints where these are permitted
- Development environments using tools like socat or chisel for local port forwarding during application testing
Other platforms for T1090.002
Testing Methodology
Validate this detection against 5 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 1SOCKS5 Proxy via SSH Dynamic Port Forwarding
Expected signal: Sysmon for Linux or auditd: Process creation for ssh with command line containing '-D 1080'. Network connection event showing TCP bind on 127.0.0.1:1080. If Sysmon EID 3 is available, outbound TCP connection to the target SSH server on port 2222.
- Test 2TCP Port Forwarding via Chisel Proxy Tool
Expected signal: Sysmon Event ID 1: Process Create for chisel.exe with command line containing 'client' and 'socks'. Sysmon Event ID 3: Network connection from chisel.exe to 127.0.0.1:8080. Sysmon Event ID 11: File creation of chisel.exe in %TEMP%. Security Event ID 4688 (if command line auditing enabled).
- Test 3HTRAN Port Redirector Execution
Expected signal: Sysmon Event ID 1: Process Create for cmd.exe with CommandLine containing 'htran'. If actual HTRAN binary is used in an authorized test environment: direct process creation event with '-listen' argument and IP:port parameters. Security Event ID 4688 with htran.exe image path.
- Test 4FRP (Fast Reverse Proxy) Client Configuration and Execution
Expected signal: Sysmon Event ID 11: File creation of frpc.ini in %TEMP% with content showing server_addr, server_port, and plugin=socks5. Sysmon Event ID 1: PowerShell process creation with command containing 'frpc.ini'. The configuration file content reveals the external C2 relay address (192.0.2.1).
- Test 5SOCKS Proxy via Netcat-style Listener (socat)
Expected signal: Linux auditd/Sysmon for Linux: Process creation for socat with arguments 'TCP4-LISTEN:1080' and 'TCP4:192.0.2.1:4444'. Network socket creation binding to local port 1080. If Sysmon EID 3 available: outbound connection attempt to 192.0.2.1:4444.
References (12)
- https://attack.mitre.org/techniques/T1090/002/
- https://arxiv.org/ftp/arxiv/papers/1408/1408.1136.pdf
- http://blog.trendmicro.com/trendlabs-security-intelligence/in-depth-look-apt-attack-tools-of-the-trade/
- https://www.mandiant.com/resources/blog/apt29-eye-spy-email
- https://github.com/jpillora/chisel
- https://github.com/fatedier/frp
- https://www.varonis.com/blog/what-is-htran
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa22-277a
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1090.002/T1090.002.md
- https://thedfirreport.com/2022/04/04/stolen-images-campaign-ends-in-conti-ransomware/
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicenetworkevents-table
- https://docs.splunk.com/Documentation/SplunkCloud/latest/SearchReference/CommonStatsFunctions
Unlock Pro Content
Get the full detection package for T1090.002 including response playbook, investigation guide, and atomic red team tests.