Red Hat Bugzilla – Bug 1639071
CVE-2018-15686 systemd: Line splitting via fgets() allows for state injection during daemon-reexec
Last modified: 2018-11-02 06:00:13 EDT
systemd is vulnerable to line splitting via long lines read by fgets() in the unit_deserialize() function during daemon-reexec (e.g. during a package upgrade) allowing for state injection. Systemd services with `NotifyAccess != none` and malicious executables can exploit this vulnerability resulting corrupted process state.
When systemd re-executes, the state is serialized and then deserialized after the re-execution. Function unit_deserialize() in file unit.c does not properly handle lines longer than LINE_MAX and the content of a property longer than that is parsed as part of the serialized state, allowing an attacker to corrupt the state of the service (e.g. change the main-pid, control-pid, etc.)
Systemd services with `NotifyAccess != none` can send a status message to systemd, which stores it in the `status-text` property and, in turn, it may trigger the vulnerability. However, this may not be the only way to exploit this flaw. Any other way to set a serialized property to a value longer than LINE_MAX may trigger the flaw as well.
Patch currently under review at: https://github.com/systemd/systemd/pull/10519
Created systemd tracking bugs for this issue: Affects: fedora-all [bug 1643372]
Acknowledgments: Name: Ubuntu, Jann Horn (Google Project Zero)
Upstream patch: https://github.com/systemd/systemd/commit/9f1c81d80a435d15ca1bd536a6d043c18c81c047