Hardening: reject UpdateActivationEnvironment on non-canonical path
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 19 Dec 2014 18:49:33 +0000 (18:49 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 1 Jan 2015 23:32:16 +0000 (23:32 +0000)
commit6a3f563a4b9449b257015f6118821057239a395b
tree22eaed86a627e73ac959043c7f91cb8ba6ab11aa
parentbf79b97f87f614becb6334ad3d008759e53c8b96
Hardening: reject UpdateActivationEnvironment on non-canonical path

UpdateActivationEnvironment is the one dbus-daemon API call that is
obviously dangerous (it is intended for the session bus),
so the default system.conf does not allow anyone to call it.

It has recently come to the D-Bus maintainers' attention that some
system services incorrectly install D-Bus policy rules that allow
arbitrary method calls to any destination as long as they have a
"safe" object path. This is not actually safe: some system services
that use low-level D-Bus bindings like libdbus, including dbus-daemon
itself, provide the same API on all object paths.

Unauthorized calls to UpdateActivationEnvironment are probably just
resource consumption rather than privilege escalation, because on
the system bus, the modified environment is only used to execute
a setuid wrapper that avoids LD_PRELOAD etc. via normal setuid
handling, and sanitizes its own environment before executing
the real service. However, it's safest to assume the worst and
treat it as a potential privilege escalation.

Accordingly, as a hardening measure to avoid privilege escalation on
systems with these faulty services, stop allowing calls to
("/com/example/Whatever",
"org.freedesktop.DBus.UpdateActivationEnvironment")
and only allow ("/org/freedesktop/DBus",
"org.freedesktop.DBus.UpdateActivationEnvironment").

We deliberately continue to provide read-only APIs like
GetConnectionUnixUser at all object paths, for backwards compatibility.

Reviewed-by: Thiago Macieira <thiago@kde.org>
[adjusted commit message to note that this is probably only DoS -smcv]
bus/driver.c
bus/driver.h