Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"nikic/php-parser": "^4.2",
"patchwork/jsqueeze": "^2.0",
"patchwork/utf8": "1.3.1",
"pear/archive_tar": "1.4.12",
"pear/archive_tar": "1.4.14",
"pear/pear-core-minimal": "^v1.10",
"phpseclib/phpseclib": "2.0.31",
"php-opencloud/openstack": "3.0.7",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2585,17 +2585,17 @@
},
{
"name": "pear/archive_tar",
"version": "1.4.12",
"version_normalized": "1.4.12.0",
"version": "1.4.14",
"version_normalized": "1.4.14.0",
"source": {
"type": "git",
"url": "https://github.com/pear/Archive_Tar.git",
"reference": "19bb8e95490d3e3ad92fcac95500ca80bdcc7495"
"reference": "4d761c5334c790e45ef3245f0864b8955c562caa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Archive_Tar/zipball/19bb8e95490d3e3ad92fcac95500ca80bdcc7495",
"reference": "19bb8e95490d3e3ad92fcac95500ca80bdcc7495",
"url": "https://api.github.com/repos/pear/Archive_Tar/zipball/4d761c5334c790e45ef3245f0864b8955c562caa",
"reference": "4d761c5334c790e45ef3245f0864b8955c562caa",
"shasum": ""
},
"require": {
Expand All @@ -2610,7 +2610,7 @@
"ext-xz": "Lzma2 compression support.",
"ext-zlib": "Gzip compression support."
},
"time": "2021-01-18T19:32:54+00:00",
"time": "2021-07-20T13:53:39+00:00",
"type": "library",
"extra": {
"branch-alias": {
Expand Down Expand Up @@ -2650,6 +2650,10 @@
"archive",
"tar"
],
"support": {
"issues": "http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Archive_Tar",
"source": "https://github.com/pear/Archive_Tar"
},
"funding": [
{
"url": "https://github.com/mrook",
Expand Down
10 changes: 5 additions & 5 deletions composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
'reference' => '39a30ba9f1e3c2cc43623c253add19deb348c180',
'reference' => '3ac5d83e6c24666956d504286dfe2c389c4dadc8',
'name' => 'nextcloud/3rdparty',
'dev' => false,
),
Expand Down Expand Up @@ -322,7 +322,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
'reference' => '39a30ba9f1e3c2cc43623c253add19deb348c180',
'reference' => '3ac5d83e6c24666956d504286dfe2c389c4dadc8',
'dev_requirement' => false,
),
'nextcloud/lognormalizer' => array(
Expand Down Expand Up @@ -371,12 +371,12 @@
'dev_requirement' => false,
),
'pear/archive_tar' => array(
'pretty_version' => '1.4.12',
'version' => '1.4.12.0',
'pretty_version' => '1.4.14',
'version' => '1.4.14.0',
'type' => 'library',
'install_path' => __DIR__ . '/../pear/archive_tar',
'aliases' => array(),
'reference' => '19bb8e95490d3e3ad92fcac95500ca80bdcc7495',
'reference' => '4d761c5334c790e45ef3245f0864b8955c562caa',
'dev_requirement' => false,
),
'pear/console_getopt' => array(
Expand Down
44 changes: 35 additions & 9 deletions pear/archive_tar/Archive/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function __destruct()
{
$this->_close();
// ----- Look for a local copy to delete
if ($this->_temp_tarname != '') {
if ($this->_temp_tarname != '' && (bool) preg_match('/^tar[[:alnum:]]*\.tmp$/', $this->_temp_tarname)) {
@unlink($this->_temp_tarname);
}
}
Expand Down Expand Up @@ -2124,21 +2124,47 @@ public function _extractList(
}
}
} elseif ($v_header['typeflag'] == "2") {
if (strpos(realpath(dirname($v_header['link'])), realpath($p_path)) !== 0) {
$this->_error(
'Out-of-path file extraction {'
. $v_header['filename'] . ' --> ' .
$v_header['link'] . '}'
);
return false;
}
if (!$p_symlinks) {
$this->_warning('Symbolic links are not allowed. '
. 'Unable to extract {'
. $v_header['filename'] . '}'
);
return false;
}
$absolute_link = FALSE;
$link_depth = 0;
if (strpos($v_header['link'], "/") === 0 || strpos($v_header['link'], ':') !== FALSE) {
$absolute_link = TRUE;
}
else {
$s_filename = preg_replace('@^' . preg_quote($p_path) . '@', "", $v_header['filename']);
$s_linkname = str_replace('\\', '/', $v_header['link']);
foreach (explode("/", $s_filename) as $dir) {
if ($dir === "..") {
$link_depth--;
} elseif ($dir !== "" && $dir !== "." ) {
$link_depth++;
}
}
foreach (explode("/", $s_linkname) as $dir){
if ($link_depth <= 0) {
break;
}
if ($dir === "..") {
$link_depth--;
} elseif ($dir !== "" && $dir !== ".") {
$link_depth++;
}
}
}
if ($absolute_link || $link_depth <= 0) {
$this->_error(
'Out-of-path file extraction {'
. $v_header['filename'] . ' --> ' .
$v_header['link'] . '}'
);
return false;
}
if (@file_exists($v_header['filename'])) {
@unlink($v_header['filename']);
}
Expand Down
2 changes: 1 addition & 1 deletion pear/archive_tar/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Archive_Tar
==========

[![Build Status](https://secure.travis-ci.org/pear/Archive_Tar.png?branch=master)](https://travis-ci.org/pear/Archive_Tar)
![.github/workflows/build.yml](https://github.com/pear/Archive_Tar/workflows/.github/workflows/build.yml/badge.svg)

This package provides handling of tar files in PHP.
It supports creating, listing, extracting and adding to tar files.
Expand Down
38 changes: 34 additions & 4 deletions pear/archive_tar/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Also Lzma2 compressed archives are supported with xz extension.</description>
<email>[email protected]</email>
<active>no</active>
</helper>
<date>2021-01-18</date>
<time>19:29:56</time>
<date>2021-07-20</date>
<time>18:00:00</time>
<version>
<release>1.4.12</release>
<release>1.4.14</release>
<api>1.4.0</api>
</version>
<stability>
Expand All @@ -44,7 +44,7 @@ Also Lzma2 compressed archives are supported with xz extension.</description>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>
* Fix Bug #27008: Symlink out-of-path write vulnerability (CVE-2020-36193) [mrook]
* Properly fix symbolic link path traversal (CVE-2021-32610)
</notes>
<contents>
<dir name="/">
Expand Down Expand Up @@ -74,6 +74,36 @@ Also Lzma2 compressed archives are supported with xz extension.</description>
</dependencies>
<phprelease />
<changelog>
<release>
<version>
<release>1.4.13</release>
<api>1.4.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2021-02-16</date>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>
* Fix Bug #27010: Relative symlinks failing (out-of path file extraction) [mrook]
</notes>
</release>
<release>
<version>
<release>1.4.12</release>
<api>1.4.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2021-01-18</date>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>
* Fix Bug #27008: Symlink out-of-path write vulnerability (CVE-2020-36193) [mrook]
</notes>
</release>
<release>
<version>
<release>1.4.11</release>
Expand Down