summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2018-06-19 00:43:10 +0000
committerafresh1 <afresh1@openbsd.org>2018-06-19 00:43:10 +0000
commit26f75d2d572a60c61c31a50e340e23ecfafc1c61 (patch)
tree3cff58c54c90e163738a603bd76e0cdb1e399177
parenteoip tunnels Ethernet, not IP (diff)
downloadwireguard-openbsd-26f75d2d572a60c61c31a50e340e23ecfafc1c61.tar.xz
wireguard-openbsd-26f75d2d572a60c61c31a50e340e23ecfafc1c61.zip
Avoid Archive::Tar directory traversal
Addresses CVE-2018-12015 From Silamael <silamael () coronamundi ! de> Original bug reports: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900834 https://rt.cpan.org/Public/Bug/Display.html?id=125523 Original commit with the fix: https://github.com/jib/archive-tar-new/commit/ae65651eab053fc6dc4590dbb863a268215c1fc5 OK bluhm@, they should already be committed! deraadt@
-rw-r--r--gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm
index 6a047a32d6c..d110bd7bd8f 100644
--- a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm
+++ b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm
@@ -845,6 +845,20 @@ sub _extract_file {
return;
}
+ ### If a file system already contains a block device with the same name as
+ ### the being extracted regular file, we would write the file's content
+ ### to the block device. So remove the existing file (block device) now.
+ ### If an archive contains multiple same-named entries, the last one
+ ### should replace the previous ones. So remove the old file now.
+ ### If the old entry is a symlink to a file outside of the CWD, the new
+ ### entry would create a file there. This is CVE-2018-12015
+ ### <https://rt.cpan.org/Ticket/Display.html?id=125523>.
+ if (-l $full || -e _) {
+ if (!unlink $full) {
+ $self->_error( qq[Could not remove old file '$full': $!] );
+ return;
+ }
+ }
if( length $entry->type && $entry->is_file ) {
my $fh = IO::File->new;
$fh->open( '>' . $full ) or (