Flask SecurityApplication · Flask Security Project

CVE-2021-32618

MEDIUM · 6.1 CVSS v3.1 Published 2021-05-17
Mitigation only
No fix yet — a mitigation exists. There is no fixed release. A documented workaround reduces exposure in the meantime.
See remediation →
68/100
Remediation priority · Elevated
Remotely reachable No privileges

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
The Python "Flask-Security-Too" package is used for adding security features to your Flask application. It is an is an independently maintained version of Flask-Security based on the 3.0.0 version of Flask-Security. All versions of Flask-Security-Too allow redirects after many successful views (e.g. /login) by honoring the ?next query param. There is code in FS to validate that the url specified in the next parameter is either relative OR has the same netloc (network location) as the requesting URL. This check utilizes Pythons urlsplit library. However many browsers are very lenient on the kind of URL they accept and 'fill in the blanks' when presented with a possibly incomplete URL. As a concrete example - setting http://login?next=\\\github.com will pass FS's relative URL check however many browsers will gladly convert this to http://github.com. Thus an attacker could send such a link to an unwitting user, using a legitimate site and have it redirect to whatever site they want. This is considered a low severity due to the fact that if Werkzeug is used (which is very common with Flask applications) as the WSGI layer, it by default ALWAYS ensures that the Location header is absolute - thus making this attack vector mute. It is possible for application writers to modify this default behavior by setting the 'autocorrect_location_header=False`.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

Flask-Security-Too contains an open redirect vulnerability in its handling of the 'next' query parameter used for post-authentication redirects. The URL validation using Python's urlsplit library checks for relative URLs or same-netloc URLs, but fails to account for browser leniency in parsing incomplete URLs. An attacker can craft URLs like 'http://login?next=\\github.com' which pass the validation but are converted by browsers to 'http://github.com', enabling arbitrary redirects.

MitigationThis is low severity because Werkzeug (default Flask WSGI layer) forces absolute Location headers by default, neutralizing the attack. Ensure Werkzeug's default 'autocorrect_location_header' behavior is not modified, or implement stricter URL validation that rejects backslash-based URL components.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
Flask SecurityApplication
Affected:all versions

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Confirm Flask-Security-Too is installed
    Run 'pip show flask-security-too' or check your requirements.txt for the flask-security-too package
    Affected if The package is present in the environment
  2. Verify Werkzeug autocorrect_location_header setting
    Check your Flask application configuration for any explicit setting of 'Werkzeug' or middleware that modifies 'autocorrect_location_header'. Search your codebase for 'autocorrect_location_header' and review Flask/Werkzeug initialization code.
    Affected if The setting has been explicitly set to False, disabling Werkzeug's default protection
  3. Check for custom post-login redirect handlers
    Review your Flask-Security-Too configuration for 'SECURITY_POST_LOGIN_VIEW' or similar settings. Search for any custom 'after_login' or 'post_login' handlers that override default redirect behavior.
    Affected if Custom redirect handlers bypass Werkzeug's built-in protection for the 'next' parameter
  4. Inspect URL validation in any custom authentication handlers
    Search your application code for url validation logic that handles the 'next', 'next', or redirect parameters. Look for uses of urlsplit, urlparse, or similar URL parsing functions.
    Affected if Custom validation exists that may not properly reject backslash-based URLs like '\\github.com'

The environment is affected only if Flask-Security-Too is in use AND Werkzeug's autocorrect_location_header has been explicitly disabled, OR custom redirect handlers bypass Werkzeug's protection for the 'next' parameter.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

From vendor data
Mitigation available No clean upgrade yet — mitigate in the meantime
Mitigation

This is low severity because Werkzeug (default Flask WSGI layer) forces absolute Location headers by default, neutralizing the attack. Ensure Werkzeug's default 'autocorrect_location_header' behavior is not modified, or implement stricter URL validation that rejects backslash-based URL components.

Fix this in Flask Security Scoped from the published advisory
  • Consultation2.0 h
  • Implementation3.0 h
  • Testing2.0 h
  • Review / QA1.0 h
8.0 hours of engineering $1,420
Get help mitigating

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,272.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2021-32618 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2021-32618 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data