Bug 2212306 - kexec %preun scriptlets allow a local attacker to remove arbitrary paths in the system
Summary: kexec %preun scriptlets allow a local attacker to remove arbitrary paths in t...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: kexec-tools
Version: 39
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Coiby
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-05 08:57 UTC by Zbigniew Jędrzejewski-Szmek
Modified: 2023-08-16 08:10 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-853 0 None None None 2023-06-05 09:01:34 UTC

Description Zbigniew Jędrzejewski-Szmek 2023-06-05 08:57:01 UTC
The scriptlets start with:

if [ ! -f /run/ostree-booted ] && [ $1 == 2 ] && grep -q get-default-crashkernel /usr/bin/kdumpctl; then
  kdumpctl get-default-crashkernel kdump > /tmp/old_default_crashkernel 2>/dev/null
fi

Thus, if any local user does 'ln -s /tmp/old_default_crashkernel /some/path', the scriptlet will attempt to write to /some/path.

When testing whether this works, I realized that we set sysctl fs.protected_symlinks=1 the configuration provided by systemd, so this will just fail in most cases, instead of overwriting the file, turning this into a DOS rather than a security issue. But it's still just terrible. Please don't use a predictable file name in a shared directory.


Reproducible: Always

Comment 1 Fedora Release Engineering 2023-08-16 08:10:16 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.


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