What happened
A command injection vulnerability has been identified in the rpm package management utility. This flaw arises when installing or rebuilding a source RPM that contains source or spec file basenames with a %() macro construct. The affected process causes rpm to execute an attacker-controlled shell command through the popen() function while relocating the source file list. Exploiting this flaw allows arbitrary commands to be executed as the user running rpm, which is often a non-privileged user. The vulnerability has a high severity rating, with a CVSS score of 7.8, indicating significant potential impact. The issue was reported by the NVD and impacts several versions of Red Hat Enterprise Linux, including versions 6 through 10, along with related Hardened Images. The root cause involves the way rpm handles specific macro constructs within source files, leading to untrusted command execution under certain conditions.
Who is affected
Organisations running various versions of Red Hat Enterprise Linux, including RHEL 6, 7, 8, 9 and 10, as well as Red Hat Hardened Images, may be affected. The vulnerability requires local access to the host and can be exploited by a user who performs actions such as installing or rebuilding a source RPM with malicious macro constructs. No prior access or special privileges are necessary to initiate the attack, but it requires user interaction, such as opening a file or executing a command within rpm. Devices or systems where untrusted source RPMs are processed are at risk, especially if user actions are involved in installing or rebuilding package sources.
Recommended actions
- Verify the source of RPM packages before installation or rebuild to ensure they are from trusted sources, especially when source or spec files contain macros.
- Implement strict privilege hygiene practices to limit the ability of non-privileged users to install or rebuild source RPMs, reducing the likelihood of malicious macro usage.
- Apply endpoint security measures to monitor for suspicious activity related to rpm operations, particularly operations involving source RPMs and macro constructs.

