summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Brewer <fumanchu@aminus.org>2007-10-27 17:23:47 +0000
committerRobert Brewer <fumanchu@aminus.org>2007-10-27 17:23:47 +0000
commitd5941984d1454e9d128b5fcb9726c06cbcc605de (patch)
treef45e250f19b9b6188b1aa86e08024b596c037fe0
parent8f88043e2e5643f43f16a345430b372f340632c6 (diff)
downloadcherrypy-d5941984d1454e9d128b5fcb9726c06cbcc605de.tar.gz
2.x fix for #744 (Malicious cookies may allow access to files outside the session directory).
-rw-r--r--cherrypy/filters/sessionfilter.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/cherrypy/filters/sessionfilter.py b/cherrypy/filters/sessionfilter.py
index 2391c321..b8812ecf 100644
--- a/cherrypy/filters/sessionfilter.py
+++ b/cherrypy/filters/sessionfilter.py
@@ -347,6 +347,8 @@ class FileStorage:
raise SessionStoragePathNotConfiguredError()
fileName = self.SESSION_PREFIX + id
file_path = os.path.join(storage_path, fileName)
+ if not os.path.normpath(file_path).startswith(storage_path):
+ raise cherrypy.HTTPError(400, "Invalid session id in cookie.")
return file_path
def _lock_file(self, path):