Bug 896453 - (CVE-2014-3635) VUL-0: CVE-2014-3635 - CVE-2014-3639: dbus-1: various denial of service issues in fd passing
(CVE-2014-3635)
VUL-0: CVE-2014-3635 - CVE-2014-3639: dbus-1: various denial of service issue...
Status: RESOLVED FIXED
Classification: Novell Products
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents
unspecified
Other Other
: P3 - Medium : Major
: ---
Assigned To: Fridrich Strba
Security Team bot
maint:released:sle10-sp3:58973 maint:...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-12 11:53 UTC by Marcus Meissner
Modified: 2014-11-06 17:59 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
0001-system-bus-limit-use-max_replies_per_connection-128-.patch (938 bytes, patch)
2014-09-12 11:54 UTC, Marcus Meissner
Details | Diff
0002-config-reduce-DEFAULT_MESSAGE_UNIX_FDS-to-16.patch (3.56 KB, patch)
2014-09-12 11:54 UTC, Marcus Meissner
Details | Diff
0003-config-change-default-auth_timeout-to-5-seconds.patch (1.19 KB, patch)
2014-09-12 11:55 UTC, Marcus Meissner
Details | Diff
0004-Stop-listening-on-DBusServer-sockets-when-reaching-m.patch (11.55 KB, patch)
2014-09-12 11:55 UTC, Marcus Meissner
Details | Diff
0005-config-add-new-limit-pending_fd_timeout.patch (5.87 KB, patch)
2014-09-12 11:56 UTC, Marcus Meissner
Details | Diff
0006-DBusConnection-implements-_dbus_connection_get_pendi.patch (4.76 KB, patch)
2014-09-12 11:56 UTC, Marcus Meissner
Details | Diff
0007-DBusConnection-implements-_dbus_connection_set_pendi.patch (8.21 KB, patch)
2014-09-12 11:57 UTC, Marcus Meissner
Details | Diff
0008-bus-enforce-pending_fd_timeout.patch (4.69 KB, patch)
2014-09-12 11:57 UTC, Marcus Meissner
Details | Diff
0009-Add-_DBUS_GNUC_UNUSED-and-use-it-in-_DBUS_STATIC_ASS.patch (1.62 KB, patch)
2014-09-12 11:57 UTC, Marcus Meissner
Details | Diff
0010-_dbus_read_socket_with_unix_fds-do-not-accept-extra-.patch (4.24 KB, patch)
2014-09-12 11:58 UTC, Marcus Meissner
Details | Diff
0011-New-test-for-fd-passing.patch (28.93 KB, patch)
2014-09-12 11:58 UTC, Marcus Meissner
Details | Diff
0011-New-test-for-fd-passing.patch (28.84 KB, patch)
2014-09-12 12:00 UTC, Marcus Meissner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Meissner 2014-09-12 11:53:36 UTC
EMBARGOED, via distros

From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Tue, 09 Sep 2014 19:49:06 +0100
Subject: [vs-plain] CVE request for some D-Bus DoS fixes

Hello distro security people,

We would like however many CVE IDs are felt to be appropriate for the
vulnerabilities described below, probably at least 2 (one for the file
descriptor passing issues that were introduced in 1.3.0, and one for
older issues). We intend to fix them all in the same dbus release.
Proposed unembargo date: Tuesday 16th September, timing tbd.

The referenced bugs on freedesktop.org are embargoed and non-public. If
distro security contacts or dbus maintainers would like access, please
open a freedesktop.org Bugzilla account if you don't already have one,
and tell me its associated address by private email.

Bugs listed in approximately descending order of worst-case severity.

A preliminary version of the fixes is attached. Patch 0009 and 0011 are
non-essential: 0009 silences a compiler warning in 0010, and 0011 adds a
regression test.

Thanks,
    S

----8<----

D-Bus <http://www.freedesktop.org/wiki/Software/dbus/> is an
asynchronous inter-process communication system, commonly used
for system services or within a desktop session on Linux and other
operating systems.

Alban Crequy and Simon McVittie at Collabora Ltd. discovered and fixed
several denial-of-service flaws in the reference implementation of
dbus-daemon, the D-Bus message bus daemon. fd.o #83622 could conceivably
also be exploitable to alter data or executable code, but we do not
believe that this is likely.

fd.o #83622
-----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83622
Credit: discovered and fixed by Simon McVittie
Impact: denial of service, possibly heap data corruption
Access required: local
Mitigation: only unusual configurations are vulnerable
Versions believed to be vulnerable: dbus >= 1.3.0

When using the default Unix-socket-based transport, dbus-daemon accepts
and forwards file descriptors (fds) attached to D-Bus messages
("fd-passing"). If the max_message_unix_fds limit is set to an odd
number on 64-bit platforms, a malicious message-sender could pass one
more fd through the kernel than the recipient is expecting. This causes
an assertion failure and dbus-daemon crash if assertions are enabled, or
a buffer overrun by sizeof (int) otherwise.

We do not believe that the buffer overrun can be exploited to alter
data or execute arbitrary code in practice, because the buffer that is
overrun is allocated with libc realloc(), which typically rounds up odd
allocations to a multiple of 8 bytes. This would mean that the overrun
could not actually leave the allocated buffer.

This has been resolved by passing the desired maximum size to the
syscall instead of the rounded-up size of the cmsg buffer, and
discarding any excess fds if the syscall fills the cmsg buffer anyway.

fd.o#82820, part A
------------------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82820
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: dbus >= 1.3.0

The default limits for the system bus allowed each uid to open 256
connections to the system bus, and allowed up to 1024 fds per message,
and up to 4096 fds queued in total on each connection.

By queuing up the maximum allowed number of fds, a malicious sender
could reach the dbus-daemon's RLIMIT_NOFILE (ulimit -n, typically 65536
on Linux). This would act as a denial of service in two ways:

* new clients would be unable to connect to the dbus-daemon
* when receiving a subsequent message from a non-malicious client that
  contained a fd, dbus-daemon would receive the MSG_CTRUNC flag,
  indicating that the list of fds was truncated; kernel fd-passing APIs
  do not provide any way to recover from that, so dbus-daemon responds
  to MSG_CTRUNC by disconnecting the sender, causing denial of service
  to that sender

This has been resolved by changing the defaults so up to 16 fds are
allowed per message, and up to 64 on each connection. This means that
each uid can only queue up to 16384 fds, and denial of service is only
possible if several uids cooperate.

Since this limit might be changed further in future, the D-Bus
maintainers recommend that designers of D-Bus APIs, particularly on the
system bus, do not rely on being able to send more than one fd per message.

Distributors on operating systems with a smaller default RLIMIT_NOFILE
should consider adjusting either that limit, or the defaults in system.conf.
fd.o#82820, part B
------------------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82820
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: dbus >= 1.3.0

Linux allows up to 253 fds to be sent in a single sendmsg() call;
libdbus always sends all of a message's fds, and the beginning
of the message itself, in a single sendmsg() call. Combining these
two, a malicious sender could split a message across two or more
sendmsg() calls to construct a composite message with 254 or more
fds. When dbus-daemon attempted to relay that message to its
recipient in a single sendmsg() call, it would receive EINVAL,
interpret that as a fatal socket error and disconnect the recipient,
resulting in denial of service.

This has been resolved by the same change as fd.o #82820, part A.

fd.o#80559
----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80559
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: dbus >= 1.3.0

By attaching the file descriptor of a D-Bus connection to a D-Bus
message and sending that message via the dbus-daemon, a malicious
process can create D-Bus connections that persist after the process that
created them has terminated. This exacerbates various patterns of
undesirable/abusive behaviour by making it impossible to terminate them
by killing processes.

This has been addressed by closing any connection that has incoming file
descriptors queued for deserialization for more than a configurable
timeout, defaulting to 2.5 minutes.

fd.o#81053
----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=81053
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: all dbus releases

dbus-daemon tracks whether method call messages expect a reply, so that
unsolicited replies can be dropped. As currently implemented, if there
are n parallel method calls in progress, each method reply takes O(n)
CPU time. A malicious user can exploit this by opening the maximum
allowed number of parallel connections and sending the maximum number of
parallel method calls on each one, causing subsequent method calls to be
unreasonably slow, a denial of service.

For the short term, this has been resolved by amending the default
system bus configuration to reduce the number of parallel method calls
allowed per connection, from 8192 to 128 (i.e. from 2097152 to 32768 per
uid).

Longer-term, we plan to use better data structures to make dbus-daemon
more scalable, but this was not felt to be suitable for a minimal
security patch.

fd.o#80919
----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80919
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: all dbus releases

dbus-daemon allows a small number of "incomplete" connections (64 by
default) whose identity has not yet been confirmed. When this limit has
been reached, subsequent connections are dropped. Alban's testing
indicates that one malicious process that makes repeated connection
attempts, but never completes the authentication handshake and instead
waits for dbus-daemon to time out and disconnect it, can cause the
majority of legitimate connection attempts to fail.

This has been resolved by reducing the default authentication timeout
from 30 seconds to 5 seconds, and pausing calls to accept() when the
maximum number of incomplete connections is reached, resulting in
subsequent connections being queued in the kernel (blocking in
connect()) instead of being dropped.

----8<----
Comment 1 Marcus Meissner 2014-09-12 11:54:20 UTC
Created attachment 606138 [details]
0001-system-bus-limit-use-max_replies_per_connection-128-.patch

0001-system-bus-limit-use-max_replies_per_connection-128-.patch
Comment 2 Marcus Meissner 2014-09-12 11:54:51 UTC
Created attachment 606139 [details]
0002-config-reduce-DEFAULT_MESSAGE_UNIX_FDS-to-16.patch

0002-config-reduce-DEFAULT_MESSAGE_UNIX_FDS-to-16.patch
Comment 3 Marcus Meissner 2014-09-12 11:55:14 UTC
Created attachment 606140 [details]
0003-config-change-default-auth_timeout-to-5-seconds.patch

0003-config-change-default-auth_timeout-to-5-seconds.patch
Comment 4 Marcus Meissner 2014-09-12 11:55:37 UTC
Created attachment 606141 [details]
0004-Stop-listening-on-DBusServer-sockets-when-reaching-m.patch

0004-Stop-listening-on-DBusServer-sockets-when-reaching-m.patch
Comment 5 Marcus Meissner 2014-09-12 11:56:25 UTC
Created attachment 606142 [details]
0005-config-add-new-limit-pending_fd_timeout.patch

0005-config-add-new-limit-pending_fd_timeout.patch
Comment 6 Marcus Meissner 2014-09-12 11:56:52 UTC
Created attachment 606143 [details]
0006-DBusConnection-implements-_dbus_connection_get_pendi.patch
Comment 7 Marcus Meissner 2014-09-12 11:57:19 UTC
Created attachment 606144 [details]
0007-DBusConnection-implements-_dbus_connection_set_pendi.patch
Comment 8 Marcus Meissner 2014-09-12 11:57:36 UTC
Created attachment 606145 [details]
0008-bus-enforce-pending_fd_timeout.patch
Comment 9 Marcus Meissner 2014-09-12 11:57:56 UTC
Created attachment 606146 [details]
0009-Add-_DBUS_GNUC_UNUSED-and-use-it-in-_DBUS_STATIC_ASS.patch
Comment 10 Marcus Meissner 2014-09-12 11:58:18 UTC
Created attachment 606147 [details]
0010-_dbus_read_socket_with_unix_fds-do-not-accept-extra-.patch
Comment 11 Marcus Meissner 2014-09-12 11:58:41 UTC
Created attachment 606148 [details]
0011-New-test-for-fd-passing.patch
Comment 12 Marcus Meissner 2014-09-12 12:00:49 UTC
Created attachment 606149 [details]
0011-New-test-for-fd-passing.patch

alternative 0011 version patch against dbus-1.8
Comment 15 Swamp Workflow Management 2014-09-12 12:57:39 UTC
An update workflow for this issue was started.
This issue was rated as important.
Please submit fixed packages until 2014-09-19.
When done, reassign the bug to security-team@suse.de.
https://swamp.suse.de/webswamp/wf/58958
Comment 16 SMASH SMASH 2014-09-12 13:00:15 UTC
Affected packages:

SLE-10-SP3-TERADATA: dbus-1
SLE-11-SP3: dbus-1
SLE-11-SP3-PRODUCTS: dbus-1
SLE-11-SP3-UPTU: dbus-1
Comment 17 Swamp Workflow Management 2014-09-12 22:01:03 UTC
bugbot adjusting priority
Comment 19 Marcus Meissner 2014-09-15 10:47:26 UTC
Apologies for the delay:

fd.o #83622
-----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83622
Credit: discovered and fixed by Simon McVittie
Impact: denial of service, possibly heap data corruption
Access required: local
Mitigation: only unusual configurations are vulnerable
Versions believed to be vulnerable: dbus >= 1.3.0

for 83622 please use CVE-2014-3635


fd.o#82820, part A
------------------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82820
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: dbus >= 1.3.0

fd.o#82820, part B
------------------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82820
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: dbus >= 1.3.0

82820 Part A and part B are merged please use CVE-2014-3636


fd.o#80559
----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80559
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: dbus >= 1.3.0

80559 please use CVE-2014-3637

fd.o#81053
----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=81053
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: all dbus releases

81053 please use CVE-2014-3638


fd.o#80919
----------

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80919
Credit: discovered and fixed by Alban Crequy
Impact: denial of service
Access required: local
Versions believed to be vulnerable: all dbus releases

80919 please use CVE-2014-3639

----8<----
Comment 25 Marcus Meissner 2014-09-16 21:11:07 UTC
public now via oss-sec
Comment 27 Swamp Workflow Management 2014-09-19 21:04:58 UTC
SUSE-SU-2014:1146-1: An update that fixes one vulnerability is now available.

Category: security (important)
Bug References: 896453
CVE References: CVE-2014-3638
Sources used:
SUSE Linux Enterprise Software Development Kit 11 SP3 (src):    dbus-1-1.2.10-3.31.1
SUSE Linux Enterprise Server 11 SP3 for VMware (src):    dbus-1-1.2.10-3.31.1, dbus-1-x11-1.2.10-3.31.1
SUSE Linux Enterprise Server 11 SP3 (src):    dbus-1-1.2.10-3.31.1, dbus-1-x11-1.2.10-3.31.1
SUSE Linux Enterprise Desktop 11 SP3 (src):    dbus-1-1.2.10-3.31.1, dbus-1-x11-1.2.10-3.31.1
Comment 28 Swamp Workflow Management 2014-09-28 10:05:49 UTC
openSUSE-SU-2014:1228-1: An update that fixes 6 vulnerabilities is now available.

Category: security (moderate)
Bug References: 896453
CVE References: CVE-2012-3524,CVE-2014-3635,CVE-2014-3636,CVE-2014-3637,CVE-2014-3638,CVE-2014-3639
Sources used:
openSUSE 13.1 (src):    dbus-1-1.8.8-4.20.1, dbus-1-x11-1.8.8-4.20.2
Comment 29 Swamp Workflow Management 2014-09-28 10:09:44 UTC
openSUSE-SU-2014:1239-1: An update that fixes 5 vulnerabilities is now available.

Category: security (moderate)
Bug References: 896453
CVE References: CVE-2014-3635,CVE-2014-3636,CVE-2014-3637,CVE-2014-3638,CVE-2014-3639
Sources used:
openSUSE 12.3 (src):    dbus-1-1.6.24-2.26.1, dbus-1-x11-1.6.24-2.26.1
Comment 33 Fridrich Strba 2014-11-06 17:46:35 UTC
As of the comment #32, closing this bug
Comment 34 Fridrich Strba 2014-11-06 17:59:17 UTC
As of the comment #32, closing this bug