diff options
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-tornado/CVE-2023-28370.patch')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-tornado/CVE-2023-28370.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-tornado/CVE-2023-28370.patch b/meta-python/recipes-devtools/python/python3-tornado/CVE-2023-28370.patch new file mode 100644 index 0000000000..b8b6029753 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-tornado/CVE-2023-28370.patch | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | From c5674de64189ac407e6ace51bed08899f267ae44 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ben Darnell <ben@bendarnell.com> | ||
| 3 | Date: Sat, 13 May 2023 20:58:52 -0400 | ||
| 4 | Subject: [PATCH] web: Fix an open redirect in StaticFileHandler | ||
| 5 | |||
| 6 | Under some configurations the default_filename redirect could be exploited | ||
| 7 | to redirect to an attacker-controlled site. This change refuses to redirect | ||
| 8 | to URLs that could be misinterpreted. | ||
| 9 | |||
| 10 | A test case for the specific vulnerable configuration will follow after the | ||
| 11 | patch has been available. | ||
| 12 | |||
| 13 | CVE: CVE-2023-28370 | ||
| 14 | Upstream-Status: Backport [https://github.com/tornadoweb/tornado/commit/32ad07c54e607839273b4e1819c347f5c8976b2f] | ||
| 15 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 16 | --- | ||
| 17 | tornado/web.py | 9 +++++++++ | ||
| 18 | 1 file changed, 9 insertions(+) | ||
| 19 | |||
| 20 | diff --git a/tornado/web.py b/tornado/web.py | ||
| 21 | index 546e6ec..8410880 100644 | ||
| 22 | --- a/tornado/web.py | ||
| 23 | +++ b/tornado/web.py | ||
| 24 | @@ -2771,6 +2771,15 @@ class StaticFileHandler(RequestHandler): | ||
| 25 | # but there is some prefix to the path that was already | ||
| 26 | # trimmed by the routing | ||
| 27 | if not self.request.path.endswith("/"): | ||
| 28 | + if self.request.path.startswith("//"): | ||
| 29 | + # A redirect with two initial slashes is a "protocol-relative" URL. | ||
| 30 | + # This means the next path segment is treated as a hostname instead | ||
| 31 | + # of a part of the path, making this effectively an open redirect. | ||
| 32 | + # Reject paths starting with two slashes to prevent this. | ||
| 33 | + # This is only reachable under certain configurations. | ||
| 34 | + raise HTTPError( | ||
| 35 | + 403, "cannot redirect path with two initial slashes" | ||
| 36 | + ) | ||
| 37 | self.redirect(self.request.path + "/", permanent=True) | ||
| 38 | return None | ||
| 39 | absolute_path = os.path.join(absolute_path, self.default_filename) | ||
