ghsa-mg3v-6m49-jhp3
Vulnerability from github
5.1 (Medium) - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Impact
When WebOb normalizes the HTTP Location header to include the request hostname, it does so by parsing the URL that the user is to be redirected to with Python's urlparse, and joining it to the base URL. urlparse
however treats a //
at the start of a string as a URI without a scheme, and then treats the next part as the hostname. urljoin
will then use that hostname from the second part as the hostname replacing the original one from the request.
```
parse.urlparse("//example.com/test/path") ParseResult(scheme='', netloc='example.com', path='/test/path', params='', query='', fragment='') ```
WebOb uses urljoin
to take the request URI and joining the redirect location, so assuming the request URI is: https://example.org//example.com/some/path
, and the URL to redirect to (for example by adding a slash automatically) is //example.com/some/path/
that gets turned by urljoin
into:
```
parse.urljoin("https://example.org//attacker.com/some/path", "//attacker.com/some/path/") 'https://attacker.com/some/path/' ```
Which redirects from example.org
where we want the user to stay to attacker.com
Patches
This issue is patched in WebOb 1.8.8
Older versions of WebOb continue to be vulnerable to this issue, and should be avoided.
Workarounds
Any use of the Response
class that includes a location
can be rewritten to make sure to always pass a full URI that includes the hostname to redirect the user to.
Thanks
- Sara Gao
This issue was reported via the Pylons Project Security List
{ "affected": [ { "database_specific": { "last_known_affected_version_range": "\u003c= 1.8.7" }, "package": { "ecosystem": "PyPI", "name": "webob" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "1.8.8" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2024-42353" ], "database_specific": { "cwe_ids": [ "CWE-601" ], "github_reviewed": true, "github_reviewed_at": "2024-08-14T17:48:06Z", "nvd_published_at": "2024-08-14T21:15:17Z", "severity": "MODERATE" }, "details": "### Impact\n\nWhen WebOb normalizes the HTTP Location header to include the request hostname, it does so by parsing the URL that the user is to be redirected to with Python\u0027s urlparse, and joining it to the base URL. `urlparse` however treats a `//` at the start of a string as a URI without a scheme, and then treats the next part as the hostname. `urljoin` will then use that hostname from the second part as the hostname replacing the original one from the request.\n\n```\n\u003e\u003e\u003e parse.urlparse(\"//example.com/test/path\")\nParseResult(scheme=\u0027\u0027, netloc=\u0027example.com\u0027, path=\u0027/test/path\u0027, params=\u0027\u0027, query=\u0027\u0027, fragment=\u0027\u0027)\n```\n\nWebOb uses `urljoin` to take the request URI and joining the redirect location, so assuming the request URI is: `https://example.org//example.com/some/path`, and the URL to redirect to (for example by adding a slash automatically) is `//example.com/some/path/` that gets turned by `urljoin` into:\n\n```\n\u003e\u003e\u003e parse.urljoin(\"https://example.org//attacker.com/some/path\", \"//attacker.com/some/path/\")\n\u0027https://attacker.com/some/path/\u0027\n```\n\nWhich redirects from `example.org` where we want the user to stay to `attacker.com`\n\n\n### Patches\n\nThis issue is patched in WebOb 1.8.8\n\nOlder versions of WebOb continue to be vulnerable to this issue, and should be avoided.\n\n### Workarounds\n\nAny use of the `Response` class that includes a `location` can be rewritten to make sure to always pass a full URI that includes the hostname to redirect the user to.\n\n### Thanks\n\n- Sara Gao\n\nThis issue was reported via the [Pylons Project Security List](mailto:pylons-project-security@googlegroups.com)\n", "id": "GHSA-mg3v-6m49-jhp3", "modified": "2024-08-14T22:17:04Z", "published": "2024-08-14T17:48:06Z", "references": [ { "type": "WEB", "url": "https://github.com/Pylons/webob/security/advisories/GHSA-mg3v-6m49-jhp3" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-42353" }, { "type": "WEB", "url": "https://github.com/Pylons/webob/commit/f689bcf4f0a1f64f1735b1d5069aef5be6974b5b" }, { "type": "PACKAGE", "url": "https://github.com/Pylons/webob" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "type": "CVSS_V3" }, { "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N", "type": "CVSS_V4" } ], "summary": "WebOb\u0027s location header normalization during redirect leads to open redirect" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.