You may have seen that a critical security vulnerability has been disclosed in the OTP SSH implementation that could permit an attacker to execute arbitrary code sans any authentication under certain conditions.
If your run an Erlang SSH server, you need to act immediately.
The summary is if you’re using Phoenix, you are most likely not affected. If you are using Nerves with SSH in production, you may be vulnerable. The Nerves team is aware of this issue and they are actively working on a solution so people can easily update.
I believe they are vulnerable, the root cause of the bug is related to the SSH handshake in Erlang. OTP-24 and older seem to be out of support, so they don’t get security updates - Erlang | endoflife.date
I read it and I have a live app on fly.io using Phoenix, but when I nmpa’ed my app it says port 22/tcp is open for ssh.
I guess I’m vulnerable even though I use Phoenix and Fly.io, right?
Most likely no, port 22 is used internally by Fly.io for fly ssh console, so it’s highly unlikely you are running an Erlang SSH server on that port.
For you to be vulnerable, you have to do all of these:
Enable :ssh as an extra application in your mix.exs file. (It is off by default)
Configure your Elixir app to accept Erlang SSH connections on a non-standard port
Manually expose that running service via the Fly.io feature external port ranges, launched in 2023 - Annoucement: External port ranges - announcement - Fly.io (my original post is technically wrong when it says this it not possible on Fly.io, however I hope this whole explanation shows why it is so unlikely)
When you nmap a Fly.io hosted app it will show port 22 is open, but that’s for Fly.io official use, your application is not running the Erlang SSH server on that port. For example, run:
nc your_domain_here 22
If it returns SSH-2.0-Erlang/VERSION then you are vulnerable. Most likely it will return nothing (I just tested it), and you are not vulnerable.
Actually the ssh/sftp server constructs are very useful libraries. One of the use-cases we had was that we were setting up sftp servers from one of our web interfaces, dynamic server certificates, dynamic authorized hosts, dynamic authentication methods, ports etc.
Add to that some nice telemetry and logs, and you have a very amazing and configurable ssh/sftp servers for your needs.