This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2181477 - Rules to enable dracut execution are too loose
Summary: Rules to enable dracut execution are too loose
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: fapolicyd
Version: 8.7
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Radovan Sroka
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-24 08:55 UTC by Renaud Métrich
Modified: 2023-08-16 14:58 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-08-16 14:58:33 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-1369 0 None None None 2023-08-16 14:58:32 UTC
Red Hat Issue Tracker RHELPLAN-153002 0 None None None 2023-03-24 08:56:53 UTC
Red Hat Issue Tracker SECENGSP-5124 0 None None None 2023-03-24 08:57:02 UTC

Description Renaud Métrich 2023-03-24 08:55:28 UTC
Description of problem:

IMHO the rules added to enable dracut execution are too loose (/etc/fapolicyd/rules.d/20-dracut.rules):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
allow perm=any uid=0 : dir=/var/tmp/
allow perm=any uid=0 trust=1 : all
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

I think there are 2 issues:

1. the "allow perm=any uid=0 : dir=/var/tmp/" rule is not needed at all, dracut executes fine (at least with default command "dracut -f") with just second rule

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # cat /etc/fapolicyd/rules.d/20-dracut.rules
  # Carve out an exception for dracut's initramfs building
  
  #allow perm=any uid=0 : dir=/var/tmp/
  allow perm=any uid=0 trust=1 : all
  
  # systemctl restart fapolicyd
  # dracut /tmp/initrd.img $(uname -r)
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. the "allow perm=any uid=0 trust=1 : all" rule allows root user to execute any crafted program

  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
  # cat > hello.c << EOF
  #include <stdio.h>
  int main(int argc, char *argv[])
  {
    printf("Hello!\n");
    return 0;
  }
  EOF

  # gcc -o hello hello.c

  # ./hello
  Hello!
  -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

I think if there is no other choice but this second rule, then a comment in the rules file should clearly mention that this opens the world for root user a lot more than just dracut.

Version-Release number of selected component (if applicable):

fapolicyd-1.1.3-8.el8_7.1.x86_64

How reproducible:

Always, see above.

Comment 1 Radovan Sroka 2023-03-24 13:50:17 UTC
This is somehow expected. We allowed root because we had lot of issues with execution of the files during system upgrade and other scenarios like dracut. Moreover root can kill fapolicyd anytime so it's hard to fight against.

Comment 2 Radovan Sroka 2023-08-16 14:45:25 UTC
This bug is going to be migrated.

Contact point for migration questions or issues: rsroka
Guidance for Bugzilla users to test their Jira account or create one if needed:

https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016394
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016694
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016774


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