From bb3d39f728ad3a115919e717ec448c37e5d27cd3 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 23 Apr 2013 00:26:40 +0300 Subject: [PATCH] Disallow URLs containing a @ --- lib/base.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/base.php b/lib/base.php index 3006aa852cc..6626da683c7 100644 --- a/lib/base.php +++ b/lib/base.php @@ -627,8 +627,13 @@ 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'])); - header('Location: ' . $location); - return; + + // 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') { -- 2.39.5