RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1501017 - unprivileged user can freeze journald
Summary: unprivileged user can freeze journald
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.5
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Lukáš Nykrýn
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On: 1279251
Blocks: 1280234 1466365
TreeView+ depends on / blocked
 
Reported: 2017-10-12 03:19 UTC by Huzaifa S. Sidhpurwala
Modified: 2018-04-10 11:25 UTC (History)
13 users (show)

Fixed In Version: systemd-219-54.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1279251
Environment:
Last Closed: 2018-04-10 11:24:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1514141 0 None None None 2017-10-12 03:19:26 UTC
Red Hat Product Errata RHBA-2018:0711 0 None None None 2018-04-10 11:25:16 UTC

Description Huzaifa S. Sidhpurwala 2017-10-12 03:19:26 UTC
+++ This bug was initially created as a clone of Bug #1279251 +++

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):

systemd-222-8.fc23.x86_64

How reproducible:

100%

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.

--- Additional comment from Guillaume Knispel on 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

--- Additional comment from Lennart Poettering on 2016-02-10 08:59:19 EST ---

Fixed upstream a while back.

--- Additional comment from Mike McCune on 2016-03-28 19:38:32 EDT ---

This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

--- Additional comment from Fedora End Of Life on 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.

--- Additional comment from Fedora End Of Life on 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
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Lukáš Nykrýn 2017-10-22 14:45:59 UTC
fix merged to staging branch -> https://github.com/lnykryn/systemd-rhel/pull/159 -> post

Comment 9 Lukáš Nykrýn 2018-02-05 17:20:31 UTC
fix merged to staging branch -> https://github.com/lnykryn/systemd-rhel/pull/188 -> post

Comment 14 errata-xmlrpc 2018-04-10 11:24:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0711


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