Merge pull request #3080 from owncloud/validate_redirect_mast

Disallow URLs containing a @
This commit is contained in:
Bernhard Posselt 2013-04-23 12:21:39 -07:00
commit 9dde43db57
1 changed files with 7 additions and 2 deletions

View File

@ -631,9 +631,14 @@ class OC {
// Handle redirect URL for logged in users
if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
$location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
// Deny the redirect if the URL contains a @
// This prevents unvalidated redirects like ?redirect_url=:user@domain.com
if (strpos($location, '@') === FALSE) {
header('Location: ' . $location);
return;
}
}
// Handle WebDAV
if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') {
header('location: ' . OC_Helper::linkToRemote('webdav'));