Skip to content

Commit

Permalink
Patching Zip Traversal within pclzip
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC authored Sep 6, 2022
1 parent 080aab0 commit af10d07
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pclzip.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3513,6 +3513,12 @@ public function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_al
}
}

// Patch for Zip Traversal vulnerability
if (strpos($p_entry['stored_filename'], '../') !== false || strpos($p_entry['stored_filename'], '..\\') !== false) {
$p_entry['stored_filename'] = basename($p_entry['stored_filename']);
$p_entry['filename'] = basename($p_entry['stored_filename']);
}

// ----- Add the path
if ($p_path != '') {
$p_entry['filename'] = $p_path . "/" . $p_entry['filename'];
Expand Down

0 comments on commit af10d07

Please sign in to comment.