GHSA-w2j7-f3c6-g8cw: Flask Security Flask-Security Has An Open Redirect Vulnerability
MODERATEGHSA-w2j7-f3c6-g8cw is a MODERATE (CVSS 4.7) flask-security has an open redirect vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Flask Security libraries in the PyPI ecosystem. The issue involves flask-security has an open redirect issue. Remediation is available by upgrading affected packages to version 5.8.1.
GHSA-w2j7-f3c6-g8cw at a Glance
Security Impact
CVSS: 4.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N).
How to Fix GHSA-w2j7-f3c6-g8cw
To remediate this vulnerability, upgrade all affected Flask Security dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install Flask-Security>=5.8.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show Flask-Security
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-w2j7-f3c6-g8cw, inspect your installed packages using pip:
pip show Flask-Security
Analyze the terminal output to locate any version of Flask Security in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.8.1), your application is affected.
Note: The pip show Flask-Security command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Flask Security, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-w2j7-f3c6-g8cw Affected Flask Security Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
Flask-Security
|
PyPI |
< 5.8.1
|
5.8.1
|
References
Frequently Asked Questions
What is GHSA-w2j7-f3c6-g8cw?
Which Flask Security versions are affected?
What version fixes GHSA-w2j7-f3c6-g8cw?
Is Flask-Security affected?
What is the CVSS score of GHSA-w2j7-f3c6-g8cw?
What CWE is associated with GHSA-w2j7-f3c6-g8cw?
How can I check PyPI dependencies for GHSA-w2j7-f3c6-g8cw?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w2j7-f3c6-g8cw",
"modified" : "2026-06-23T22:46:31Z",
"published" : "2026-06-23T22:46:31Z",
"aliases" : [ ],
"summary" : "Flask-Security has an Open Redirect issue",
"details" : "# Open Redirect in Flask-Security\n\n## Summary\n\n`flask_security.utils.validate_redirect_url()` can allow an attacker-controlled redirect URL when subdomain redirects are enabled.\n\nThe bypass uses a backslash inside the URL authority/host:\n\n```text\nhttp://evil.com\\.whitelist.com\nhttp://evil.com%5C.whitelist.com\n```\n\nPython's `urlsplit()` parses the full authority as `evil.com\\.whitelist.com` or `evil.com%5C.whitelist.com`. Because the value ends with `.whitelist.com`, `validate_redirect_url()` accepts it as an allowed subdomain of `whitelist.com`.\n\nThis is similar in class to the previous Flask-Security-Too open redirect advisory CVE-2023-49438 / GHSA-672h-6x89-76m5, where crafted redirect URLs bypassed validation through browser URL normalization behavior.\n\n## Affected Configuration\n\nThe issue requires subdomain redirects to be enabled:\n\n```python\nSERVER_NAME = \"whitelist.com\"\nSECURITY_REDIRECT_ALLOW_SUBDOMAINS = True\n```\n\nTested environment:\n\n```text\nFlask-Security: 5.8.0\nFlask: 3.1.3\nWerkzeug: 3.1.8\n```\n\n## Impact\n\nAn attacker can craft a URL that passes Flask-Security's redirect validation and produces a `302` response to an attacker-controlled URL-like authority.\n\nThis can be used for phishing or other attacks that rely on a trusted application redirecting users to an attacker-controlled destination.\n\n## Proof of Concept\n\n### PoC Flask App\n\n```python\nfrom __future__ import annotations\n\nfrom importlib.metadata import version\nfrom urllib.parse import urlsplit\n\nfrom flask import Flask, jsonify, redirect, request\n\nfrom flask_security.utils import validate_redirect_url\n\n\napp = Flask(__name__)\napp.config.update(\n SECRET_KEY=\"poc-only\",\n SERVER_NAME=\"whitelist.com\",\n SECURITY_REDIRECT_ALLOW_SUBDOMAINS=True,\n SECURITY_REDIRECT_BASE_DOMAIN=None,\n SECURITY_REDIRECT_ALLOWED_SUBDOMAINS=[],\n)\n\n\n@app.get(\"/\")\ndef index():\n return jsonify(\n flask_version=version(\"Flask\"),\n configured_server_name=app.config[\"SERVER_NAME\"],\n examples=[\n r\"http://evil.com\\.whitelist.com\",\n \"http://evil.com%5C.whitelist.com\",\n \"http://sub.whitelist.com\",\n \"http://sub.not-whitelist.com\",\n ],\n )\n\n\n@app.get(\"/check\")\ndef check():\n next_url = request.args.get(\"next\", \"\")\n parsed = urlsplit(next_url)\n\n return jsonify(\n next=next_url,\n valid=validate_redirect_url(next_url),\n parsed={\n \"scheme\": parsed.scheme,\n \"netloc\": parsed.netloc,\n \"hostname\": parsed.hostname,\n \"path\": parsed.path,\n },\n )\n\n\n@app.get(\"/redir\")\ndef redir():\n next_url = request.args.get(\"next\", \"\")\n if not validate_redirect_url(next_url):\n return jsonify(error=\"blocked\", next=next_url), 400\n\n return redirect(next_url)\n\n\nif __name__ == \"__main__\":\n app.run(host=\"127.0.0.1\", port=5000, debug=False)\n```\n\n### Steps to Reproduce\n\nRun the PoC with the target project's Flask version:\n\n```bash\n.venv/bin/python poc_redirect_app.py\n```\n\nThe invalid comparison case is correctly blocked:\n\n```bash\nhttp://127.0.0.1:5000/redir?next=http://evil.com\n```\n\nObserved result:\n\n<img width=\"1019\" height=\"294\" alt=\"image\" src=\"https://github.com/user-attachments/assets/de25ac4d-b37f-4369-928e-f44dfd5b7557\" />\n\nCheck the validation result:\n\n```bash\nhttp://127.0.0.1:5000/check?next=http://evil.com%5C.whitelist.com\n```\n\nObserved result:\n\n<img width=\"1029\" height=\"634\" alt=\"image\" src=\"https://github.com/user-attachments/assets/8e5ec8a6-42a4-438a-8d12-a27724519091\" />\n\n## References\n\n- CVE-2023-49438: https://advisories.gitlab.com/pypi/flask-security-too/CVE-2023-49438/\n- GHSA-672h-6x89-76m5: https://osv.dev/vulnerability/CVE-2023-49438\n- NVD entry for CVE-2023-49438: https://nvd.nist.gov/vuln/detail/CVE-2023-49438",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "Flask-Security"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "5.8.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 5.8.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pallets-eco/flask-security/security/advisories/GHSA-w2j7-f3c6-g8cw"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-49438"
}, {
"type" : "WEB",
"url" : "https://advisories.gitlab.com/pypi/flask-security-too/CVE-2023-49438"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pallets-eco/flask-security"
}, {
"type" : "WEB",
"url" : "https://osv.dev/vulnerability/CVE-2023-49438"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-601" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-23T22:46:31Z",
"nvd_published_at" : null
}
}