Products › lamco-dbus-tools › Docs

Security policy of lamco-dbus-tools: Reports and privilege

Security policy of lamco-dbus-tools: How to report a vulnerability, what's in scope, what the helper, service and kernel part do with privilege, and scrubbing.

Reporting a vulnerability

Report a vulnerability privately, in one of two ways:

Don't open a public issue for it, and don't attach an unscrubbed capture to anything public.

A useful report says which version it's about (dbussee --version), how the programs were built or where they were downloaded from, what you did, and what happened. If the problem is that a scrubbed file still holds a private value, say which kind of value it is and where in the file it stands, and leave the value itself out of the report.

Reporters are credited in the release notes of the release that holds the fix, unless they ask not to be.

The latest release is the one that gets fixes. There are no maintained older release lines.

What's in scope

Any defect of the lamco-dbus-tools programs dbussee, dbusdo, dbustell, dbuskeep and dbussee-monitor that lets someone do what they couldn't do without the toolkit, or that makes public what the toolkit said it would keep back. Three parts run with privilege and deserve the most attention. Each is described below as the code stands.

Also in scope:

  • dbustell reads capture files that other people wrote, and dbustell import reads pcap and pcapng files of D-Bus messages, as busctl capture and dbus-monitor --pcap write them. A file that makes either do anything other than read it and report on it is a vulnerability.
  • A capture that holds what the documentation says it doesn't: A message body kept beyond what --bodies asked for, or, after dbustell scrub or bundle, a value of a kind the scrub says it replaces.

Not in scope:

  • That dbusdo calls methods, sends signals, sets properties, holds names, starts services, plays back a recording or puts load on a bus. Driving the bus is its purpose, each command says so in its help, and it does only what the bus's policy lets the user who runs it do. dbusdo policy and dbusdo sandbox start private bus daemons and a proxy as the user, and send their probes only to those.
  • That a member of the group lamco-dbus-monitor can record the whole system bus. That's what the group is for. Who's in it is the decision that matters, and the documentation says so.
  • Defects of dbus-daemon, dbus-broker, xdg-dbus-proxy, a sandbox or the kernel that the toolkit makes visible. Report those to their projects. A scrubbed capture that shows the defect is a good attachment for such a report.

The privileged parts

The helper, dbussee-monitor

scripts/install-helper installs it setuid root, owned by root and the group lamco-dbus-monitor, mode 4750, as dbus-daemon-launch-helper is installed. Members of the group can then record the system bus. Started setuid, the helper settles its privilege before anything else, while it has one thread:

  • For any bus other than the system bus, or for an address, it gives up privilege for good (real, effective and saved user identifiers) before it connects.
  • It checks that the caller is in lamco-dbus-monitor as well, so a file installed with the wrong mode still refuses everyone else. Membership is read from /etc/group, so a member given the group by a directory service (LDAP, SSSD) is refused: That fails closed, and the group is meant to be a local one, as scripts/install-helper makes it.
  • It makes its real user identifier root too, so the user who started it can't signal it. A user who could stop it could make the system bus stall or cut other programs off.
  • It connects only to the system bus's own socket, /run/dbus/system_bus_socket, and never to an address from the environment.
  • It holds at most 256 MiB of messages waiting for the recorder, whatever budget it's asked for, since with privilege that's root's memory.
  • It refuses to become a monitor of a dbus-daemon older than 1.16.4 unless it's given --accept-known-flaw. Those releases have a flaw that lets an unprivileged user crash a system bus that has a privileged monitor attached.

The helper parses the messages it passes on while it holds root's privilege, and writes them to its standard output. The helper reference describes each step.

The system's service, dbuskeep run on the system bus

It runs as root, the only user that may monitor the system bus on every implementation. It answers on a socket of its own and gives what it keeps only to root and the members of lamco-dbus-monitor. A reader's credentials come from the socket and its groups from /proc, and the process found there must still be the reader's own user's, so a pid reused since the reader connected can't lend it another user's groups. It queues at most 256 MiB for one reader, whatever the reader asks. The service reference says who may ask for what.

The kernel part, dbuskeep kernel

It's built only with the kernel feature, which the release programs have. It loads eBPF programs on the kernel's local stream socket functions with exactly two capabilities, CAP_BPF and CAP_PERFMON. With --refuse it also loads a program on a security hook that refuses chosen connections, and it stops with the reason, rather than running without that rule, where the kernel doesn't enable the bpf security module. It gives a bus's events only to the user whose bus it is and to root, and the system bus's to root and the group. Where it can't look at a bus's socket, as its systemd unit can't inside a user's /run/user/UID, it holds the asker to the user of the bus's own process. Since the hooks hold a fixed number of buses, a user other than root may add at most 8 of them. The kernel part reference says how.

Scrubbing: dbustell scrub and bundle

A capture holds what crossed the bus, so it holds private details. dbustell scrub writes a copy that's fit to attach to a public report, and bundle writes that copy with the reports of it. The scrub:

  • Removes every message body, whether decoded, raw or hashed, and every stored byte string. The bus's own announcements of owner changes are kept, since they hold only names.
  • Replaces the host name, every user name in a home directory's path, and anything shaped like a mail address, wherever they appear.
  • Turns the machine's and the boot's identifiers into a hash, so two scrubbed captures of one machine still compare as one machine.

It can't find a person's name written anywhere else, such as in a well-known name or an object path. The scrub is a best effort. Its tests run on invented captures, and it has had no review from outside the project.

Read a scrubbed capture before you post it. It's a JSON file. Search it for your login name, your host name and anything else you wouldn't want public. If you find one, don't post the file, and tell us as described at the top.