333 compromised Tor exit relays used to hijack SSH logins
About 10% of Tor exit relays were infected and used to collect unencrypted mail and redirect SSH sessions to servers that tried to install Ebury.

A researcher found that 333 Tor exit relays, roughly 10% of the network’s approximately 3,000 exits, had been compromised. The attackers used them to collect unencrypted mail traffic and to intercept SSH connections. Users who ignored SSH’s host key warning had their passwords stolen and their servers infected with the Ebury backdoor. The Tor Project flagged the relays as BadExit, and within days all of them were offline.
How the attack worked
According to the researcher’s write-up, the attackers gained access to the servers in August and quietly deployed Ebury 1.8.3, an OpenSSH backdoor and credential stealer for Linux. Two months later, on Friday, October 2, at 09:35, the infected exits began a coordinated campaign.
The campaign had two goals. First, by blocking certain ports, the attackers made their exits carry only unencrypted mail traffic, which they collected. Second, they intercepted SSH. Any connection on port 22 leaving through one of the infected exits was silently redirected to one of 12 SSH interception servers.
Regular encrypted web traffic was forwarded as usual. The attack did not break HTTPS or the anonymity of the Tor network as a whole.
The warning users had to ignore
For the SSH attack to succeed, a user had to connect through Tor, see OpenSSH’s “REMOTE HOST IDENTIFICATION HAS CHANGED” warning, ignore it and log in with a password. If they did, the attacker:
- stole the password
- opened a connection to the real server and watched every command the user typed
- opened a second connection to the server and infected it with Ebury
The researcher ran into the warning on the Friday morning the campaign started.
Takedown timeline
The researcher reported the findings to the Tor Project’s network health team on Friday evening. The team said it had not seen an attack like this before and began contacting relay operators.
- Oct 2: Interception began.
- Oct 4: The health team notified operators, who started shutting down their exits. The relays were marked BadExit, so clients stopped using them to exit traffic.
- Oct 5: The attackers restarted many relays, but because they were flagged they could only act as middle relays. By the end of the day all infected servers were shut down, partly by operators and partly by the attackers.
The health team said the attacker appeared to be gaining access to Linux hosts and, where those machines were running as non-exit relays, editing the torrc file to turn them into exits. A dip in exit capacity is visible on Tor’s metrics site from October 4.
How the relays were found
Using the exitmap tool, the researcher pinned each exit relay in turn and opened an SSH connection between two of their own servers. One server checked whether it received the correct host fingerprint. The other checked whether the connection arrived from the pinned exit or from one of the 12 interception servers.
Across all ~3,000 exits, around a dozen served a fake fingerprint and more than 300 redirected traffic through the interception servers without presenting a fake key. Redirection alone was enough to confirm infection.
A honeypot built with sshesame showed that the attackers used paramiko, a Python SSH library. Their script first checked user ID and sudo permissions, then ran a base64-encoded payload through Perl to install Ebury.
Open questions
How the attackers got into so many servers is unknown. One theory discussed on Tor mailing lists is that a hosting company was hacked, but this is unconfirmed. Attribution is also unclear. The use of Ebury and the broad collection of unencrypted data point to a financially motivated crime group, though the researcher stresses this is speculation.
Marc-Etienne M. Léveillé noted on the Tor mailing list that, given about 400,000 servers had Ebury between 2009 and 2023, other compromised Tor relays are likely still out there.
Key takeaways
- 333 Tor exits (about 10%) were compromised and used to steal unencrypted mail and hijack SSH logins; all are now offline.
- HTTPS traffic stayed encrypted. Victims had to ignore SSH’s host key warning and log in with a password.
- Never ignore a changed host key warning, and disable SSH password authentication in favor of keys.
- Tor exits should never see unencrypted sensitive data. End-to-end encryption remains the user’s responsibility.


