Bug 1279251 - unprivileged user can freeze journald
unprivileged user can freeze journald
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
All Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
: Security
Depends On:
Blocks: 1280234 1501017
  Show dependency treegraph
Reported: 2015-11-08 16:15 EST by Guillaume Knispel
Modified: 2017-10-11 23:19 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1501017 (view as bug list)
Last Closed: 2016-12-20 10:32:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
program to freeze journald (1.48 KB, text/plain)
2015-11-08 16:15 EST, Guillaume Knispel
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1514141 None None None Never

  None (edit)
Description Guillaume Knispel 2015-11-08 16:15:00 EST
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):


How reproducible:


Steps to Reproduce:

1. gcc -O2 -Wall -Wextra -std=gnu99 -o lol lol.c
2. ./lol

Actual results:

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.

Expected results:

journald does not freeze.

Additional info:

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.
Comment 1 Guillaume Knispel 2015-11-09 21:16:00 EST
OpenSUSE 42.1 bug: https://bugzilla.opensuse.org/show_bug.cgi?id=954374
upstream bug: https://github.com/systemd/systemd/issues/1822
Comment 2 Lennart Poettering 2016-02-10 08:59:19 EST
Fixed upstream a while back.
Comment 3 Mike McCune 2016-03-28 19:38:32 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions
Comment 4 Fedora End Of Life 2016-11-24 08:13:10 EST
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'
of '23'.

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.
Comment 5 Fedora End Of Life 2016-12-20 10:32:40 EST
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.

Note You need to log in before you can comment on or make changes to this bug.