[SECURITY] Limit the search results per page 33/46833/2
authorBenni Mack <benni@typo3.org>
Tue, 23 Feb 2016 10:45:20 +0000 (11:45 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 23 Feb 2016 10:45:55 +0000 (11:45 +0100)
Indexed Search allows to show up to 100.000
entries per page by configuring the paging
entry via a GET/POST variable, leading to a
possible DoS attack.

The max limit is set to 100 entries per page,
as a reasonable limit for the website search
results.

Resolves: #73458
Releases: master, 7.6, 6.2
Security-Commit: 67574fa84acd54260cd824b759e5cd2e6d23e0d5
Security-Bulletins: TYPO3-CORE-SA-2016-005, 006, 007, 008
Change-Id: Ibec1ed2e35ebdca9f443b76ad59871622b230548
Reviewed-on: https://review.typo3.org/46833
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/indexed_search/Classes/Controller/SearchFormController.php

index cff454f..7bf5f37 100644 (file)
@@ -179,7 +179,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
         if ($searchData['_freeIndexUid'] !== '' && $searchData['_freeIndexUid'] !== '_') {
             $searchData['freeIndexUid'] = $searchData['_freeIndexUid'];
         }
-        $searchData['numberOfResults'] = MathUtility::forceIntegerInRange($searchData['numberOfResults'], 1, 100000, $this->defaultResultNumber);
+        $searchData['numberOfResults'] = MathUtility::forceIntegerInRange($searchData['numberOfResults'], 1, 100, $this->defaultResultNumber);
         // This gets the search-words into the $searchWordArray
         $this->sword = $searchData['sword'];
         // Add previous search words to current
index 22a853c..6f7a4bd 100755 (executable)
@@ -231,7 +231,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
         if ($this->piVars['sword_prev_include'] && $this->piVars['sword_prev']) {
             $this->piVars['sword'] = trim($this->piVars['sword_prev']) . ' ' . $this->piVars['sword'];
         }
-        $this->piVars['results'] = MathUtility::forceIntegerInRange($this->piVars['results'], 1, 100000, $this->defaultResultNumber);
+        $this->piVars['results'] = MathUtility::forceIntegerInRange($this->piVars['results'], 1, 100, $this->defaultResultNumber);
         // Make sure that some cropping and markup constants used later are defined
         $this->loadSettings();