Bug 1662867 (CVE-2018-16888)

Summary: CVE-2018-16888 systemd: kills privileged process if unprivileged PIDFile was tampered
Product: [Other] Security Response Reporter: Riccardo Schirone <rschiron>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: mmezynsk, systemd-maint-list, systemd-maint
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd 237 Doc Type: If docs needed, set a value
Doc Text:
It was discovered systemd does not correctly check the content of PIDFile files before using it to kill processes. When a service is run from an unprivileged user (e.g. User field set in the service file), a local attacker who is able to write to the PIDFile of the mentioned service may use this flaw to trick systemd into killing other services and/or privileged processes.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 19:20:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1663143, 1786119, 1786120, 1786121    
Bug Blocks: 1662883    

Description Riccardo Schirone 2019-01-02 09:38:37 UTC
systemd up to version 237 does not perform any check on the content of the PIDFile file of a service, which may result in systemd killing a process owned by other services when the service the PIDFile belongs to is stopped. In case the PIDFile is owned by unprivileged users (e.g. a service run with a different User field), systemd may kill privileged processes. A local attacker who is able to tamper with the PIDFile of a service may trick systemd into killing processes he would not have permissions to kill, in the moment a privileged user tries to kill the mentioned service.

Upstream patches:
https://github.com/systemd/systemd/pull/7816

Upstream issue:
https://github.com/systemd/systemd/issues/6632

Comment 5 Riccardo Schirone 2019-01-03 10:09:52 UTC
When PIDFile is specified, systemd uses the content of the file to find out the pid of the main process of a service. A vulnerable/malicious service (or one executed by unprivileged user with the User/Group fields) may allow non-root users to write into this file, tricking systemd into killing the wrong process. This is particularly important when services are run by unprivileged users, because systemd kills the process with root permission, even if the service was started by a different user (e.g. User=unprivileged-user) and can be used by a local attacker to cause a Denial of Service.

Comment 6 errata-xmlrpc 2019-08-06 12:13:46 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2019:2091 https://access.redhat.com/errata/RHSA-2019:2091

Comment 7 Product Security DevOps Team 2019-08-06 19:20:28 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2018-16888