Why is ssh insecure by default? [AllowTcpForwarding]
kitenet.net
kitenet.net
So, in that particular example, ssh port forwarding by default is not desired behavior, because the user isn't granted a full shell for authpf. However, they're considered "trusted" users, so it's not a security problem from a practical standpoint.
However, if I were running a similar service, but more broadly, for "untrusted" users ... then it would be a problem.
While someone might argue then that as a sysadmin I should examine the default settings and modify them according to the needs at hand -- and I would agree -- I could also argue the reverse: that argument is equally valid for disabling ssh port forwarding by default.
In the end, as with most defaults for security-sensitive systems, it should come down to expected behavior. That is, someone who needs ssh port forwarding will know they need it, and can go looking for that particular knob to turn. However, someone who _doesn't_ know about ssh port forwarding should not be expected to go looking for it and disable it in order to not get caught by surprise later on.
It should be disabled by default.
$ ssh -L 1234:irc.perl.org:6667 git@github.com -N
channel 2: open failed: administratively prohibited: open failed
^C
But anyway, this is not a huge deal. It is only available to vetted users (those with git/cvs/whatever accounts), and that "Unauthorized use is prohibited" banners that show up when you log in should cover the server admin's ass when someone does something illegal. It is no more "a threat" than an open wireless access point.Moreover, a "vetted" user is any user that has acquired a vetted user's SSH keys or password. With individuals regularly SSH'ing from remote, compromised machines, this happens all surprisingly often.
I never realized the issue existed when I've used command-limited SSH, and I should know better. The OpenBSD developers and administrators should really know better.
I'm actually embarrassed that I didn't recognize the issue, and I'm glad someone noted it publicly so I won't repeat the mistake.
Yeah, people can send spam or something.
http://openbsd.org:8080/pub/OpenBSD/OpenSSH/openssh-5.2.tar....
Are the contents of that URL trustable?
What about bypassing firewall restrictions?
So keep it turned off. But the sky is not falling.
Who said it was?
And if you have no write access, then what is the point of running it via ssh anyway? BTW giving someone write access to CVS without also access to ADMIN is a lot harder than it looks.
Running restricted account via SSH is not very common, while shell account via SSH is, so in that light the default is correct. It is really really hard to properly secure a restricted access account. So if you are going to do it, it's your job to do it properly.
AllowTcpForwarding
Specifies whether TCP forwarding is permitted.
The default is “yes”. Note that disabling TCP
forwarding does not improve security unless users
are also denied shell access, as they can always
install their own forwarders.
Basically this says, disabling TCP forwarding doesn't add any real security UNLESS your users don't have shell access. This is not a throwaway statment because many SSH accounts do not have shell access. For example, my Rsync.net backup account allows me to access it over ssh, but I can only run predetermined commands, that are deemed safe by the sysadmin (ls, cp, mv, etc, AND in a jail). So in this case disabling it WOULD add security, since I don't have real shell access.
Also, it is quite easy to install a tcp forwarder as long as you have some access to any real language interpreter.At my university, they throttled speeds for the residential network, so I compiled a simple java socks proxy and ran it on one of their servers that I had student access to, which allowed me to bypass the speed restriction. Hell, if you wanted to, you could cook something up with bash and netcat. To summarize, this is a great feature to have, and also one I use often. At most, it should be disabled by default, but in most cases it won't matter since people who can use it usually have shells too.
And really, this is what sysadmins get paid to do!
Most individuals (myself included) don't realize that SVN over SSH with command-restricted SSH keys would allow the users unmitigated access to the SVN server's network. I should know better, but still have made the mistake.
> And if the reader is in China -- hey, this is a great way to get around the Great Firewall ...
Yeah there's lot of ssh scanner going on in China
The real issue here is that people are casual about giving SSH accounts (limited or otherwise) to strangers. That's a mistake.
The problem occurs when an admin does not know what the daemon they are running on their machine does. The article is placing blame on the SSH daemon maintainers for making it easy to run their daemon in a way that exposes features that the admin would not want to knowingly expose.
So blame could be placed on: * the admins who unintentional leave their machines using such configurations * the developers of services which function over SSH, for using a design that makes it easy for an admin to unintentionally use such configurations. * the developers of the SSH daemon for not designing their software to prevent misconfiguration when it is used to encrypt the communication of other services
[excuse me if I sound hostile, I've had a fairly bad day]
On the other hand, SSH forwarding is extremely useful and serves as a nice alternative to VPN when you need it.
There are two situations:
1) Nonshell use only -- you want port forwarding turned off. Unless you're using the machine as a proxy, it's just waiting to be used as part of a larger hack scheme.
2) Shell use only -- Normal logging in and shell use doesn't necessitate port forwarding. The only time it is generally useful is for forwarding X11 back to the client, but frankly that's not nearly as useful as it was 10 years ago. If you've got an X install on your server, and an X server on your client, then you're in a sufficiently-select subset of the user population to have to turn on one config option in sshd_config.
In either case, I think it should be turned off by default.
Setting the default to frankly crippling levels for the primary function of a tool to accommodate an edge case seems slightly backwards to me. Host firewalls and/or disabling the option seem to be an acceptable set of hardening tasks if that use case is relevant to you.
I assume you're not calling me the idiot? -- Joey Hess
that bugtraq message says "OpenBSD cvs servers", as in, the anoncvs mirrors that are setup by volunteers, many of whom are not openbsd developers. we don't control any of those servers. an email was sent out to all of the mirror maintainers years ago telling them that they should probably disable the forwarding if they didn't know it was on.
And yet in 2009 at least 3 of the OpenBSD cvs servers once again have the same problem.
the list of mirrors is updated constantly (http://www.openbsd.org/cgi-bin/cvsweb/www/build/mirrors.dat). old mirrors drop off, new ones come on. if new ones are allowing tcp forwarding for anoncvs and they aren't aware of it, email them. clearly it bothers you more than it bothers any of us.
I do agree with the article.
At the end of the day, it's about as bad as people who used to mess up their sendmail relaying a few years ago. It in no way affects the credibility of OpenBSD, which is how it is worded and discussed.