Bug 2540030
| Summary: | CVE-2026-95521 rpm: rpm: shell command injection via macro expansion of source/spec file basenames when installing a source RPM [fedora-all] | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Vladimir Vasilev <vvasilev> |
| Component: | rpm | Assignee: | Panu Matilainen <pmatilai> |
| Status: | ASSIGNED --- | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | rawhide | CC: | igor.raits, mdomonko, packaging-team-maint, pmatilai |
| Target Milestone: | --- | Keywords: | Security, SecurityTracking |
| Target Release: | --- | Flags: | fedora-admin-xmlrpc:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | {"flaws": ["86390a09-776a-4c9c-b856-0ad387b0415f"]} | ||
| Fixed In Version: | Doc Type: | --- | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | --- | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 2537812 | ||
Disclaimer: Community trackers are created by Red Hat Product Security team on a best effort basis. Package maintainers are required to ascertain if the flaw indeed affects their package, before starting the update process. A command injection flaw was found in rpm. The macro engine's %() construct executes an embedded shell command via popen() whenever the macro text is expanded, regardless of where that text came from (rpmio/macro.cc: case '(' at :1678 calls doShellEscape(), which ends in popen(buf, "r") at :499). Installing or rebuilding a .src.rpm routes through rpmInstallSourcePackage(), whose getFiles() calls rpmRelocateSrpmFileList() (lib/relocation.cc:454); that function builds the destination path for every source and spec file with rpmGenPath(rootDir, "%{_specdir}"|"%{_sourcedir}", bn), and join_path() (rpmio/rpmfileutil.cc:463) macro-expands each path component individually, including the package-supplied basename bn. A source or spec basename containing a %(cmd) construct is therefore expanded and the embedded command executed. This install path never calls rpmtsRun(), so %_pkgverify_level provides no protection: rpmReadPackageFile() hard-codes vfylevel to 0 (lib/package.cc:315) and accepts a completely unsigned .src.rpm under the distro-default policy, and rpm -i still reports success (exit 0) with nothing to indicate a command ran. rpmbuild --rebuild reaches the same relocation code during install, before any mock/chroot sandbox boundary. This was confirmed by reproducing the reporter's proof of concept with an AddressSanitizer-instrumented build of rpm at both rpm-6.1.0-release and master: rpm -i against a crafted, unsigned .src.rpm silently ran an embedded canary command while the install still exited 0, including with %_pkgverify_level all set, which shows signature policy is not the gate; negative controls (removing the leading %, or using rpm -qpl instead of installing) did not execute the command.