Security Flaws: AFP-over-SSH Broken
After a discussion with Rich Mogull, where we both agreed that AFP is a threat (note that Apple fixed 4 different AFP threats in Security Update 2006-004), I decided to require ssh tunneling for AFP connections to www.reppep.com. Apple provides a neat feature for automatically tunneling AFP through ssh, but unfortunately it’s broken in half a dozen ways…
My initial report:
It is impossible to connect to an AFP server without access to port 548 — this should work if ssh is available, and AFP-over-SSH is enabled. Instead, with 548 blocked by a firewall, the AFP connection times out — even using an alias created when connected via AFP-over-SSH.
Connect To Server should accept afps://host as a scheme that specifies AFP-over-SSH. Instead it gets converted to afp://afps/host, which is wrong and nonfunctional.
It’s impossible to require ssh for AFP from the server.
It’s impossible to support AFP on the server without leaving port 548 open, even though with ssh tunnelling 548 shouldn’t be needed.
Note: These are not exploits, but they are real problems with the security of Mac OS X (Server & client).
An addendum:
Mac OS X client should be able to serve AFP-over-SSH. Now would be an excellent time to fix this weakness in X’s security posture.
Mac OS X client should be able to close firewall ports for active services, to force tunnelling; I’m particularly interested in ARD/VNC and AFP. Right now, any service enabled in Sharing must be open in Firewall (if the firewall is enabled through System Preferences). This should be optional.
Update, 2006/08/13:
I tried connecting through a manually created SSH tunnel, and it doesn’t work. Connect To Server doesn’t honor ports in the URL, so “afp://www.reppep.com:1548″ tries to find a machine named “www.reppep.com:1548“, which of course fails. This means a) I can’t do it without root-level access to create the tunnel on 548/tcp, and b) I can’t create the tunnel while File Sharing is on on the client (all my clients run Personal File Sharing).
Additionally, when I try to point Connect To Server to 127.0.0.1, it tells me “Connection failed” “This file server is running on your machine. Please access the volumes and files locally.”
It’s possible I could bind another interface on 127.0.0.2 and use “sudo mount_afp“, but that’s not even worth exploring. I cannot provide VPN access to all my users.
So AFP over the Internet is fundamentally broken, beyond any semi-reasonable means to fix. Please fix in Leopard!
