Skip to content

Commit

Permalink
Fix ACP Languages local file inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
dvz committed Jan 3, 2023
1 parent 1bfb4b2 commit 0195eda
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions admin/modules/config/languages.php
Expand Up @@ -181,6 +181,13 @@
{
// Validate input
$editlang = basename($mybb->input['lang']);

if(in_array($editlang, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}

$folder = MYBB_ROOT."inc/languages/".$editlang."/";

$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&amp;action=quick_edit&amp;lang=".htmlspecialchars_uni($editlang));
Expand Down Expand Up @@ -376,11 +383,26 @@
{
// Validate input
$editlang = basename($mybb->input['lang']);

if(in_array($editlang, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}

$folder = MYBB_ROOT."inc/languages/".$editlang."/";

$page->add_breadcrumb_item(preg_replace("<\?|\?>", "<span>?</span>", htmlspecialchars_uni($languages[$editlang])), "index.php?module=config-languages&amp;action=edit&amp;lang=".htmlspecialchars_uni($editlang));

$editwith = basename($mybb->get_input('editwith'));

if(in_array($editwith, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}


$editwithfolder = '';

if($editwith)
Expand Down Expand Up @@ -421,6 +443,13 @@
{
// Validate input
$file = basename($mybb->input['file']);

if(in_array($file, array('.', '..')))
{
flash_message($lang->error_folders_fail, 'error');
admin_redirect("index.php?module=config-languages");
}

if($mybb->get_input('inadmin') == 1)
{
$file = 'admin/'.$file;
Expand Down

0 comments on commit 0195eda

Please sign in to comment.