Cloudanix VulnDB

CVE-2021-23385

Medium · 6.1

CVSS

6.1

EPSS

1.2%

Published

Aug 2, 2022

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in how certain web applications handle logout and login redirects can let attackers send users to fake websites instead of the intended page.

Exploit Available
Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Low
Impact
Other
Component
Library
Class
Open Redirect
Remediation
No Fix Yet
Effort
Other
Patch risk
Other

What it actually does

Open redirect flaw allowing bypass of URL validation in get_post_logout_redirect and get_post_login_redirect via multiple backslashes when non-default WSGI servers or Werkzeug autocorrect_location_header=False is used.

Why it matters to the business

Attackers can redirect users to malicious sites, increasing risk of phishing or credential theft; low exploit probability but affects widely used components with available public exploits and long exposure window.

How an attack unfolds

An attacker crafts a request supplying multiple backslashes before an external domain in redirect parameters; when the application uses a non-Werkzeug WSGI server or disables location header correction, the malformed URL passes validation and the victim is sent to the attacker-controlled site.

How to fix it

Upgrade opensearch to commit 64d2aa341cf591dd20ab3966792e564a467fdcf7 and anomaly-detection to commit 88a3f2b85ce2bcf4ced144d42f5bf96111b82743; replace Flask-Security with a maintained fork or alternative; enforce strict allow-list validation on all redirect targets; set autocorrect_location_header=True when using Werkzeug.

How to confirm the fix worked

Confirm packages report the listed commit hashes; test redirect endpoints with multiple-backslash payloads and verify only allow-listed domains are accepted; review WSGI configuration for autocorrect_location_header setting.

Typical attack path

  1. Identify login or logout endpoints that invoke get_post_login_redirect or get_post_logout_redirect
  2. Append multiple backslashes followed by an external domain to the redirect parameter
  3. Deliver the crafted link to a victim or trigger via automated request
  4. Victim browser follows the redirect to the attacker site

How to detect it

Review web server and application logs for redirect responses containing multiple consecutive backslashes followed by external domains; inspect authentication flow logs for unusual redirect parameter values.

  • redirect=\\\\
  • get_post_login_redirect.*\\\\
  • get_post_logout_redirect.*\\\\

What your security team should do

  • Apply the listed upstream commits immediately given public exploit availability
  • Audit all redirect-handling code for similar validation bypass patterns
  • Add runtime allow-list enforcement for post-login and post-logout redirects
  • Monitor EPSS trend and re-evaluate if exploitation increases

The record

This affects all versions of package Flask-Security. When using the get_post_logout_redirect and get_post_login_redirect functions, it is possible to bypass URL validation and redirect a user to an arbitrary URL by providing multiple back slashes such as \\\evil.com/path. This vulnerability is only exploitable if an alternative WSGI server other than Werkzeug is used, or the default behaviour of Werkzeug is modified using 'autocorrect_location_header=False. **Note:** Flask-Security is not maintained anymore.

Affected packages

Ecosystem Package Introduced Fixed
PyPI flask-security 0 No fix
Debian:10 flask-security 0 1.7.5-2+deb10u1
Debian:11 flask-security 0 4.0.0-1+deb11u1
Debian:12 flask-security 0 5.0.2-1
Debian:13 flask-security 0 5.0.2-1
Debian:14 flask-security 0 5.0.2-1
Mageia:8 python-flask-security 0 3.0.0-1.1.mga8
SUSE:Linux Enterprise Module for Basesystem 15 SP3 python-Flask-Security-Too 0 3.4.2-150200.3.6.1
SUSE:Linux Enterprise Module for Basesystem 15 SP4 python-Flask-Security-Too 0 3.4.2-150200.3.6.1
Ubuntu:20.04:LTS flask-security 0 1.7.5-2ubuntu0.20.04.1
Ubuntu:22.04:LTS flask-security 0 4.0.0-1ubuntu0.1
Ubuntu:Pro:18.04:LTS flask-security 0 1.7.5-2ubuntu0.18.04.1~esm1
openSUSE:Leap 15.3 python-Flask-Security 0 3.0.0-150100.4.3.1
openSUSE:Leap 15.3 python-Flask-Security-Too 0 3.4.2-150200.3.6.1
openSUSE:Leap 15.4 python-Flask-Security 0 3.0.0-150100.4.3.1
openSUSE:Leap 15.4 python-Flask-Security-Too 0 3.4.2-150200.3.6.1
openSUSE:Tumbleweed python-Flask-Security 0 5.5.2-1.1

Related vulnerabilities