Vulnerability · Published Jan 11, 2021 · Assigned by GitHub_M

CVE-2021-21241CSRF can expose users authentication token in Flask-Security-Too

High 7.4

In plain English

A high-severity cross-site request forgery in flask-security-too from Flask-Middleware. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.9% (higher than 61% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.4High
Exploit odds (30 days)0.9%top 39.3% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

The Python "Flask-Security-Too" package is used for adding security features to your Flask application. It is an is a independently maintained version of Flask-Security based on the 3.0.0 version of Flask-Security. In Flask-Security-Too from version 3.3.0 and before version 3.4.5, the /login and /change endpoints can return the authenticated user's authentication token in response to a GET request. Since GET requests aren't protected with a CSRF token, this could lead to a malicious 3rd party site acquiring the authentication token. Version 3.4.5 and version 4.0.0 are patched. As a workaround, if you aren't using authentication tokens - you can set the SECURITY_TOKEN_MAX_AGE to "0" (seconds) which should make the token unusable.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12flask-security4.0.0-1DEBIAN-CVE-2021-21241
Debian:13flask-security4.0.0-1DEBIAN-CVE-2021-21241
Debian:14flask-security4.0.0-1DEBIAN-CVE-2021-21241
PyPIflask-security-too3.4.5GHSA-hh7m-rx4f-4vpv
PyPIflask-security-too3.4.5PYSEC-2021-91

Affected products (as reported)

VendorProductVersions
Flask-Middleware flask-security-too >= 3.3.0, < 3.4.5

Weakness: CWE-352 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N

References