Red Hat Bugzilla – Bug 1279251
unprivileged user can freeze journald
Last modified: 2017-10-11 23:19:26 EDT
Created attachment 1091441 [details]
program to freeze journald
Description of problem:
On default installs of Fedora 23 an unprivileged user can freeze journald using the attached program. (Journald is then eventually killed and restarted by systemd after a 1 min timeout is detected - but nothing prevent the unprivileged user to DOS in a loop if he feels so inclined.)
The reason is that journald uses inappropriate rules to decide if a file descriptor sent by a user is safe to read.
[ IMO that such a "feature" (passing messages to log to journald by fd to regular files) exists at all should be questioned anyway, given the kind of impacts it can have on various aspects of the whole system (e.g.: the fd is completely read in a malloc'ed area, up to 750 MB) ]
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. gcc -O2 -Wall -Wextra -std=gnu99 -o lol lol.c
journald freezes on a pread system call trying to read the mandatory locked regular file. It won't be unblocked until killed or the "./lol" program is stopped.
journald does not freeze.
Bug affects several distro. My POC requires unshare(CLONE_NEWNS | CLONE_NEWUSER) allowed for users, which is the case by default at least on Ubuntu and Fedora, but maybe it is possible to use other methods to bypass the checks that try to test if the file is in /tmp and other allowed dirs. Without even bypassing anything, the system could have been configured with the mand mount option on tmp by an administrator not aware of the security implication on journald. Also maybe other things than mandatory locking can affect the syscall of journald on the fd. Also given that /proc/self/fd/<n> does not seems intended for security purposes (otherwise it would have change the symlink when crossing the unshared FS bondary, somehow), maybe there exist or there will exist in the future other ways to affect its content.
Also I've not audited all systemd source code. Maybe others of its components are affected by the same class of bugs.
OpenSUSE 42.1 bug: https://bugzilla.opensuse.org/show_bug.cgi?id=954374
upstream bug: https://github.com/systemd/systemd/issues/1822
Fixed upstream a while back.
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see email@example.com with any questions
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora 'version'
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 23 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.