Hi,
The following vulnerability was published for rpm.
CVE-2026-78367[0]:
| A vulnerability was found in RPM's rpmbuild tarball processing. When
| processing a crafted source archive, the getTarSpec() function in
| tools/rpmbuild.cc passes an attacker-controlled tar archive member
| name to rpmExpand() as part of a %{basename:...} macro expression. A
| specially crafted .spec member name can therefore inject RPM macros,
| including Lua expressions, resulting in arbitrary code execution
| with the privileges of the user running rpmbuild. This can be
| exploited when a victim or automated build system processes an
| attacker-controlled source tarball using rpmbuild tarball mode (such
| as -ts, -ta, or -tb).
If you fix the vulnerability please also make sure to include the
CVE (Common Vulnerabilities & Exposures) id in your changelog entry.
For further information see:
[0] https://security-tracker.debian.org/tracker/CVE-2026-78367
https://www.cve.org/CVERecord?id=CVE-2026-78367
[1] https://github.com/rpm-software-management/rpm/issues/4314
Please adjust the affected versions in the BTS as needed.
Regards,
Salvatore
Hi, Upstream issue #4314 was closed on 2026-09-03 by: 2a11eb3e4e51094082e0123aebd797ec051dc094 "Prevent command injection via rpmbuild -t" (Michal Domonkos) https://www.google.com/url?q=https://github.com/rpm-software-management/rpm/commit/2a11eb3e4e51094082e0123aebd797ec051dc094&source=gmail&ust=1793790385674000&sa=E The fix: - builds the destination path with basename(3) + rasprintf() instead of rpmExpand("%{_specdir}/%{basename:", tarbuf, "}"), so the member name is no longer macro-expanded in getTarSpec(); - in parseSpec(), replaces rpmGetPath(specFile, NULL) with rpmCleanPath(xstrdup(specFile)), removing the second expansion; - adds a regression test (tests/ https://www.google.com/url?q=http://rpmbuild.at&source=gmail&ust=1793790385674000&sa=E, "rpmbuild -ts <spec> (evil)"). It is on master only; it is not on the rpm-6.1.x or rpm-6.0.x branches yet. What I checked (static only): - rpm-6.1.0 (sid/forky, 6.1.0-1): the vulnerable line is present at tools/rpmbuild.cc:423. The patch applies with patch -p1 with no fuzz (the https://www.google.com/url?q=http://rpmbuild.at&source=gmail&ust=1793790385674000&sa=E hunk has a -19 line offset). Debian's only patch, macro.patch, touches https://www.google.com/url?q=http://macros.in&source=gmail&ust=1793790385674000&sa=E only, so there is no conflict. - rpm-4.20.1 (trixie): the same code is in tools/rpmbuild.c:413 and build/parseSpec.c. The code hunks apply after renaming .cc to .c (offsets -10/-3, no fuzz). <libgen.h> is already included there. - rpm-4.18.0 (bookworm): the same expression is in rpmbuild.c:421, and parseSpec.c:902 uses rpmGetPath(specFile, NULL). Not done: I did not build the patched package or run the testsuite (that needs the full rpm-sequoia/cmake build environment), and I did not run the reproducer. Related: master also has the follow-up 7a4111bc5d ("Prevent command injection via rpmbuild -t filename", Fixes: CVE-2026-84837, CVE-2026-84838, i.e. #1146602). It depends on intermediate commits and does not apply directly to 6.1.0, so it is a separate backport. The upstream patch is attached. Regards
Hi,
A follow-up to my earlier mail, which was a static check only.
I generated the archive from upstream's regression test for this CVE
(tests/data/misc/CVE-2026-78367.py, added by 2a11eb3e4e). Its spec member
name carries a %{lua:...} macro that writes "gotcha" to $RPM_POC_PATH.
I then ran the installed Debian rpmbuild (rpm 6.1.0-1, amd64) the same
way tests/
https://www.google.com/url?q=http://rpmbuild.at&source=gmail&ust=1793791675054000&sa=E
does, with an isolated HOME and _topdir:
RPM_POC_PATH=$PWD/gotcha rpmbuild --define "_topdir $PWD/top" --quiet -ts
evil.tar.gz
Result:
exit status 0
top/SRPMS/poc-1.0-1.src.rpm was created
the file "gotcha" was created, containing "gotcha"
Upstream's test expects the file to be absent ("test -f ... => 1"), so
sid's 6.1.0-1 fails it: the macro in the member name is executed by
just running "rpmbuild -ts" on the tarball.
I have not rebuilt the package with the patch, so the "after" side is
still only the patch-applies check from my previous mail.
Regards
Hi, Following up on my two earlier mails (the static patch-applies check, and the reproducer run that confirmed sid 6.1.0-1 is affected): I have now done the "after" side that was still missing, for the stable suites. I adapted the upstream fix 2a11eb3e4e51 to the Debian 4.x sources (the upstream commit is against the .cc tree; the stable suites still use .c) and built and tested patched packages. The test input is a tarball with a single *.spec member whose name carries an rpm macro command substitution, i.e. %(...), plus a minimal valid spec body, run as rpmbuild -ts with an isolated _topdir/_specdir: - rpm 4.20.1+dfsg-3 (trixie): the backport applies cleanly (patch -p1, no fuzz) and builds. Unpatched, the command in the member name is executed when running rpmbuild -ts on the tarball. Patched, it is not executed, and rpmbuild -ts still writes the .src.rpm, so a normal -t build is unaffected. - rpm 4.18.0+dfsg-1+deb12u1 (bookworm): same result - applies cleanly, builds, unpatched executes the injected command, patched does not, and the SRPM is still produced. - rpm 4.16.1.2+dfsg1-3 (bullseye): the bookworm backport applies with line offsets (no fuzz); I did not build-test this one. The patched builds were configured with the libgcrypt crypto backend and with optional subsystems (SELinux, audit, plugins, python, sequoia) disabled; the change is confined to getTarSpec() and parseSpec(), so that does not affect the result. Attached are the two backports as DEP-3 patches, adapted for 4.20.1 and 4.18.0. These are the stable-source versions of the upstream patch I attached earlier. The separate follow-up commit 7a4111bc5d (bug #1146602) is still a separate backport and is not covered here. Regards, Sumit Verma