Fix for user reported CVE path-based open redirect

This commit is contained in:
Andy Miller 2020-03-18 17:32:46 -06:00
parent 6f2be2a2d2
commit 2eae104c7a
No known key found for this signature in database
GPG Key ID: 06C5EE41E242681B
2 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,7 @@
* Moved `Parsedown` 1.6 and `ParsedownExtra` 0.7 into `Grav\Framework\Parsedown` to allow fixes
1. [](#bugfix)
* Fixed PHP 7.4 issue in ParsedownExtra [#2832](https://github.com/getgrav/grav/issues/2832)
* Fix for [user reported](https://twitter.com/OriginalSicksec) CVE path-based open redirect
# v1.6.22
## 03/05/2020

View File

@ -316,7 +316,10 @@ class Grav extends Container
/** @var Uri $uri */
$uri = $this['uri'];
//Check for code in route
// Clean route for redirect
$route = preg_replace("#^\/[\\\/]+\/#", '/', $route);
// Check for code in route
$regex = '/.*(\[(30[1-7])\])$/';
preg_match($regex, $route, $matches);
if ($matches) {