Products › lamco-dbus-tools › Use cases

A package that opened the D-Bus system bus to every user

A package that opened the D-Bus system bus to every user with send_destination: Find it by an audit against a baseline, as SARIF for CI, and on dbus-daemon.

A package's policy file lets every user send to every name on the system bus, and nothing breaks, so nothing says so. lamco-dbus-tools found it with dbussee, which read the system bus's files before and after, dbusdo, which gave the file to the real dbus-daemon, and dbustell, whose audit against the baseline named the rule and wrote SARIF.

A real run on 2026-12-01 on Debian 13, with a development build of lamco-dbus-tools, version 0.1.0: Two trees of the system bus's files read with audit collect --root, and the package's file given to dbus-daemon 1.16.2. run.sh ran it, before/ and package/ are the made-up files, not a real package's, run.txt is what it printed, and out/ holds the two collections and the SARIF report.

The symptom

A made-up backup package is installed, and with it a policy file and a service file for com.example.Backup. Its policy file was written in a hurry: Inside <policy context="default"> it allows send_destination="*". Nothing breaks, so nothing says anything is wrong. The question is what the system bus allows now that it didn't before, said so a CI job or a fleet's audit can fail on it.

Before and after

Each tree is the machine's own system.conf with the files of system.d it includes, a passwd and group naming its users, and for the second, the package's two files. Each is read as the system would read it:

dbussee audit collect --root before --no-bus --out before.json
dbussee audit collect --root after --no-bus --out after.json

Then the second against the first:

$ dbustell audit after.json --baseline before.json --sarif audit.sarif
The system bus under .../after: 3 names, 1 service files, 0 units scored by systemd 257 (257.13-1~deb13u1), 0 polkit actions, 0 AppArmor profiles with D-Bus rules.

NAME                                         RUNS AS   UNIT                           SCORE EVERY USER MAY           ACTIONS
com.example.Backup                           root      -                                  - call all                 0
com.example.Printer                          -         -                                  - call all                 0
org.freedesktop.DBus                         -         -                                  - call all                 0

3 findings:
POL-002 Every user may send to every name on the system bus [new]: .../com.example.Backup.conf:5: <allow send_destination="*"/> lets every user send to every name on the system bus.
POL-004 A policy file reads differently on the two bus implementations [new]: .../com.example.Backup.conf: line 3: <allow own="com.example.Backup"/> also grants the names below it on dbus-broker.
POL-004 A policy file reads differently on the two bus implementations [unchanged]: .../com.example.Printer.conf: line 3: <allow own="com.example.Printer"/> also grants the names below it on dbus-broker.

Changed since the baseline:
  new name com.example.Backup
  com.example.Printer on dbus-daemon: every user may now call every method, where before call com.example.Printer
  com.example.Printer on dbus-broker: every user may now call every method, where before call com.example.Printer
  org.freedesktop.DBus on dbus-daemon: every user may now call every method, where before call org.freedesktop.DBus, ...
  org.freedesktop.DBus on dbus-broker: every user may now call every method, where before call org.freedesktop.DBus, ...

The one line didn't only open the backup service: A send_destination="*" in the default context applies to every name on the bus, so the printer service, which allowed only its Status method before, now takes every method from every user, and so does the bus itself. That is what "Changed since the baseline" says name by name, and POL-002 is the finding for it. The printer file's own POL-004 was there before the package and is unchanged.

For a CI job or a fleet's dashboard

--sarif writes the findings as SARIF 2.1.0, each with its state against the baseline, which code-scanning tools read:

$ jq -r '.runs[0].results[] | [.ruleId, .baselineState] | @tsv' audit.sarif
POL-002 new
POL-004 new
POL-004 unchanged

A finding is matched to the baseline by what it's about, not its line number or the directory the tree was read from, so a file that only moved lines, or two images read from two directories, compare as they should.

May this user do that?

Asked of the files, for a user alice:

$ dbustell policy after.json --user alice --call com.example.Backup com.example.Backup Erase
dbus-daemon: allowed, by .../after/usr/share/dbus-1/system.d/com.example.Backup.conf:5 <allow send_destination="*"/>
dbus-broker: allowed, by .../after/usr/share/dbus-1/system.d/com.example.Backup.conf:5 <allow send_destination="*"/>
$ dbustell policy before.json --user alice --call com.example.Backup com.example.Backup Erase
dbus-daemon: denied, by .../before/usr/share/dbus-1/system.conf:51 <deny send_type="method_call"/>
dbus-broker: denied, by .../before/usr/share/dbus-1/system.conf:51 <deny send_type="method_call"/>
$ dbustell policy after.json --user alice --own com.example.Backup
dbus-daemon: denied, by .../after/usr/share/dbus-1/system.conf:50 <deny own="*"/>
dbus-broker: denied, by .../after/usr/share/dbus-1/system.conf:50 <deny own="*"/>

Each answer names the rule that decided it. Any user may now call the backup service's Erase; owning its name is still root's.

And of the real daemon

The files' answer is the toolkit's reading of them. The package's file can be given to the real dbus-daemon, after the stock system bus's rules, and the same questions asked of it on a private bus:

$ dbusdo policy probe --base system --implementation daemon --probe "call com.example.Backup com.example.Backup Erase" --probe "own com.example.Backup" com.example.Backup.conf
com.example.Backup.conf on a base of System, probed as user:
  dbus-daemon D-Bus Message Bus Daemon 1.16.2: started
  dbus-daemon  call com.example.Backup com.example.Backup Erase /   allowed  
      by com.example.Backup.conf:5 <allow send_destination="*"/>
  dbus-daemon  own com.example.Backup                               denied   
      by the base, line 8 <deny own="*"/>
The evaluator agrees with every daemon on every probe.

--implementation daemon gives it to dbus-daemon only; left out, both daemons where they're installed. Nothing on the machine's own buses is touched.

The fix

The package's file should allow only its own name: <allow send_destination="com.example.Backup"/>, and only the methods an ordinary user needs. A policy that reads differently shows a fix held to both daemons the same way.

Found while writing this page

The first run showed the printer file's POL-004 as both new and absent: A finding's fingerprint held the full path, and the two trees sit in two directories. Fingerprints are now taken relative to the tree's root, with a test (two_trees_in_two_directories_compare_file_for_file) that failed before the fix.

Related