The vulnerability is an open redirect in the WebOb library, identified as CVE-2024-42353. It's a bypass of a previous fix for a similar issue. The root cause lies in the Response._make_location_absolute method, which is supposed to normalize the Location header for redirects.
In vulnerable versions, this function does not account for a change in behavior in Python 3.10 and newer, where urllib.parse.urlsplit (used internally by urllib.parse.urljoin) strips certain ASCII whitespace characters like tabs, carriage returns, and newlines from the URL before parsing.
An attacker can exploit this by crafting a Location header value such as /\t/attacker.com. The vulnerable _make_location_absolute function fails to sanitize the tab character. When this value is passed to urljoin, the tab is stripped, transforming the path into //attacker.com. urljoin then interprets this as a protocol-relative URL, causing the redirect to go to the attacker-controlled domain instead of the intended one.
The patch in commit 2b9fbedafb31180c910cf8526e9ea72b4603d0bc fixes this by explicitly stripping these whitespace characters from the location value at the beginning of the _make_location_absolute function, before any other processing. This ensures that such bypass attempts are neutralized regardless of the underlying Python version's urljoin behavior.
The Response.__call__ method is also identified as a key function because it is the one that triggers the call to the vulnerable _make_location_absolute method when handling a redirect response, making it an essential part of the vulnerable execution path.