Re: [PATCH v2] unix: properly account for FDs passed over unix sockets

From: David Herrmann
Date: Wed Feb 03 2016 - 06:56:47 EST


Hi

On Wed, Feb 3, 2016 at 12:36 PM, Simon McVittie
<simon.mcvittie@xxxxxxxxxxxxxxx> wrote:
> Am I right in saying that the advice I give to D-Bus users should be
> something like this?
>
> * system services should not send fds at all, unless they trust the
> dbus-daemon
> * system services should not send fds via D-Bus that will be delivered
> to recipients that they do not trust
> * sending fds to an untrusted recipient would enable that recipient to
> carry out a denial-of-service attack (on what? the sender? the
> dbus-daemon?)

With the revised patch from Hannes, this should no longer be needed.
My original concern was only about accounting inflight-fds on the
file-owner, rather than the sender.

However, with Hannes' revised patch, a different DoS attack against
dbus-daemon is possible. Imagine a peer that receives batches of FDs,
but never dequeues them. They will be accounted on the inflight-limit
of dbus-daemon, as such causing messages of independent peers to be
rejected in case they carry FDs.
Preferably, dbus-daemon would avoid queuing more than 16 FDs on a
single destination (total). But that would require POLLOUT to be
capped by the number of queued fds. A possible workaround is to add
CAP_SYS_RESOURCE to dbus-daemon.

Thanks
David