Skip to content

Commit

Permalink
fix: [security] Fixed an RCE vulnerability with user controled entrie…
Browse files Browse the repository at this point in the history
…s being fed to file_exists

- phar protocol paths for php file instructions can lead to RCE via meta-data deserialization
- mitigated by the functionalities enabling this being only accessible to site admins

- Reported by Dawid Czarnecki
  • Loading branch information
iglocska committed Jun 16, 2019
1 parent 5d611c3 commit c42c5fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/Model/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -3076,6 +3076,9 @@ public function beforeHookBinExec($setting, $value)

public function testForBinExec($value)
{
if (substr($value, 0, 7) === "phar://") {
return 'Phar protocol not allowed.';
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
if ($value === '') {
return true;
Expand All @@ -3094,6 +3097,9 @@ public function testForBinExec($value)

public function testForWritableDir($value)
{
if (substr($value, 0, 7) === "phar://") {
return 'Phar protocol not allowed.';
}
if (!is_dir($value)) {
return 'Not a valid directory.';
}
Expand Down

0 comments on commit c42c5fe

Please sign in to comment.