News for hackers. Stuff that matters.
Re:The cpio trailer problem (2018) by avian on Sunday July 19, 2020 @03:25AM (#23887641)
> I assume that cpio is very rarely used these days.

From Wikipedia:

> The use of cpio by the RPM Package Manager, in the initramfs program of Linux kernel 2.6, and in Apple's Installer (pax) make cpio an important archiving tool.

Re:The cpio trailer problem (2018) by rwmj on Sunday July 19, 2020 @06:23AM (#23888363)
RPM hasn't used true cpio for a while [since 2013] because cpio didn't support > 4GB files. It now uses its own format which it evolved from cpio.
Re:The cpio trailer problem (2018) by tyingq on Sunday July 19, 2020 @09:59AM (#23889410)
Seems they still use the same logic though: https://github.com/rpm-software-management/rpm/blob/853c48ba...
Re:The cpio trailer problem (2018) by rwmj on Sunday July 19, 2020 @10:12AM (#23889491)
That doesn't actually matter though does it, because RPM is no longer using cpio, it's now using a custom format that happens to once have been related to cpio. What matters is what RPM does, not what cpio does.

In this case it's not possible to create such an archive using rpmbuild as all files added to RPMs much start with "/". I just tried it and got:

  RPM build errors:
      File must begin with "/": TRAILER!!!
You cannot hack on your own rpmbuild because you wouldn't be able to make a signed RPM (as those can only be built through the Koji build system which doesn't have your hacked rpmbuild), so you couldn't distribute that RPM to Fedora or Red Hat Enterprise Linux.

In other words this is essentially a non-problem for RPM.

Re:The cpio trailer problem (2018) by tyingq on Sunday July 19, 2020 @10:18AM (#23889519)
The comparison is just to the filename, not including the path. You may be right, but that check doesn't prove it.

Edit: Thanks for the reply! Apparently they are including the path.

Re:The cpio trailer problem (2018) by rwmj on Sunday July 19, 2020 @10:39AM (#23889648)
I can create an RPM containing a filename "TRAILER!!!" just fine:

  $ rpm -qlp /home/rjones/d/fedora/virt-what/master/x86_64/virt-what-1.20-1.fc33.x86_64.rpm
  /TRAILER!!!
  /usr/lib/.build-id
  /usr/lib/.build-id/59
  /usr/lib/.build-id/59/59c1cb95689b7babd5a6cb1b5bc58f12e20b3a
  /usr/libexec/virt-what-cpuid-helper
  /usr/sbin/virt-what
  /usr/share/doc/virt-what
  /usr/share/doc/virt-what/COPYING
  /usr/share/doc/virt-what/README
  /usr/share/man/man1/virt-what.1.gz
Furthermore I installed and uninstalled it with no ill effects, and the file was created and removed in /. So whatever problem cpio may have with this file does not affect the RPM-not-quite-cpio format.
Re:The cpio trailer problem (2018) by marcan_42 on Sunday July 19, 2020 @04:26AM (#23887891)
All of which are administrative formats that do not include user data. I can't think of a way that this "feature" could be abused in those contexts to cause a security problem.
Re:The cpio trailer problem (2018) by sp332 on Sunday July 19, 2020 @08:26AM (#23888874)
If, say, an anti-virus program extracts an RPM's contents and scans each file separately, then it might miss files smuggled in that would be readable by malware with a custom cpio extractor.
Re:The cpio trailer problem (2018) by philsnow on Sunday July 19, 2020 @02:05PM (#23891132)
I saw cpio archives in a .pkg file on mac as recently as last week so yeah very much still in use.