Skip to content

Commit

Permalink
Issue GHSA-92fr-7h4f-22pp
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMer0n committed Aug 22, 2023
1 parent abf94d0 commit 9aa8de4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion e107_admin/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ function AddPage()
}

// Make Admin.
if(getperms('4|U0')) // Quick Add User access should not be allowed to create new users with escalated perms.
if(getperms('4|U0')) // Quick Add User access should not be allowed to create new users with escalated perms.
{
$text .= "
<tr>
Expand Down
4 changes: 4 additions & 0 deletions e107_handlers/file_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,10 @@ public function isAllowedType($file, $targetFile = '')
$tmp = parse_url($targetFile);
$targetFile = $tmp['path'];
$remote = true;
if(!empty($tmp['host']) && ($tmp['host'] === 'localhost' || $tmp['host'] === '127.0.0.1'))
{
return false;
}
}

$ext = pathinfo($targetFile, PATHINFO_EXTENSION);
Expand Down
7 changes: 6 additions & 1 deletion e107_tests/tests/unit/e_fileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,14 @@ public function testIsAllowedType()
array('path'=> e_SYSTEM."filetypes.xml", 'expected' => true), // permitted
array('path'=> e_PLUGIN."gallery/images/butterfly.jpg", 'expected' => true), // permitted
array('path'=> 'http://127.0.0.1:8070/file.svg', 'expected'=>false), // not permitted
array('path'=> 'http://127.0.0.1:8070/butterfly.jpg', 'expected'=>true), // permitted
array('path'=> 'http://127.0.0.1:8070/butterfly.jpg', 'expected'=>false), // not permitted
array('path'=> 'http://localhost:8070/file.svg', 'expected'=>false), // not permitted
array('path'=> 'http://localhost:8070/butterfly.jpg', 'expected'=>false), // not permitted
array('path'=> 'http://domain.com:8070/file.svg', 'expected'=>false), // suspicious
array('path'=> 'http://domain.com:8070/butterfly.jpg', 'expected'=>true), // permitted
array('path'=> 'http://127.0.0.1/bla.php', 'expected'=>false), // suspicious
array('path'=> 'http://127.0.0.1/bla.php?butterfly.jpg', 'expected'=>false), // suspicious

);

foreach($isAllowedTest as $file)
Expand Down

0 comments on commit 9aa8de4

Please sign in to comment.