mitigated

Someone tried Plex2Shell on my server

I read that Plex servers were being taken over through a new exploit chain, and found the same exploit kit in my own logs.

In October someone ran a public exploit kit for Plex2Shell against my Plex server. Both attempts bounced, because I had been on the fixed version for over a month, and a check afterwards found nothing on the machine. It was still a good reason to look at what actually keeps the server safe.

What Plex2Shell is

It chains four bugs in Plex Media Server into remote code execution, no login needed. Plex fixed them on 1 September. The proof of concept went public in mid-October, and within a day attackers were installing crypto miners and proxy malware on unpatched servers.

Did it reach me?

After reading about the attacks, I went through my logs. On 18 October, an address from the published list of attackers made two attempts a few hours apart. Both got an error back. I found no miners, no proxy software, and no new programs in Plex’s data folder.

Plex’s own port was never open to the internet, and that didn’t matter. A reverse proxy that forwards to Plex exposes it just as much as an open port.

The tools that kept it out

  • What’s Up Docker is why I was patched in time. It told me about the fix and I applied it. Since this incident it updates Plex by itself.
  • SWAG is my reverse proxy. Only a few apps are public through it. The rest answer only on my home network.
  • Tailscale is how I reach the private apps from anywhere, so they never need to face the internet at all.

The tool I added

fail2ban already ran inside SWAG, but its usual rules only react to repeated failures, and an exploit kit’s requests don’t have to fail. I first added a rule that banned requests that looked like an exploit kit or a scanner. It banned about 90 addresses in its first week. But fail2ban reacts to log lines, so the first request still reached Plex. In November I moved the check in front: nginx now rejects those requests before they reach any app, and fail2ban bans addresses that keep trying.

I also blocked the published attacker addresses, but I expect the rule to matter more. A fixed list goes stale as attackers move on. A rule that recognises what a request looks like keeps working.

Where it ended up

Mitigated. Updates did the real work, and the nginx check only stops attacks it recognises.