First published: Mon May 24 2021(Updated: )
In response to <a href="https://access.redhat.com/security/cve/CVE-2017-7500">CVE-2017-7500</a> and <a href="https://access.redhat.com/security/cve/CVE-2017-7501">CVE-2017-7501</a>, it was decided that the policy of RPM is "Only follow directory symlinks owned by target directory owner or root." [1]. This check was only implemented for the parent directory of the file to be created. If an untrusted user owns another ancestor directory, the problem remains unfixed. An actual exploit requires that a similar directory structure exists both at the location where RPM operates and for the files the attacker wants to get control over. Packages with such paths do exist in the real world, however. For example, in openSUSE both matomo and icinga2 ship a 'Pdo/Mysql.php' somewhere in the file system, with different ownership. A compromised 'matomo' user can create a symlink /srv/www/matomo/core/Tracker/Db -> /usr/share/icingaweb2/library/vendor/Zend/Db/Adapter/ and on the next update of matomo, RPM would replace the 'Pdo/Mysql.php' of icinga2 and give ownership of it to the 'matomo' user. A fix for this requires a messy ball of code using O_PATH to manually walk the whole directory structure and manually resolving symlinks, like in [1] and [2]. References: 1: <a href="https://github.com/systemd/systemd/blob/a5648b809457d120500b2acb18b31e2168a4817a/src/basic/fs-util.c#L716">https://github.com/systemd/systemd/blob/a5648b809457d120500b2acb18b31e2168a4817a/src/basic/fs-util.c#L716</a> 2: <a href="https://build.suse.de/package/view_file/SUSE:Maintenance:13179/permissions.SUSE_SLE-15-SP1_Update/0007-chkstat-fix-privesc-CVE-2019-3690.patch?expand=1">https://build.suse.de/package/view_file/SUSE:Maintenance:13179/permissions.SUSE_SLE-15-SP1_Update/0007-chkstat-fix-privesc-CVE-2019-3690.patch?expand=1</a> 3. <a href="https://bugzilla.suse.com/show_bug.cgi?id=1157883">https://bugzilla.suse.com/show_bug.cgi?id=1157883</a>
Credit: secalert@redhat.com
Affected Software | Affected Version | How to fix |
---|---|---|
Rpm Rpm | <4.18 | |
Redhat Enterprise Linux | =8.0 | |
redhat/rpm | <4.18.0 | 4.18.0 |
https://github.com/rpm-software-management/rpm/commit/96ec957e281220f8e137a2d5eb23b83a6377d556
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
CVE-2021-35939 is a vulnerability that allows a local unprivileged user to potentially gain root privileges on certain Linux systems.
The affected software includes RPM version up to 4.18.0 on Red Hat Enterprise Linux 8.0.
CVE-2021-35939 has a severity rating of medium with a CVSS score of 6.7.
An attacker with local unprivileged access who owns an ancestor directory can exploit this vulnerability to gain root privileges.
Yes, a fix is available for CVE-2021-35939. It is recommended to update to RPM version 4.18.0 or later.