Skip to content

Logout is accessible via GET, enabling forced-logout attacks #783

Description

@andrewmusselman

ASVS: 3.5.1, 3.5.3 · CWE: CWE-352 · Files: src/asfquart/generics.py (lines 51–58), atr/templates/includes/topnav.html (line 142)

Description

Logout is performed by navigating to GET /auth?logout. Session destruction is a state-changing operation and should not be on a safe HTTP method. An attacker can force logout via <img src="https://target/auth?logout"> on any page, disrupting user workflows.

Vulnerable code

# src/asfquart/generics.py
elif logout_uri or quart.request.query_string == b"logout":
    asfquart.session.clear()  # state change via GET
<!-- topnav.html -->
<a href="/auth?logout=/" class="logout-link btn btn-sm btn-secondary ms-2">Log out</a>

Recommended fix

Require POST for logout and protect with CSRF:

<form method="post" action="/auth/logout" class="d-inline">
    {{ csrf_input|safe }}
    <button type="submit" class="logout-link btn btn-sm btn-secondary ms-2">Log out</button>
</form>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ASVSAnything related to ASVS requirementsL1ASVS L1 requirementasfquartsecurityIssues related to security posture

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions