CVE-2023-49438: Flask Security Too Open Redirect Vulnerability Vulnerability

MODERATE
Advisory Identifier: GHSA-672h-6x89-76m5
CVSS 6.1
CWE-601
Published
Advisory Summary

CVE-2023-49438 is a MODERATE (CVSS 6.1) open redirect vulnerability vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Flask Security Too libraries in the PyPI ecosystem. The issue involves open redirect vulnerability in flask-security-too. Remediation is available by upgrading affected packages to version 5.3.3.

CVE-2023-49438 at a Glance

CVE Identifier CVE-2023-49438
GHSA Identifier GHSA-672h-6x89-76m5
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product Flask Security Too
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.1

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:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2023-49438

To remediate this vulnerability, upgrade all affected Flask Security Too dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Flask-Security-Too fixed: 5.3.3
pip install Flask-Security-Too>=5.3.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show Flask-Security-Too

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-49438, inspect your installed packages using pip:

pip show Flask-Security-Too

Analyze the terminal output to locate any version of Flask Security Too in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.3.3), your application is affected.

Note: The pip show Flask-Security-Too 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 Too, 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

An open redirect vulnerability in the python package Flask-Security-Too <=5.3.2 allows attackers to redirect unsuspecting users to malicious sites via a crafted URL by abusing the ?next parameter on the /login and /register routes. Flask-Security-Too contains logic to validate that the URL specified within the next parameter is either relative or has the same network location as the requesting URL in an attempt to prevent open redirections. Previously known examples that bypassed the validation logic such as `https://example/login?next=\\\\\\github.com` were patched in version 4.1.0 However, examples such as `https://example/login?next=/\\github.com` and `https://example/login?next=\\/github.com` were discovered due to how web browsers normalize slashes in URLs, which makes the package vulnerable through version <=5.3.2 Additionally, with Werkzeug >=2.1.0 the autocorrect_location_header configuration was changed to False - which means that location headers in redirects are relative by default. Thus, this issue may impact applications that were previously not impacted, if they are using Werkzeug >=2.1.0 as the WSGI layer.

CVE-2023-49438 Affected Flask Security Too Versions

1 component(s)
Fixed Versions:
5.3.3
Product / Package Ecosystem Affected Versions Fixed Version
Flask-Security-Too
PyPI
< 5.3.3
5.3.3

References

Frequently Asked Questions

What is CVE-2023-49438?
CVE-2023-49438 is a security vulnerability in Flask Security Too involving Open redirect vulnerability in Flask-Security-Too under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Flask Security Too versions are affected?
Affected versions include releases prior to 5.3.3 across affected packages: Flask-Security-Too.
What version fixes CVE-2023-49438?
Upgrading to 5.3.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Flask-Security-Too affected?
Yes, Flask-Security-Too is affected in releases prior to 5.3.3. Upgrade your dependency to 5.3.3 or later.
What is the CVSS score of CVE-2023-49438?
CVE-2023-49438 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2023-49438?
CVE-2023-49438 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check PyPI dependencies for CVE-2023-49438?
Run the dependency tree command: 'pip show Flask-Security-Too'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-672h-6x89-76m5",
  "modified" : "2024-09-20T17:51:44Z",
  "published" : "2023-12-27T00:30:25Z",
  "aliases" : [ "CVE-2023-49438" ],
  "summary" : "Open redirect vulnerability in Flask-Security-Too",
  "details" : "An open redirect vulnerability in the python package Flask-Security-Too <=5.3.2 allows attackers to redirect unsuspecting users to malicious sites via a crafted URL by abusing the ?next parameter on the /login and /register routes.\n\nFlask-Security-Too contains logic to validate that the URL specified within the next parameter is either relative or has the same network location as the requesting URL in an attempt to prevent open redirections. Previously known examples that bypassed the validation logic such as `https://example/login?next=\\\\\\\\\\\\github.com` were patched in version 4.1.0\n\nHowever, examples such as `https://example/login?next=/\\\\github.com` and `https://example/login?next=\\\\/github.com` were discovered due to how web browsers normalize slashes in URLs, which makes the package vulnerable through version <=5.3.2\n\nAdditionally, with Werkzeug >=2.1.0 the autocorrect_location_header configuration was changed to False - which means that location headers in redirects are relative by default. Thus, this issue may impact applications that were previously not impacted, if they are using Werkzeug >=2.1.0 as the WSGI layer.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Flask-Security-Too"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.3.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-49438"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Flask-Middleware/flask-security/commit/8b5abc4d4db9926a3d76b34b8b03255effb5e712"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Flask-Middleware/flask-security"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/brandon-t-elliott/CVE-2023-49438"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/flask-security-too/PYSEC-2023-248.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6HCYH377TPUMUHELPI36PDS2ZM4VFIXM"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-01-08T21:47:12Z",
    "nvd_published_at" : "2023-12-26T22:15:13Z"
  }
}