From 9364f0d931883bb5f17f22c4003ee59256f9efb6 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Wed, 5 Jan 2011 23:31:50 +0100 Subject: Allow '..' segment in photo/album paths through file_proxy (as is not forbidden in other places like add album/item) and explitely look for /../ instead Note: directory path can't end in '.' forcibly so this shall be fine Fixes Ticket #1518 --- modules/gallery/controllers/file_proxy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/controllers/file_proxy.php') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 22854fbd..5ce9b458 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -45,7 +45,7 @@ class File_Proxy_Controller extends Controller { $file_uri = substr($request_uri, strlen($var_uri)); // Make sure that we don't leave the var dir - if (strpos($file_uri, "..") !== false) { + if (strpos($file_uri, "/../") !== false) { throw new Kohana_404_Exception(); } -- cgit v1.2.3 From 7f6d87166df138073d85dd5201de8b9d19bc6cd2 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Tue, 11 Jan 2011 23:16:05 +0100 Subject: Removed check as input value is compared against dataset of validated values, and request is only processed further in case of a match. => this is unnecessary --- modules/gallery/controllers/file_proxy.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'modules/gallery/controllers/file_proxy.php') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 5ce9b458..47e1e483 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -44,11 +44,6 @@ class File_Proxy_Controller extends Controller { $file_uri = substr($request_uri, strlen($var_uri)); - // Make sure that we don't leave the var dir - if (strpos($file_uri, "/../") !== false) { - throw new Kohana_404_Exception(); - } - list ($type, $path) = explode("/", $file_uri, 2); if ($type != "resizes" && $type != "albums" && $type != "thumbs") { throw new Kohana_404_Exception(); -- cgit v1.2.3