so, can we do something about lesspipe? (+ a cpio bug to back up the argument)
There have been some low-key discussions about this in the past, but...
In short, many Linux distributions ship with the 'less' command
automagically interfaced to 'lesspipe'-type scripts, usually invoked
via LESSOPEN. This is certainly the case for CentOS and Ubuntu.
Unfortunately, many of these scripts appear to call a rather large
number of third-party tools that likely have not been designed with
malicious inputs in mind. On CentOS, lesspipe appears to include
things such as groff + troff + grotty, man, and cpio. On Ubuntu,
there's isoinfo (?!), ar from binutils, and so on. Ancient and obscure
compression utilities and doc converters crop up, too.
Even grabbing something as seemingly innocuous as cpio, a short spin
with afl-fuzz (or, probably, anything else) will immediately yield
It's a file with declared block length of 0xffffffff. That gets us
here, with the value populated to c_filesize (copyin.c, list_file()):
link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
link_name[file_hdr->c_filesize] = '\0';
...where we end up allocating a zero-byte buffer and then promptly
writing out of bounds (just under the buffer on 32-bit systems or
somewhere above it on 64-bit).
While it's a single bug in cpio, I have no doubt that many of the