Skip to content

Commit

Permalink
Merge pull request #22 from Ayesh/malicious-path-check-improvements
Browse files Browse the repository at this point in the history
Improve path traversal detection for forward and backward slashes
  • Loading branch information
mrook authored Jan 15, 2019
2 parents ff716ca + 86f8afb commit d1d112c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Archive/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -1770,11 +1770,8 @@ private function _maliciousFilename($file)
if (strpos($file, 'phar://') === 0) {
return true;
}
if (strpos($file, DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) !== false) {
return true;
}
if (strpos($file, '..' . DIRECTORY_SEPARATOR) === 0) {
return true;
if (strpos($file, '../') !== false || strpos($file, '..\\') !== false) {
return true;
}
return false;
}
Expand Down

0 comments on commit d1d112c

Please sign in to comment.