PyPI: webob
CVE-2024-42353
Safety vulnerability ID: SFTY-20240814-35912
Safety legacy ID: pyup.io-72631
The WebOb affected versions have a critical security vulnerability related to improper handling of the HTTP Location header during URL redirection. The issue arises when WebOb normalizes the Location header by combining the request's hostname with the destination URL using Python's `urlparse` and `urljoin` functions. If the destination URL begins with "//", `urlparse` interprets it as a URI without a scheme, using the following string as the hostname. Consequently, `urljoin` replaces the original request hostname with this new hostname, potentially redirecting users to a malicious site. This vulnerability could allow attackers to craft URLs that redirect users from trusted domains to malicious sites, posing significant security risks. The WebOb update ensures that such scenarios are handled correctly, preventing unintended redirects and securing the application against this attack.
Overview
WebOb's location header normalization during redirect leads to open redirect
Advisory
The WebOb affected versions have a critical security vulnerability related to improper handling of the HTTP Location header during URL redirection. The issue arises when WebOb normalizes the Location header by combining the request's hostname with the destination URL using Python's `urlparse` and `urljoin` functions. If the destination URL begins with "//", `urlparse` interprets it as a URI without a scheme, using the following string as the hostname. Consequently, `urljoin` replaces the original request hostname with this new hostname, potentially redirecting users to a malicious site. This vulnerability could allow attackers to craft URLs that redirect users from trusted domains to malicious sites, posing significant security risks. The WebOb update ensures that such scenarios are handled correctly, preventing unintended redirects and securing the application against this attack.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20240814-35912/CVE-2024-42353
- https://github.com/Pylons/webob/security/advisories/GHSA-mg3v-6m49-jhp3
- https://github.com/Pylons/webob/commit/f689bcf4f0a1f64f1735b1d5069aef5be6974b5b
- https://nvd.nist.gov/vuln/detail/CVE-2024-42353
- https://github.com/pypa/advisory-database/tree/main/vulns/webob/PYSEC-2024-188.yaml
- https://github.com/advisories/GHSA-mg3v-6m49-jhp3
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
