Bug 1217182 - AUDIT-WHITELIST: libksysguard6: new revision of org.kde.ksysguard.processlisthelper.service
Summary: AUDIT-WHITELIST: libksysguard6: new revision of org.kde.ksysguard.processlist...
Status: RESOLVED FIXED
Alias: None
Product: SUSE Security Incidents
Classification: Novell Products
Component: Audits (show other bugs)
Version: unspecified
Hardware: Other Other
: P5 - None : Normal
Target Milestone: ---
Assignee: Matthias Gerstner
QA Contact: Security Team bot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 1217076
  Show dependency treegraph
 
Reported: 2023-11-15 12:59 UTC by Matthias Gerstner
Modified: 2024-02-21 14:46 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Gerstner 2023-11-15 12:59:56 UTC
+++ This bug was initially created as a clone of Bug #1217076

Sub bug for a bunch of new D-Bus interfaces in KDE6.

Package is found in KDE:Unstable:Frameworks/libksysguard6.

libksysguard6-plugins.x86_64: E: dbus-file-unauthorized (Badness: 10) /usr/share/dbus-1/system-services/org.kde.ksysguard.processlisthelper.service
libksysguard6-plugins.x86_64: E: dbus-file-unauthorized (Badness: 10) /usr/share/dbus-1/system.d/org.kde.ksysguard.processlisthelper.conf
Comment 1 Matthias Gerstner 2023-12-04 14:09:48 UTC
I'll look into this one now.
Comment 2 Matthias Gerstner 2023-12-05 12:31:59 UTC
apart from the processlist_helper this package also ships ksgrd_network_helper
which has the cap_net_raw capability. The review we did for the latter in bug
1151190 was not too great in terms of code quality.
Comment 3 Matthias Gerstner 2023-12-05 14:07:00 UTC
I am done with the processlist_helper. There is nothing too wrong with it
security wise but it has some quirks:

- sendsignal is racy in nature, since PIDs can be recycled. It's a pretty
  generic interface to send arbitrary signals to arbitrary PIDs. This has to
  be `auth_admin` forever.
- renice is even racier in nature and can fail by accident, since they
  try to renice each thread of a process via /proc/<pid>/task.
- changeioscheduler and changecpuscheduler: these are similar to renice. Here
  raw integer constant are passed for the io class, for example. This could be
  improved by passing string labels or properly casting from/to enums.

In all of these functions a nonsensical approach is found for specifying
multiple PIDs to operate on:

There is a `pidcount` integer and then for the count of PIDs the code looks
for further entries in the QVariantMap named `pid%i`. This is only bloating
the code and making everything more complex. They *do* have a QVariantMap
after all, so why not place a proper list or vector data structure in there?
Comment 4 Christophe Marin 2023-12-05 15:26:58 UTC
Filed https://invent.kde.org/plasma/libksysguard/-/issues/4
Comment 5 Matthias Gerstner 2023-12-06 13:06:27 UTC
I also had a look into the ksgrd_network_helper that runs with cap_net_raw
capability.

The program is a bit larger and uses libpcap to process the headers of all
IPv4/IPv6 packets that pass the system. Then /proc/<pid>/fd is crawled to
match socket inodes to process IDs. All of that stuff is then output on stdout
for consumption of other programs.

This program can easily be problematic, since it handles a lot of untrusted
data:

- the ethernet headers and IP headers of packets originated from other systems
  or unprivileged processes on the local system.
- the PID in /proc that are at least partially controlled by unprivileged
  local processes.

I looked into the critical code paths and it looks like all they do is reading
the IP address fields in the network packets and reading the symlinks in
/proc/<pid>/fd to check whether they are `socket:<inode>` files.

The PIDs, inodes and IP addresses along with some statistical data is only
used for display purposes. So in its current form it should be fine. There are
likely some non-security bugs in there though e.g. when multiple connections
to the same IP address occur.
Comment 6 Matthias Gerstner 2023-12-06 13:23:36 UTC
Both components are okay security wise, apart from the smaller suggestions for
the processlisthelper. The component can be whitelisted after a quick
refresher when the kde6 release is coming closer.

The Git revision I reviewed so far is 3da755aa.
Comment 7 Matthias Gerstner 2024-02-13 13:29:41 UTC
The package to be submitted is now in KDE:Frameworks/libksysguard6.

The changes since the review are nearly only noise, but they also renamed the
D-Bus interfaces for versioning. So it's good we didn't whitelist right away.

The issues reported in comment 4 have not been addressed by they are
non-security so we can start the whitelisting process.
Comment 9 Matthias Gerstner 2024-02-21 14:46:38 UTC
The whitelisting is in Factory now. Closing as fixed.