Skip to content

Commit

Permalink
Prevent SQL injections in the file manager search (see CVE-2019-11512)
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Apr 30, 2019
1 parent a3e46b9 commit 87d92f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@

## DEV

* Prevent SQL injections in the file manager search (see CVE-2019-11512).
* Correctly handle dates in the news bundle (see #436).
* Also show future news items if the "show all news items" option is selected (see #419).

Expand Down
6 changes: 2 additions & 4 deletions core-bundle/src/Resources/contao/drivers/DC_Folder.php
Expand Up @@ -2769,15 +2769,14 @@ protected function searchMenu()
// Store search value in the current session
if (\Input::post('FORM_SUBMIT') == 'tl_filters')
{
$strField = \Input::post('tl_field', true);
$strKeyword = ltrim(\Input::postRaw('tl_value'), '*');

// Make sure the regular expression is valid
if ($strKeyword != '')
if ($strKeyword)
{
try
{
$this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE " . $strField . " REGEXP ?")
$this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE name REGEXP ?")
->limit(1)
->execute($strKeyword);
}
Expand All @@ -2787,7 +2786,6 @@ protected function searchMenu()
}
}

$session['search'][$this->strTable]['field'] = $strField;
$session['search'][$this->strTable]['value'] = $strKeyword;

$objSessionBag->replace($session);
Expand Down

0 comments on commit 87d92f8

Please sign in to comment.