GHSA-6qmf-fj6m-686c

Suggest an improvement
Source
https://github.com/advisories/GHSA-6qmf-fj6m-686c
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/05/GHSA-6qmf-fj6m-686c/GHSA-6qmf-fj6m-686c.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-6qmf-fj6m-686c
Aliases
Published
2021-05-17T20:51:27Z
Modified
2024-09-20T21:23:32.197383Z
Severity
  • 3.1 (Low) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:N CVSS Calculator
  • 2.1 (Low) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N CVSS Calculator
Summary
Open Redirect in Flask-Security-Too
Details

Impact

Flask-Security allows 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 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 'autocorrectlocationheader=False` which would then open up their application to this attack.

Patches

No patches as this time

Workarounds

If using Werkzeug, make sure to use the default Location header setting. If you can't - then use@app.after_request and write your own validation of the Location header if it is set.

References

No.

For more information

If you have any questions or comments about this advisory follow: https://github.com/Flask-Middleware/flask-security/issues/486

Thanks to Claroty (2021-0141) and @snoopysecurity for providing details and proof of concept.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-601"
    ],
    "severity": "LOW",
    "github_reviewed": true,
    "github_reviewed_at": "2021-05-17T16:53:26Z"
}
References

Affected packages

PyPI / flask-security-too

Package

Name
flask-security-too
View open source insights on deps.dev
Purl
pkg:pypi/flask-security-too

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
4.1.0

Affected versions

3.*

3.0.1rc1
3.0.1rc2
3.0.1rc3
3.0.1
3.0.2
3.1.0rc1
3.2.0rc1
3.2.0rc3
3.2.0rc4
3.2.0
3.3.0rc1
3.3.0rc2
3.3.0rc3
3.3.0
3.3.1
3.3.2
3.3.3
3.4.0
3.4.1
3.4.2
3.4.3
3.4.4
3.4.5

4.*

4.0.0rc1
4.0.0rc2
4.0.0
4.0.1