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.
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
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | flask-security | 4.0.0-1 | DEBIAN-CVE-2021-21241 |
| Debian:13 | flask-security | 4.0.0-1 | DEBIAN-CVE-2021-21241 |
| Debian:14 | flask-security | 4.0.0-1 | DEBIAN-CVE-2021-21241 |
| PyPI | flask-security-too | 3.4.5 | GHSA-hh7m-rx4f-4vpv |
| PyPI | flask-security-too | 3.4.5 | PYSEC-2021-91 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| 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
- https://github.com/Flask-Middleware/flask-security/security/advisories/GHSA-hh7m-rx4f-4vpv x_refsource_CONFIRM
- https://github.com/Flask-Middleware/flask-security/pull/422 x_refsource_MISC
- https://github.com/Flask-Middleware/flask-security/commit/61d313150b5f620d0b800896c4f2199005e84b1f x_refsource_MISC
- https://github.com/Flask-Middleware/flask-security/commit/6d50ee9169acf813257c37b75babe9c28e83542a x_refsource_MISC
- https://github.com/Flask-Middleware/flask-security/releases/tag/3.4.5 x_refsource_MISC
- https://pypi.org/project/Flask-Security-Too x_refsource_MISC