Skip to content

Commit

Permalink
File uploads: Hard-code common PHP file extensions exclusion
Browse files Browse the repository at this point in the history
--HG--
branch : 3.16
  • Loading branch information
adia committed May 17, 2024
1 parent 6b1a327 commit 4449cf8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/lib/fileUploadLib.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ function isWhitelistAllowed($filename) {

$whitelist = explode(',', preg_replace('/\s+/', '', $wh)); // strip any whitespace

// Hard-code common PHP file extensions exclusion
if (preg_match('/\.(php.?|phtml|phar)$/i', $filename)) {
return false;
}

if (in_array('*', $whitelist)) {
return true;
}
Expand Down

0 comments on commit 4449cf8

Please sign in to comment.