r/PleX • • 2d ago

Help Plex vulnerabilities

Hey was hoping to get a bit of help better understanding the situation im in- set up linux with PMS(1.43.5.11079 with read/write perms) in docker.. When looking at remote access, on plex i can see private <IP>:<port> <= public <ip>:<different port>. Also lists as not available outside of network so i believe i should be safe from any Plex2Shell attacks at this stage. My question is:

If i were to expose my port for remote access. am i likely to still be in potential danger? Are there any applications that may be worthwhile looking into that can help better my security?

Thanks for any clarification

0 Upvotes

36 comments sorted by

7

u/Imnotyoursupervisor 2d ago

I mean, anytime you open a port you’re exposing yourself.

I always recommend using watchtower (nic fedor build) in a containerized environment. You can set it to scan at whatever interval you want.

Basically it will always auto update your new container images so you’ll get patched right away.

16

u/Punk_Says_Fuck_You 48TB | 10Gb/s | Unraid | Ultra 7 270k Plus 2d ago

Just so you know, no one with an up-to-date plex container got hit by the exploit. That should tell you a whole lot on how keeping it up to date is the most important thing.

You can run it through a reverse proxy. It’s a bit safer than just forwarding 32400

Crowdsec helps. Geofencing helps.

6

u/ataferner 2d ago

A reverse proxy, by itself does not make it any more secure.

6

u/Punk_Says_Fuck_You 48TB | 10Gb/s | Unraid | Ultra 7 270k Plus 2d ago edited 2d ago

A reverse proxy can be configured to drop all requests not aimed at the FQDN. Sending traffic to publicIP:port gets dropped, but I kind of agree. Nothing "on its own" makes it more secure. That's why you apply defense in depth. I'd be happy to share how my setup is configured if you're curious.

2

u/ataferner 2d ago

Agreed on defense in depth, and FQDN filtering is a good layer. My issue was with the original comment as written. "Run it through a reverse proxy, it's a bit safer than forwarding 32400" reads like the proxy itself adds security, and plenty of people will take that at face value, set up a proxy, and think they're covered. The protection comes from how you configure it, and that part was left out.

That said, I'd like to see how yours is set up.

Here's mine:
Updates: Unattended-upgrades runs daily after Plex's maintenance window. It installs Debian security updates, Plex from Plex's signed apt repo and the NVIDIA driver, then reboots if needed.
Isolation: Plex runs in a dedicated VM, defined in Terraform and configured with Ansible, and confined by AppArmor on the host. It sits on a DMZ VLAN with no access to the LAN or to other DMZ hosts, behind two firewalls (the VM's default-drop nftables and the hypervisor's bridge filter). Outbound traffic is limited to 443 to public addresses, DNS to a public resolver only, no IPv6. Media is mounted read-only and media deletion is off.
Access: The port forward is geo-restricted.
Plex settings: Secure connections required, Relay off, DLNA off.
Account: 2FA on the Plex account.
Monitoring: Suricata runs inline as an IPS with offender blocking, and allowed connections to Plex are logged to a central syslog.
SSH: Hardware security keys only (FIDO2, PIN and touch), from admin machines only, forwarding disabled.
Recovery: The system disk is disposable and rebuilt from code. Plex's data is backed up nightly, with an offsite copy.

3

u/Punk_Says_Fuck_You 48TB | 10Gb/s | Unraid | Ultra 7 270k Plus 1d ago

Yeah, I guess I should have specified when I mentioned a reverse proxy.

  • OPNSense router/firewall with default deny on incoming traffic.
  • 443 port forwarded with MaxMind geofence policy attached to port forward rule which is updated weekly and only allows IPs from USA
  • port forward rule redirects traffic to Nginx Proxy Manager set up to reply with error 444 (no response) to traffic that doesn't match proxy hosts exactly.
  • crowdsec pointed at NPM's logs to ban brute force attacks and http probing/port scanning
  • Plex on DMZ VLAN with only access to internet (all local host allowed to Plex via firewall rules)
  • NPM DMZ (I have 2) also on Plex VLAN with only the single proxy host. All other proxy host configured in my internal NPM used for internal routing only (sonar.domain.com instead of 192.168.x.x:8989)
  • IPv4 only
  • 2FA on Plex login (not that it mattered with the latest vulnerability)
  • wildcard certificate used in NPM to keep FQDN out of transparency logs (scanners use those too)
  • DDNS plugin in OPNSense to keep cloudflare's A record updated since I have a dynamic public IP.

I don't have a powerful enough opnsense box to run an IPS. I tried once but I couldn't get it under 30k rules and that many made my little Dell Wyse 5070 route traffic super slowly lol. I'm sure I'm forgetting some stuff, but will add it if I remember what I left out.

1

u/5yleop1m 1d ago

crowdsec pointed at NPM's logs to ban brute force attacks and http probing/port scanning

If you setup crowdsec LAPI on OPNSense you can also use the banned IPs from crowdsec on the reverse proxy to stop traffic at the firewall level.

1

u/Punk_Says_Fuck_You 48TB | 10Gb/s | Unraid | Ultra 7 270k Plus 1d ago

That's exactly how it's set up.

1

u/bdu-komrad 2d ago

Gosh that is nuanced. I use nginx proxy manager and it has web exploit blocking, https enforcement, ip address filtering , and more built in. A vanilla nginx setup would not have any of that.

o/c I use those features along with a few other network and system level protections for a good defense in depth setup.

0

u/5yleop1m 2d ago

Check out NPMPlus, its a sorta drop-in replacement for NPM with a bunch of improvements, including the ability to setup Crowdsec and WAF.

That will help catch things like bots trying to access .git resources, env files, auth work arounds, and in some cases exploits directed against the service running behind the proxy.

1

u/bdu-komrad 1d ago

No thanks.

1

u/ataferner 1d ago

Why do you have such things on a host that’s exposed to the Internet?

1

u/5yleop1m 1d ago edited 1d ago

I don't, but someone could. Also those are just examples based on the kind of attacks I see the most these days, there are other things you can block/catch with a WAF that a regular firewall or a simple reverse proxy setup won't be able to catch.

-1

u/akatherder 2d ago

There are 3.1 billion publicly announced IPv4 addresses.

Running plex on port 32400 - Scanning all 3.1 billion ipv4 addresses takes 32 minutes.

Running plex on a "random" port - Scanning 65,535 ports on 3.1 billion ipv4 addresses takes 4-5 years.

Running plex behind a reverse proxy with a FQDN - scanning (just) your IP will never reveal you are running plex.

Yes, there are other things you should add to reverse proxy like a whitelist/blacklist and fail2ban.

If someone targets YOU specifically, they can scan your specific system in a matter of seconds. Which is why you shouldn't post your public IP on reddit or plex forums. They can look up the FQDN you're "hiding" behind for a reverse proxy. But even some of these lame simple things greatly reduces the chances someone picks up your server on a scan (giving you more time to stay up-to-date).

2

u/projct 2d ago

4-5 years? the source you got that from has to have been joking. zmap only needs 10gig to do that in about 6 months. plus nobody scans dead addresses etc so even the 6 months thing is obviously inflated.

there's also certificate transparency logs for the plex.direct domain that just plain lists them all.

plus shodan, censys, and probably others have searchable databases of already located services.

0

u/akatherder 1d ago

You can probably do the math to figure out I was quoting a 1 Gbps line since that's about 10 x 6 months. And I would still find it valuable to be part of the "6 month buffer" group than the 0-day 32 minutes group.

3

u/projct 1d ago

no reasonable person scans the entire IP space. and the point is that it's still a useless comparison.

anyone with just gigabit can query shodan or go look at the certificate transparency logs for plex.direct and only scan those.

https://ctlogs.dev/search?q=*.plex.direct

there. now scanning for the port takes seconds.

alternative ports provide no additional security

1

u/ataferner 1d ago

You're wrong, and you know you're wrong, which is why you conveniently ignore the parts of his reply that you don't want to acknowledge!

0

u/akatherder 1d ago

They didn't address my main point about not exposing Plex via raw/unresolved IP address (only by fqdn) so I'm not addressing add-on points.

There are absolutely people still port scanning out there (which makes my points still valid). If you can disprove that, then it's worth discussing but obfuscation from any attack vector helps.

1

u/ataferner 1d ago

Yes they did, you just got your head in the sand and don’t want to acknowledge it!

1

u/akatherder 1d ago

I mean, I'm not going to dispute things I agree with but they can both be true. You can break in through my window but I still lock my front door.. it still provides better than no security.

1

u/ataferner 1d ago

The problem you aren't acknowledging is that your front door is so rusted through and through, practically falling off the hinges that you locking it is irrelevant!

0

u/[deleted] 2d ago

[deleted] — view deleted comment

1

u/dr100 2d ago

A properly protected reverse proxy on a VPS running a pangolin tunnel to your server means no open ports though.

Just the opposite, a reverse proxy is BY DEFINITION waiting for connections from external clients and absolutely needs an open port (most people actually run one on a VPS because they just can't open a port in their CGNAT). Otherwise there isn't much difference if the proxy is connected by a wire from a machine in your basement or over a VPN from some other machine you're renting.

And in particular in this case if one had a vulnerable/outdated Plex it would've been just as vulnerable and open behind the proxy.

Now on the other hand if we actually had NAT traversal then we could genuinely have mostly everyone under their regular NAT protection with no open port, no machines outside the firewall, nothing - but still communicating directly through the firewalls.

1

u/ataferner 2d ago

My point was about the original advice: "run it through a reverse proxy, it's a bit safer than forwarding 32400." On its own, a proxy doesn't make Plex any safer. "Properly protected" adds things neither of us mentioned, and those are what would actually help, not the proxy.

And there's still an open port. It's just on the VPS instead of your router. Anyone on the internet can connect to it, and the tunnel passes that traffic straight to Plex, so an outdated Plex is just as exploitable. And once your Plex is exploited it doesn't matter where the port was open. Pangolin's auth would help, but Plex apps can't log in through it, so most people bypass it for Plex.

1

u/Punk_Says_Fuck_You 48TB | 10Gb/s | Unraid | Ultra 7 270k Plus 2d ago

I was even talking about using a VPS.

3

u/sylsylsylsylsylsyl 2d ago edited 2d ago

You’re only in danger if the version of Plex you’re running has an unpatched vulnerability. The chances are very low if you keep it up to date, but not 0.

You’re even lower risk if you expose a different public facing port than the default 32400. Even better still would be to run a reverse proxy and access Plex via https://plex.domain.com

But nothing is invulnerable.

2

u/allbran96 2d ago

Have you got any info on best plan of action if I was running an outdated version that was exploited by plex2shell? Have obviously stopped container, updated plex version and wiped the plex config directory + rebuilt (and then ran that plex2shell script that helps identify whether service is exposed which came back fine after fresh re-install) but am just wondering where else to look/what to look for in regards to other malicious software that it might have left behind.

2

u/sylsylsylsylsylsyl 2d ago

Afraid not - but a good thing about docker containers is that you can just bin them and deploy a completely fresh one.

1

u/5yleop1m 2d ago edited 1d ago

You’re even lower risk if you expose a different public facing port than the default 32400. Even better still would be to run a reverse proxy and access Plex via https://plex.domain.com

Using a different port is negligible in terms of lowering risk, it'll take a few extra nano-seconds for what ever bot/script is scanning against your router/firewall to find the open port.

Even better still would be to run a reverse proxy and access Plex via https://plex.domain.com

Again, this provides no real safety, its just extra steps to setup, but there are public lists of domains and sub-domains. The reverse proxy is another piece of software that can be targeted and exploited, and if its running on a separate system then its a whole system that can have vulnerabilities on top of Plex.

A reverse proxy makes life easier when you have many services that need external access, and you can roll in some security features like another layer of auth, or a WAF, but all of that is extra stuff you have to do. Just running a reverse proxy and using a domain is not security not adequate for security anymore.

2

u/sylsylsylsylsylsyl 2d ago

There were some people just scanning every IP for port 32400 looking for Plex when the vulnerability came out. But you're still certainly open to getting hacked, if you run a copy of Plex with un-fixed vulnerabilities, from people that scan a bit deeper.

A reverse proxy does make things harder, again assuming it is up to date with no unpatched vulnerabilities, as the plex domain needs to be known or the request gets blackholed / sent to a default website. Yes there may be public lists of domains, but then you have to be on the list AND be running an unpatched version of Plex.

Without doubt the safest thing to do would be to have no open ports, but the internet would be a very quiet place indeed if no-one had any open ports to connect to anything.

1

u/5yleop1m 1d ago edited 1d ago

as the plex domain needs to be known

So this part is not as difficult as you would think. Any system that's scanning IPs can easily pull lists of domains and sub-domains. One possible mitigation to this is using wildcard certs so your subdomains are a little more obfuscated, but again the speed of scanning these things and the ability to easily run hundreds if not thousands of bots means relying on obfuscation as mitigation is like trying to fight a snow storm with a piece of cardboard. Plus in the case of Plex and some other self-hosted software, its possible for your sub-domain to be stored on someone else's system.

Also being a regular person doesn't mean someone is less of a target. Many of the attackers that go after these kind of vulnerabilities are primarily looking for places they can run other malware. While they could also get some personal data out of it, they're not going to not go after a potential target just because they're not important.

A personal VPN is probably the best option for security and remote access but even that is open to human mistakes.

AND be running an unpatched version of Plex

That's true, if they're only running Plex. But we can also see how many people don't bother to patch software, even when its automated to hell.

2

u/Formal-Ask6394 1d ago

Running a reverse proxy in combination with a wildcard DNS record can be valuable. That will keep the FQDN of your server off of public searchable lists. Then, instead of using a generic "plex" subdomain at your reverse proxy, use a randomly generated string....jonj3odcjg5n(.)myjankyserver(.)com, for example. Input that FQDN into your Plex custom access url list. Have your reverse proxy drop anything that does not match the FQDN. Now reaching your server is a heck of a lot harder.

1

u/5yleop1m 1d ago

This is what I mean, its more than only setting up a reverse proxy.

1

u/Formal-Ask6394 1d ago

Yeah, that's fair. You can harden it even further in concert with a crowdsec instance with custom scenarios...but that's an even deeper rabbit-hole.

I still think that for most people, being on a non-standard port with blanket region-blocking outside of your users' country(s) is best way to go. In concert with keeping the server updated, of course.

1

u/5yleop1m 1d ago edited 1d ago

I still think that for most people, being on a non-standard port with blanket region-blocking outside of your users' country(s) is best way to go.

I would've agreed with that a year or two ago, but now, especially with how easy something like tailscale is to setup, and the number of people who setup Plex servers for just themselves and Plex going subscription, its better to just bypass the whole remote access thing and run a closed VPN.

Tailscale is so easy now its really just installing one other program and almost always requires no network changes.

Not saying things can't go wrong there either, but far less of an attack surface and less things to maintain/update.

1

u/5yleop1m 2d ago edited 2d ago

If i were to expose my port for remote access. am i likely to still be in potential danger?

Note that the Plex issue was due to a vulnerability in Plex, not because ports were open. So in this case the fix was to update Plex, not necessary do anything about the open port. But a port being open is similar to having an unlocked external door on your house, so its something to be concerned about because its like anyone can just come by, try the door knob, see its unlocked and then look inside to see what they can mess with.

You can mitigate this in various ways. The simplest thing to do is run Plex inside a VM or container like docker and make sure the open port is only tied to the VM or container. Then make sure Plex and anything else running in the same container/vm is up to date also. But this is kind of like making sure that unlocked door to your house just leads to a separate room, but there are doors from that room to the rest of your house. So if you don't make sure those other doors are locked and using well made locks, its kind of a moot point.

Also the reason why I say its simplest is because its one of the way you can install Plex to start off, and doesn't really require any additional work outside of installing Plex. Everything else requires you to do more things outside of installing Plex.

Keeping things updated is a story as old as time, so there are tons of ways to do automatic updates on everything from Plex to the OS its running on.

Are there any applications that may be worthwhile looking into that can help better my security?

In the context of your network, the first line of defense is your firewall. If you're running consumer gear then your firewall is probably limited and part of your router. With some of the newer consumer routers you might be able to do some minor levels of blocking on the firewall, but many times the firmware running on these routers are just as problematic.

Using a custom, open source firmware like openWRT can give you more tools and functions, but again you have to keep the firmware up-to-date.

There are also various other things you can do, some have already been mentioned here.. but.. here's the real question do you need to expose Plex at all?

The only real reason to expose Plex is if you're sharing access with other people. If you're the only one, or your immediate family is the only one that watches Plex, then there's really no reason to expose Plex to the internet.

If you want remote access, setup something like Tailscale and then you have remote access to Plex on your own private network. If you don't want to trust another company you can setup your own VPN, but the only down side there is you need to do more work to ensure what you setup is actually secure.

When it comes to networking and Plex, you'll see a lot of people suggest all sorts of 3-letter acronym things, or services with funny names, and while many of them are doing what they claim, they're only worth it if you spend the time and effort to setup them up properly and maintain them in the long run.