CVE-2021-21241CSRF can expose users authentication token in Flask-Security-Too
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.
What to do
Fixed builds are available from Debian, PyPI: see the table below for the fixed version per release.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | flask-security | Not affected vulnerable_code_not_present | ||
| Ubuntu 22.04 | flask-security | Not affected vulnerable_code_not_present | ||
| Ubuntu 20.04 | flask-security | Not affected vulnerable_code_not_present | ||
| Debian 14 | flask-security | Fixed | 4.0.0-1 | DEBIAN-CVE-2021-21241 |
| Debian 13 | flask-security | Fixed | 4.0.0-1 | DEBIAN-CVE-2021-21241 |
| Debian 12 | flask-security | Fixed | 4.0.0-1 | DEBIAN-CVE-2021-21241 |
| PyPI library | flask-security-too | Fixed | 3.4.5 | GHSA-hh7m-rx4f-4vpv |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- Flask-Middleware flask-security-too: affected: >= 3.3.0, < 3.4.5
References
- https://github.com/Flask-Middleware/flask-security/security/advisories/GHSA-hh7m-rx4f-4vpv
- https://github.com/Flask-Middleware/flask-security/pull/422
- https://github.com/Flask-Middleware/flask-security/commit/61d313150b5f620d0b800896c4f2199005e84b1f
- https://github.com/Flask-Middleware/flask-security/commit/6d50ee9169acf813257c37b75babe9c28e83542a
- https://github.com/Flask-Middleware/flask-security/releases/tag/3.4.5
- https://pypi.org/project/Flask-Security-Too
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.