New ssh Exploit in the Wild 754
veg writes "In the last few hours there have been several reports of a new ssh bug, with an exploit seemingly in the wild. Oh god not again... The lengths some people will goto to try and damage Theo's pride." Update: 09/17 00:24 GMT by T : friscolr writes "Hot on the heels of rev 1 of the buffer.adv advisory, here is revision 2, which fixes more than revision 1 did. Also see the 3.7.1 release notes."
See this comment for BSD patch and info (Score:5, Informative)
interesting comment on how to stop it... (Score:1, Informative)
CRAP! (Score:3, Informative)
The advisory itself says The systems in question are FreeBSD, RedHat, Gentoo, and Debian all running the latest versions of OpenSSH. So i'm going to assume that OS X is affected as well.
Patch (Score:5, Informative)
Full Disclosure (Score:4, Informative)
christopher neitzert chris@neitzert.com
Mon, 15 Sep 2003 13:48:34 -0400
More on this;
The systems in question are FreeBSD, RedHat, Gentoo, and Debian all
running the latest versions of OpenSSH.
The attack makes an enormous amount of ssh connections and attempts
various offsets until it finds one that works permitting root login.
I have received numerous messages from folks requesting anonymity or
direct-off-list-reply confirming this exploit;
The suggestions I have heard are:
Turn off SSH and
1. upgrade to lsh
2. add explicit rules to your edge devices allowing ssh from only-known
hosts.
3. put ssh behind a VPN on RFC-1918 space.
On Mon, 2003-09-15 at 12:02, christopher neitzert wrote:
> Does anyone know of or have source related to a new, and unpublished ssh
> exploit? An ISP I work with has filtered all SSH connections due to
> several root level incidents involving ssh. Any information is
> appreciated.
Bits and pieces so far... (Score:5, Informative)
It will be 3.7p1 for us non-OpenBSD people.
It is a patch to one file, buffer.c, which fixes some allocation/offset stuff.
It seems that privilege separation does *not* help here - so get them systems patched (and firewalled)!
Re:interesting comment on how to stop it... (Score:3, Informative)
Try looking around a bit... (Score:5, Informative)
Re:very early (Score:3, Informative)
Re:Questions. (Score:2, Informative)
Re:very early (Score:3, Informative)
Re:CRAP! (Score:2, Informative)
You can flood any service and eat resources... no matter what service is running.
I think if you can just configure SSH or port-sentry to simply allow 3 attempts from the same IP address or even network block, it's not a fix but a good workaround as it will definitely help you secure your ssh-based system.
Re:Suggestions for a newbie? (Score:1, Informative)
quick fix for debian (Score:1, Informative)
% cd openssh-3.6.1p2 # this in unstable, might be a different version in testing/stable
% wget --user-agent="mozilla" -O - \
'http://www.freebsd.org/cgi/cvsweb.cgi/src/crypto
patch -p3
% fakeroot debian/rules binary
% cd
And you should have new packages ready to be installed..
Update for debian (Score:5, Informative)
For anyone running debian stable:
apt-get update
apt-get upgrade
Re:Suggestions for a newbie? (Score:5, Informative)
Now, if you feel you need sshd, but can go without for a while, uninstall sshd in the short term and wait for an upgrade for your OS, at which point you can safely reinstall (it's a simple "apt-get install sshd").
Comment removed (Score:5, Informative)
Debian's already got the patch. (Score:2, Informative)
apt-get update
apt-get upgrade
Mirror for mailing lists (Score:5, Informative)
... can be found here http://archives.neohapsis.com/archives/fulldisclo
Re:See this comment for BSD patch and info (Score:5, Informative)
since RH hasn't released any yet...
it's backported from the 9.0 update ssh SRPM.
my bandwidth is VERY limited... so AIM ME at "Swell500" and i'll send ya a link to grab them until RH releases official patches.
ChiefArcher
Re:Suggestions for a newbie? (Score:1, Informative)
ps -Af |grep sshd
and see if there is an entry for it. If so then turn it off (does Lindows have a GUI for configuring services?).
Re:Is ths a hoax? (Score:4, Informative)
technoid
OpenSSH 3.7 Release Announcement (Score:5, Informative)
Subject: OpenSSH 3.7 released
Date: Tue, 16 Sep 2003 14:07:00 +0200
From: Markus Friedl
To: openssh-unix-dev _at_ mindrot.org
OpenSSH 3.7 has just been released. It will be available from the mirrors listed at http://www.openssh.com/ shortly.
OpenSSH is a 100% complete SSH protocol version 1.3, 1.5 and 2.0 implementation and includes sftp client and server support.
We would like to thank the OpenSSH community for their continued support to the project, especially those who contributed source and bought T-shirts or posters.
We have a new design of T-shirt available, more info on http://www.openbsd.org/tshirts.html#18
For international orders use http://https.openbsd.org/cgi-bin/order and for European orders, use http://https.openbsd.org/cgi-bin/order.eu
Security Changes:
All versions of OpenSSH's sshd prior to 3.7 contain a buffer management error. It is uncertain whether this error is potentially exploitable, however, we prefer to see bugs fixed proactively.
OpenSSH 3.7 fixes this bug.
Changes since OpenSSH 3.6.1:
* The entire OpenSSH code-base has undergone a license review. As a result, all non-ssh1.x code is under a BSD-style license with no advertising requirement. Please refer to README in the source distribution for the exact license terms.
* Rhosts authentication has been removed in ssh(1) and sshd(8).
* Changes in Kerberos support:
- KerberosV password support now uses a file cache instead of a memory cache.
- KerberosIV and AFS support has been removed.
- KerberosV support has been removed from SSH protocol 1.
- KerberosV password authentication support remains for SSH protocols 1 and 2.
- This release contains some GSSAPI user authentication support to replace legacy KerberosV authentication support. At present this code is still considered experimental and SHOULD NOT BE USED.
* Changed order that keys are tried in public key authentication. The ssh(1) client tries the keys in the following order:
1. ssh-agent(1) keys that are found in the ssh_config(5) file
2. remaining ssh-agent(1) keys
3. keys that are only listed in the ssh_config(5) file
This helps when an ssh-agent(1) has many keys, where the sshd(8) server might close the connection before the correct key is tried.
* SOCKS5 support has been added to the dynamic forwarding mode in ssh(1).
* Removed implementation barriers to operation of SSH over SCTP.
* sftp(1) client can now transfer files with quote characters in their filenames.
* Replaced sshd(8)'s VerifyReverseMapping with UseDNS option. When UseDNS option is on, reverse hostname lookups are always performed.
* Fix a number of memory leaks.
* Support for sending tty BREAK over SSH protocol 2.
* Workaround for other vendor bugs in KEX guess handling.
* Support for generating KEX-GEX groups (/etc/moduli) in ssh-keygen(1).
* Automatic re-keying based on amount of data sent over connection.
* New AddressFamily option on client to select protocol to use (IPv4 or IPv6).
* Experimental support for the "aes128-ctr", "aes192-ctr", and "aes256-ctr" ciphers for SSH protocol 2.
* Experimental support for host keys in DNS (draft-ietf-secsh-dns-xx.txt). Please see README.dns in the source distribution for details.
* Portable OpenSSH:
- Replace PAM password authentication kludge with a more correct PAM challenge-response module from FreeBSD.
- PAM support may now be enabled/disabled at runtime using the UsePAM directive.
- Many improvements to the OpenSC smartcard support.
- Regression tests now work with portable OpenSSH. Please refer to regress/README.regress in t
OpenSSH Security Advisory (Score:4, Informative)
Re:deceit (Score:4, Informative)
# dmesg | head -n2
OpenBSD 3.4-current (GENERIC) #62: Tue Sep 12 22:49:18 MDT 2003
deraadt@i386.openbsd.org:/usr/src/sys/arch/i386/c
Mirror of the vulnerability description (Score:3, Informative)
http://unthought.net/ssh-vuln.html [unthought.net]
Re:Suggestions for a newbie? (Score:3, Informative)
If you don't log on to your computer from another machine at school or wherever, then the safest thing would be to ensure that the ssh daemon is disabled. You can test this by just trying a "ssh localhost" at a command prompt. If you get a "Connection Refused" message, you're probably fine. To make sure, try executing "/etc/init.d/ssh stop" as root (might also be
Cheers,
Mouser
Updating for Gentoo (Score:5, Informative)
cd
cp openssh-3.6.1_p2.ebuild openssh-3.7_p1.ebuild
emerge -f openssh-3.7_p1.ebuild
ebuild openssh-3.7_p1.ebuild digest
emerge openssh-3.7_p1.ebuild
Re:Wrapping defense (Score:3, Informative)
However, if you're a paranoid or pessimistic kind of person, you shouldn't rely on hosts.allow to protect you.
Assuming that your ISP is taken over (either by hackers, or the FBI), they can re-number any internet packets destined to you. The hosts_access system will have no way to tell that a datastream is from a spoofed source. The "source address" field of IP packets can be falsified, and there's no way to tell.
However, in normal circumstances ssh can do a better job of verifying remote identity, by using more information than IP headers provide. It checks fingerprints of keys on the remote system, for example. But can we be sure that this feature is still working today, and hasn't been defeated by the latest exploit? That won't be known without expert analysis.
Fixed debian i386 package (Score:2, Informative)
Trust me... View the srpm (Score:5, Informative)
you can always grab it and see for yourself..
I only changed buffer.c
Feel free to see for yourself..
I had to make all of these this morning to patch our systems..
ChiefArcher
Re:For Gentoo (Score:5, Informative)
It renames the gentoo ebuild, which uses it's own name to figure out what to fetch and install.
So basically a 3.7_p1 named ebuild goes out and fetches the new 3.7 openssh package, compiles it and installs it.
Re:interesting comment on how to stop it... (Score:5, Informative)
lsh has grown mature since then, and has an excellent code quality. I recommend it. Any day over OpenSSH, after having looked at the code of both projects. Up-to-date documentation, as on the web page, or the README inside the tarball, doesn't contain the warning.
intentions are noble and MIRROR now (Score:5, Informative)
you have an email address to...
and a resume www.briangannon.com
and the Source RPMS.
http://stradlin.com/ssh [stradlin.com]
if you do a diff on the sources, you will see I only edited buffer.c
my intentions are completely noble.
How can you really trust Redhat? One of the disgruntled developers could put a backdoor in a patch?
ChiefArcher
Re:Questions. (Score:2, Informative)
My OpenBSD box? *sigh* I got bitten by the LAST ssh bug... which is why I'm so desperate to fix THIS one.
I will point out to people that this message "only one remote exploit in 7 years" said that before the last ssh bug. But then, I wasn't exploited until after they released 3.3, so you can possibly blame it no not upgrading.
Re:deceit (Score:4, Informative)
And as comparison, how many patches do windows users normally need to install over the 'default install' to get it secure and close every hole in the default setup? Methinks slightly more than 1 or 2...
Re:Update for debian (Score:4, Informative)
For i386 the exact link is http://incoming.debian.org/ssh_3.6.1p2-6.0_i386.d
Re:Suggestions for a newbie? (Score:1, Informative)
MOD PARENT DOWN (Score:2, Informative)
A post like this given a +5 is dangerous. I wonder how many OpenBSD users will read that, take his word for it, and not patch their systems. Probably not many
Re:Suggestions for a newbie? (Score:2, Informative)
I would guess you probably don't have to worry too much, but to be safe, rather than sorry, you should try to ascertain whether sshd is even running on your machine. If it's not, you have nothing to worry about. If it is, you should turn it off, and then upgrade to the latest version.
If you get yourself to a command line and type in
ps aux | grep sshdYou should see whether or not you have an ssh server running. If you do, you probably want to turn it off until you can get your system updated.
Hopefully someone who uses Debian or Lindows can tell you how to turn off sshd, I've never used either OS, so I'm not sure.
As a guess, look for something in your interface that talks about managing network servers, daemons, or services. You want to stop sshd (it might be listed as just ssh), and prevent it from starting up again when you reboot your machine.
If you're behind a firewall that filters port 22, you're probably fine either way since ssh listens on port 22, and the firewall is blocking access.
Hopefully someone else with more knowledge can fill in my gaps. In a lot of ways I'm still a GNU/Linux newbie, myself.
Good luck!
Ian
Re:deceit (Score:3, Informative)
Re:install base (Score:2, Informative)
What you can do in the meantime, is set PermitRootLogin to No and firewall off ssh cept for a few hosts you login from.
Re:Can somebody enlighten me? (Score:2, Informative)
I still have to find evidence of the exploit besides few mails with absolutely no technical detals. More and more I think this is some kind of hoax... and I can understand why everybody is so jumpy, afterall ssh is a crucial part of a "secure" box.
Re:Ermm.. can anyone say "Microsoft" (Score:5, Informative)
Yep, *nix systems have exploits, and an hour or two turnaround between discovery and a fix. I'd like to see Microsoft match that.
"Linux has no exploits that need patching"
People who actually know Linux would never claim that there are no known exploits, just that the time-to-fix is much shorter and that applying these fixes to running systems is usually much easier (in most distributions) than in a Windows system (ie no reboot required, one location for all necessary fixes, better software package management, etc)
I use Linux and BSD at home, but manage Windows machines at work (I have no decision making power, I'm just a grunt) and I must say that Windows management is a royal pain in the ass. We've had no problems with the recent Windows viruses and worms, but I do spend an inordinate amount of time applying patches, rebooting machines, and checking that the new patches did not wipe out the old ones. I don't think that it is unreasonable for Microsoft's customers to demand better patch/upgrade management, a single location for updates to both applications, servers, and the OS, and a better method for confirming that the files included in a patch contain the all of the required fixes (for that file) even if they came from different departments at microsoft.
Re:interesting comment on how to stop it... (Score:3, Informative)
Nope. You only need openssl-0.9.6 or later. See the INSTALL doc in the openssh 3.7p1 source.
Re:See this comment for BSD patch and info (Score:3, Informative)
I've packaged up rpm's (minus the x11-askpass stuff) for Red Hat 7.2 and 7.3. You can download the packages at http://projects.standblue.net/rpms/openssh/3.7p1/
It'll help, and also: (Score:5, Informative)
DenyUsers *
AllowUsers you@your_ip_address
(and restart sshd)
You can also firewall the port off. I've done a hodge-podge of these solutions on different systems I admin until I can actually get the 3.7p1 source from the mirrors (they dont' seem to have it yet).
Debian? (Score:4, Informative)
running the latest versions of OpenSSH.
The attack makes an enormous amount of ssh connections and attempts
various offsets until it finds one that works permitting root login.
Odd. I run Debian on all of my systems and PermitRootLogin is set to no on all of them. Sarge and Sid also have UsePrivilegeSeparation set to yes by default.
Another place to find the patch/bug advisory (Score:5, Informative)
Re:Updating for Gentoo (Score:2, Informative)
Re:Updating for Gentoo (Score:5, Informative)
If you don't want to wait for the official ebuild:
/usr/portage/net-misc/openssh/
cd
cp openssh-3.6.1_p2.ebuild openssh-3.7_p1.ebuild
emerge -f openssh-3.7_p1.ebuild
ebuild openssh-3.7_p1.ebuild digest
emerge openssh-3.7_p1.ebuild
This will fail if you have kerberos support USE'd, with an error involving gssapi.h not being found. The solution? Replace the final line with this:
USE="-kerberos" emerge openssh-3.7_p1.ebuild
Re:GOOD!! Red Hat, fix your RPMs!! (Score:5, Informative)
1.- Download the file openssh-3.7p1-1.src.rpm from any of the mirrors. For example:
ftp://ftp.easynet.be/openssh/portable/r
2.- Build an
# rpm --rebuild openssh-3.7p1-1.src.rpm
3.- Upgrade your OpenSSH packages:
# rpm -Fvh
4.- Re-start your sshd daemon:
service sshd restart
5. Profit!^H^H^H^H^H errr, that's it.
Peace.
Re:See this comment for BSD patch and info (Score:3, Informative)
Please take only the package you need.
More information (Score:1, Informative)
Re:Update for debian (Score:2, Informative)
apt-get update
apt-get install ssh/stable
Assuming you have
deb http://security.debian.org/ stable/updates main
You should still firewall if possible.
-Brian
Re:For Gentoo (Score:2, Informative)
Re:Mirror of the vulnerability description (Score:3, Informative)
It kind of does. Seems that fatal() calls fatal_cleanup() [cf fatal.c], which runs thru a list of callback procedures before exiting. Somewhere in those callbacks the function buffer_free() [cf buffer.c] might be called on the offending buffer. That function does a memset(buffer->buf, 0, buffer->alloc), and there's your overrun.
QED.
Red Hat RPMS available now (Score:2, Informative)
Re:It'll help, and also: (Score:3, Informative)
If you want to block all users but your list of allowed users, just use:
AllowUsers user1@users_ip_address user2@users_ip_address
or AllowUsers user1 user2
That DenyUsers string blocks your list of allowd no matter where you put it.
Redhat RPMs are available (Score:4, Informative)
Redhat Advisory RHSA-2003-279 (Score:4, Informative)
RedHat has posted fixes (Score:2, Informative)
https://rhn.redhat.com/errata/RHSA-2003-279.htm
For RedHat 7.1: openssh-3.1p1-9
For RedHat 7.2: openssh-3.1p1-10
For RedHat 7.3: openssh-3.1p1-10
For RedHat 8.0: openssh-3.4p1-5
For REdHat 9 : openssh-3.5p1-9
Good luck at getting to their FTP servers. Hopefully, the mirrors will get them soon.
Re:GOOD!! Red Hat, fix your RPMs!! (Score:3, Informative)
FreeBSD Security Advisory FreeBSD-SA-03:12.openssh (Score:5, Informative)
Corrected:
2003-09-16 16:24:02 UTC (RELENG_4)
2003-09-16 16:27:57 UTC (RELENG_5_1)
2003-09-16 17:34:32 UTC (RELENG_5_0)
2003-09-16 16:24:02 UTC (RELENG_4_8)
2003-09-16 16:45:16 UTC (RELENG_4_7)
2003-09-16 17:44:15 UTC (RELENG_4_6)
2003-09-16 17:45:23 UTC (RELENG_4_5)
2003-09-16 17:46:02 UTC (RELENG_4_4)
2003-09-16 17:46:37 UTC (RELENG_4_3)
2003-09-16 12:43:09 UTC (ports/security/openssh)
2003-09-16 12:43:10 UTC (ports/security/openssh-portable)
Fixed that ancient LSH README (Score:5, Informative)
An explanation of what the patch does (Score:3, Informative)
An exploit of this hole would have to find a way to trigger this buffer allocation, and get it to overflow 32KB. Since the allocation would not take place, but the recorded buffer size is still large, there would be an unallocated memory area that could be referenced by code that uses that buffer. One would need to use that to overwrite program code with exploit code.
ERROR: MOD (my) PARENT DOWN, MOD THIS UP INSTEAD (Score:5, Informative)
Sorry.
AllowUsers you@your_ip_address
Remember, always test making a new ssh connection before logging out of your existing one, after restarting sshd.
Re:stable/woody (Score:3, Informative)
Still no Debian Packages... (Score:2, Informative)
http://readme.gzipped.org/~max/debian.html [gzipped.org]
Choose one of the sources.list lines depending on your CPU, insert it into your sources.list, update, upgrade, and you're safe.
I applied the patch from http://www.openssh.com/txt/buffer.adv [openssh.com] to the original 3.6 Debian package from testing.
Sorry for the German text, I shared this repository of Debian Packages (unstable packages ported to Woody, compiled with gcc-3.2 and CPU optimizations) only with my German friends till now...
A mirror for Brian (Score:2, Informative)
If using binaries/source from non-vendors weirds you out, you can also grab the RPMs for RH9, or the SRPMs for other releases (and presumeably other distros like SuSE, Mandrake, et al. as well) directly from the OpenBSD guys. The only US mirror which had them (as of this morning when I heard about the announcement) was ftp://ftp3.usa.openbsd.org/pub/OpenBSD/OpenSSH/por table/rpm/ [openbsd.org]. I didn't look through the international mirrors, but I got pretty good speeds from across the country.
-B
Re:GOOD!! Red Hat, fix your RPMs!! (Score:3, Informative)
For the record, the Red Hat packages released today to appear to address the bug you're referring to.
Re:It'll help, and also: (Score:4, Informative)
It is better explained as "AllowUsers localAccount@remote_ip_address". It means: "Allow SSH connections from anybody at remote_ip_address to connect to localAccount." (Of course the remote user still must authenticate successfully.)
The syntax unfortunately looks like it specifies a remote user. It doesn't. It defines a relationship between a remote IP address and a local user.
Trust me, I wrote the book [snailbook.com]. :-)
Re:Questions. (Score:4, Informative)
That means that Debian's default configuration for sshd is also secure.
iptables and ipchains scripts to limit SSH access (Score:5, Informative)
iptables:
#!/bin/sh
insmod iptables
iptables -F INPUT
iptables -P INPUT ACCEPT
iptables -A INPUT -j ACCEPT -p tcp --destination-port 22 -s 1.2.3.4
iptables -A INPUT -j DROP -p tcp --destination-port 22
iptables -A INPUT -j DROP -p udp --destination-port 22
ipchains:
#!/bin/sh
insmod ipchains
ipchains -F input
ipchains -P input ACCEPT
ipchains -A input -j ACCEPT -p tcp --destination-port 22 -s 1.2.3.4
ipchains -A input -j DENY -p tcp --destination-port 22
ipchains -A input -j DENY -p udp --destination-port 22
Re:interesting comment on how to stop it... (Score:2, Informative)
No, we're talking about the lsh that does do X forwarding. And port forwarding. You can even tell it to just open a connection and not spawn a shell, in case you need just the port forwarding.
Slackware Advisory (Score:1, Informative)
Upgraded OpenSSH packages are available for Slackware 8.1, 9.0 and
- -current. These fix a buffer management error found in versions of
OpenSSH earlier than 3.7. The possibility exists that this error
could allow a remote exploit, so we recommend all sites running
OpenSSH upgrade to the new OpenSSH package immediately.
Here are the details from the Slackware 9.0 ChangeLog:
Tue Sep 16 11:13:05 PDT 2003
patches/packages/openssh-3.7p1-i386-1.tgz: Upgraded to openssh-3.7p1.
From the OpenSSH Security Advisory
(http://www.openssh.com/txt/buffer.adv):
"All versions of OpenSSH's sshd prior to 3.7 contain a buffer
management error. It is uncertain whether this error is
potentially exploitable, however, we prefer to see bugs
fixed proactively."
(* Security fix *)
WHERE TO FIND THE NEW PACKAGES:
Updated package for Slackware 8.1:
ftp://ftp.slackware.com/pub/slackware/slack
Updated package for Slackware 9.0:
ftp://ftp.slackware.com/pub/slackware/slack
Updated package for Slackware -current:
ftp://ftp.slackware.com/pub/slackware/
MD5 SIGNATURES:
Slackware 8.1 package:
a86d410e47fe8ab4a8e9f04293a94093 openssh-3.7p1-i386-1.tgz
Slackware 9.0 package:
ca1d0b1e658c5391067f2a9cf11fc239 openssh-3.7p1-i386-1.tgz
Slackware -current package:
c58003eaaf4362c8475f0f5a77f2adbb openssh-3.7p1-i486-1.tgz
INSTALLATION INSTRUCTIONS:
(This procedure is safe to do while logged in through OpenSSH)
Upgrade using upgradepkg (as root):
# upgradepkg openssh-3.7p1-i386-1.tgz
Restart OpenSSH:
.
Re:deceit (Score:4, Informative)
OpenSSH refuses to allocate a buffer over a certain size, but doesn't set the buffer size value back to its previous value. When this occurs, OpenSSH immediately calls fatal() to clean up and exit. The connection is closed, and the buffer is not reused.
The problem is that the cleanup code will, in some cases, attempt to zero the block at the larger size, resulting in OpenSSH crashing.
Because no data other than zeroes is every written to this buffer after the failed allocation (unless the FreeBSD folks missed something), this bug cannot be exploited except as a denial-of-service attack unless combined with some other exploit that allowed you to overwrite the exception handling vectors and add arbitrary code (in which case, there are probably much easier ways to perform the exploit).
Re:RPMs for Red Hat Linux 7.1 and 7.2? (Score:2, Informative)
Re:See this comment for BSD patch and info (Score:2, Informative)
http://projects.standblue.net/rpms/openssh/3.7p
Re:Server Hole Only, not Client or Protocol proble (Score:1, Informative)
Gentoo emerge history (Score:3, Informative)
Instead of going to figure out when 3.7 was released (could have been today for all I know, I didn't read everything this article linked to), I went looking for how to track my emerges and I found:
this [mail-archive.com].
Hope this informs someone else.
Cheers