CSRF with logout action
The logout endpoint accepted GET requests without CSRF protection, so an attacker could log a victim out by tricking them into visiting a crafted link. The impact is limited to disrupting the user's session, not account takeover.
- Fixed in 13 days
- Disclosed after 43 days
Hi, I wanted let you know and saw that previously similar issue was fixed. Repro steps: Go to https://weblate.org/pl/ and click top right icon for logging in (user-tab user-anonymous, https://weblate.org/saml2/login/?next=/pl/). Log in using username and password (https://hosted.weblate.org/accounts/login/?next=/idp/login/process/). Logged in on site https://weblate.org/pl/ use link: https://weblate.org/logout/ See logged out.
The similar result with using external page with prepared CSRF payload like:
<a href="https://weblate.org/logout/"> Click me to see bonus pack
Here as logged in user use this link from external page, next go to tab where logged in and refresh the page - see logged out there too.
Best regards,
Impact
Bad actor can affect the user's login status - logged out.
What the report shows
The target is Weblate, and the feature under scrutiny is the logout action. The researcher opens by noting that a similar issue had been fixed before, which notes that a similar issue had been fixed before..
The reproduction is short and entirely manual:
- Go to
https://weblate.org/pl/and click the icon in the top right for logging in. The report identifies this element asuser-tab user-anonymousand gives the login URL ashttps://weblate.org/saml2/login/?next=/pl/. - Log in with a username and password. The report gives the login endpoint as
https://hosted.weblate.org/accounts/login/?next=/idp/login/process/. - Once logged in on
https://weblate.org/pl/, visit the linkhttps://weblate.org/logout/. - The session ends: the user is logged out.
The second half of the report shows the same result reached from a different origin. The researcher prepares an external page containing this payload:
<a href="https://weblate.org/logout/"> Click me to see bonus pack
A logged-in user who follows that link from the external page is then asked to switch to the tab where they are logged in and refresh it. On refresh they are logged out there too. The link text is social-engineering bait, which is what makes a click plausible in the first place.
The report does not describe a fix. The impact section is a single sentence: a bad actor can affect the user's login status, that is, log them out.
Root cause
The report does not analyse the server-side code, so the cause is inferred from behaviour. The logout endpoint accepts a state-changing request that carries the victim's session and performs the action without any proof that the request was intentional. In practice the logout action is reachable from a plain link on an external page. Because the browser attaches the session cookie to a top-level navigation to that URL, the server cannot tell the researcher's crafted link from a legitimate logout click.
The report notes that a similar issue had been fixed previously.
Impact
The only demonstrated effect is that a logged-in user can be forced out of their session. The report does not claim data theft, account takeover or any other consequence, and none should be read into it.
How this kind of bug works
CSRF abuses the fact that browsers attach credentials, cookies in particular, to requests automatically, regardless of which site caused the request. If a state-changing endpoint authenticates purely on the session cookie and does nothing else to verify intent, any page on the internet can trigger that endpoint on behalf of a visiting user.
Two properties make an endpoint interesting. First, it changes state: logout, email change, password change, linking a third-party identity, enabling or disabling two-factor authentication. Second, it is reachable by a request a cross-site page can produce without reading the response, such as a top-level navigation, an image load, a form submission or a fetch with simple headers. Endpoints that require a custom header, a non-simple content type or a value the attacker cannot know are naturally harder to reach.
Defences work by making the request unforgeable or by refusing to act on cross-site requests. A per-session, unpredictable anti-CSRF token submitted with the request is the classic answer. SameSite cookie attributes (Lax or Strict) stop the cookie riding along on cross-site requests, though Lax still permits top-level GET navigations, which is exactly why logout should not be a GET. Checking the Origin or Referer header against an allowlist is a common secondary control. Finally, state-changing actions should use POST (or another non-idempotent method) so that a link or image cannot trigger them.
How to test for it
- Map the authenticated actions of the application: logout, profile and email changes, password change, MFA enrolment, API key creation, account deletion, invitation acceptance.
- For each, capture the legitimate request in a proxy and note the method, the parameters, and whether any token is present.
- Remove the anti-CSRF token, or replace it with a random value of the same shape, and replay the request. If it still succeeds, the token is not being validated.
- Build a minimal cross-site page that issues the same request: a form that auto-submits, an image tag, or a link the victim clicks. Serve it from a different origin and load it while authenticated.
- Observe whether the action takes effect. For logout, a positive result is the session ending after the cross-site request; for account changes, the new value appearing in the profile.
- Repeat with the
SameSitebehaviour in mind: test in a browser where the cookie policy is default, and note whether the request is a top-level navigation or a subresource.
Common false positives: the endpoint returns a success page but the action did not actually happen; the token was present in a cookie rather than the body and was still validated; the request only worked because the tester was on the same site; or the action is genuinely idempotent and harmless, such as a search. Always confirm the effect from the victim's own session, not from the response body alone.
How it is fixed
Require a valid, per-session anti-CSRF token on every state-changing request and reject requests where it is missing or wrong. Change logout from GET to POST so that links and images cannot trigger it. Set session cookies with SameSite=Lax at minimum, and Strict where the flow allows. Validate the Origin header, falling back to Referer, against the expected host for sensitive actions. Where a framework provides built-in CSRF middleware, ensure it covers every route, including ones added later, since the report notes a similar issue was fixed previously..
Hunting notes
Logout is the classic hiding place because developers treat it as harmless and often exempt it from CSRF middleware. The same applies to language and theme switches, "mark all as read", and any endpoint that mutates state through a GET. Look at routes excluded from the framework's protection list, at older handlers kept for compatibility, and at endpoints on a different subdomain from the main application, where cookie scope and middleware coverage can differ.
Recon signals worth following: a logout link rendered as a plain anchor with no token in the query string; state-changing actions reachable by GET; session cookies without a SameSite attribute; and a changelog or prior report mentioning a CSRF fix, which invites a check for incomplete coverage.
To make the report land, show the cross-origin page, the exact request it produces, and the observable effect in the victim's session. For logout alone, expect it to be treated as low severity; it is more persuasive when chained with a pretext that convinces the user to click, or when the same missing protection also reaches an action with real consequences. Keep the demonstration reproducible and state the impact no more broadly than what you actually observed.
What happened, in plain words
Weblate is a translation platform: people use it to translate software and websites into many languages. Like most websites with user accounts, it has a login and a logout. Logging out ends your session, meaning the site stops recognising you as signed in until you log in again.
The researcher found that the logout action on https://weblate.org/ could be triggered by any other website. In other words, a page controlled by someone else could make your browser log you out of Weblate without you intending it. The researcher also noted that a similar issue had been fixed before.
The report does not describe a fix. The impact section is a single sentence: a bad actor can affect the user's login status, that is, log them out.
The steps the researcher took
The reproduction is short and entirely manual:
- Go to
https://weblate.org/pl/and click the icon in the top right for logging in. The report identifies this element asuser-tab user-anonymousand gives the login URL ashttps://weblate.org/saml2/login/?next=/pl/. - Log in with a username and password. The report gives the login endpoint as
https://hosted.weblate.org/accounts/login/?next=/idp/login/process/. - Once logged in on
https://weblate.org/pl/, visit the linkhttps://weblate.org/logout/. - The session ends: the user is logged out.
Step 3 shows the logout happens by visiting a plain link. That is the property the rest of the report exploits.
The same result from another website
The second half of the report shows the same outcome reached from a different origin. The researcher prepares an external page containing this payload:
<a href="https://weblate.org/logout/"> Click me to see bonus pack
Line by line: <a opens a link, href="https://weblate.org/logout/" is the address the link points to, and Click me to see bonus pack is the text shown to the visitor. The link text is bait: it gives a reason to click, which is what makes the trick plausible in the first place.
A logged-in user who follows that link from the external page is then asked to switch to the tab where they are logged in and refresh it. On refresh they are logged out there too. The refresh is what makes the effect visible in the tab the user was actually using.
Why it works
When you log in to a site, the site gives your browser a small piece of data called a session cookie. Your browser stores it and sends it back with every request to that site, so the site knows who you are. Crucially, the browser does this automatically, no matter which page caused the request. If a logout address accepts a simple visit and acts on the cookie alone, then any page on the internet can send your browser to that address and end your session. The server has no way to tell the researcher's crafted link from a genuine logout click.
What it does not do
The only demonstrated effect is that a logged-in user can be forced out of their session. The report does not claim data theft, account takeover or any other consequence, and none should be read into it.
In general, how this kind of bug works
This class of bug is called Cross-Site Request Forgery, or CSRF. It abuses the fact that browsers attach credentials, cookies in particular, to requests automatically, regardless of which site caused the request. If an action that changes something authenticates purely on the session cookie and does nothing else to verify intent, any page on the internet can trigger that action on behalf of a visiting user.
A useful comparison: imagine a cloakroom that hands you a ticket and later gives your coat to anyone who shows up with a ticket, without checking that the person holding it is you. The ticket is valid, so the cloakroom is satisfied, even though the wrong person is collecting.
Two properties make an action interesting to an attacker. First, it changes state: logout, email change, password change, linking a third-party identity, enabling or disabling two-factor authentication. Second, it is reachable by a request a cross-site page can produce without reading the response, such as a top-level navigation, an image load, a form submission or a fetch with simple headers. Actions that require a custom header, a non-simple content type or a value the attacker cannot know are naturally harder to reach.
Defences work by making the request unforgeable or by refusing to act on cross-site requests. A per-session, unpredictable anti-CSRF token submitted with the request is the classic answer: the attacker's page cannot guess the value, so the request is rejected. SameSite cookie attributes (Lax or Strict) stop the cookie riding along on cross-site requests, though Lax still permits top-level GET navigations, which is exactly why logout should not be a GET. Checking the Origin or Referer header against an allowlist is a common secondary control. Finally, state-changing actions should use POST (or another non-idempotent method) so that a link or image cannot trigger them.
How to test for it
- Map the authenticated actions of the application: logout, profile and email changes, password change, MFA enrolment, API key creation, account deletion, invitation acceptance.
- For each, capture the legitimate request in a proxy and note the method, the parameters, and whether any token is present.
- Remove the anti-CSRF token, or replace it with a random value of the same shape, and replay the request. If it still succeeds, the token is not being validated.
- Build a minimal cross-site page that issues the same request: a form that auto-submits, an image tag, or a link the victim clicks. Serve it from a different origin and load it while authenticated.
- Observe whether the action takes effect. For logout, a positive result is the session ending after the cross-site request; for account changes, the new value appearing in the profile.
- Repeat with the
SameSitebehaviour in mind: test in a browser where the cookie policy is default, and note whether the request is a top-level navigation or a subresource.
Common false positives: the endpoint returns a success page but the action did not actually happen; the token was present in a cookie rather than the body and was still validated; the request only worked because the tester was on the same site; or the action is genuinely idempotent and harmless, such as a search. Always confirm the effect from the victim's own session, not from the response body alone.
How it is fixed
Require a valid, per-session anti-CSRF token on every state-changing request and reject requests where it is missing or wrong. Change logout from GET to POST so that links and images cannot trigger it. Set session cookies with SameSite=Lax at minimum, and Strict where the flow allows. Validate the Origin header, falling back to Referer, against the expected host for sensitive actions. Where a framework provides built-in CSRF middleware, ensure it covers every route, including ones added later, since the report notes a similar issue was fixed previously..
Where to look
Logout is the classic hiding place because developers treat it as harmless and often exempt it from CSRF middleware. The same applies to language and theme switches, "mark all as read", and any endpoint that mutates state through a GET. Look at routes excluded from the framework's protection list, at older handlers kept for compatibility, and at endpoints on a different subdomain from the main application, where cookie scope and middleware coverage can differ.
Signals worth following: a logout link rendered as a plain anchor with no token in the query string; state-changing actions reachable by GET; session cookies without a SameSite attribute; and a changelog or prior report mentioning a CSRF fix, which invites a check for incomplete coverage.
To make the report land, show the cross-origin page, the exact request it produces, and the observable effect in the victim's session. For logout alone, expect it to be treated as low severity; it is more persuasive when chained with a pretext that convinces the user to click, or when the same missing protection also reaches an action with real consequences. Keep the demonstration reproducible and state the impact no more broadly than what you actually observed.
Glossary
- CSRF (Cross-Site Request Forgery): a trick where another website makes your browser send a request to a site you are logged in to, using your existing session.
- Session: the period during which a site remembers that you are logged in.
- Cookie: a small piece of data a site stores in your browser and receives back on later requests, often used to identify your session.
- Session cookie: the specific cookie that proves you are logged in.
- Logout: the action that ends your session.
- Endpoint: a specific address on a server that performs an action when a request is sent to it.
- Request: a message your browser sends to a server, for example asking for a page or asking it to do something.
- GET: the request method browsers use when you open a link or type an address; it is meant for reading, not for changing things.
- POST: a request method meant for sending data that changes something on the server.
- State-changing action: anything that alters data or status, such as logging out, changing an email or enabling two-factor authentication.
- Origin: the combination of scheme, host and port that identifies where a page came from, for example
https://weblate.org. - Cross-origin: coming from a different origin than the site being targeted.
- Top-level navigation: when the browser loads a new page in the tab itself, as opposed to loading something quietly in the background.
- Anti-CSRF token: a secret, unpredictable value tied to your session that must accompany a request, so a foreign page cannot forge it.
SameSite: a cookie setting that controls whether the cookie is sent on cross-site requests;Laxallows some top-level navigations,Strictallows none.Origin/Refererheader: information the browser sends about where a request came from, which a server can check.- Idempotent: an action that gives the same result whether performed once or many times.
- MFA: multi-factor authentication, logging in with more than one proof of identity.
- Proxy: a tool that sits between your browser and the server so you can inspect and modify requests.
- False positive: a test result that looks like a bug but is not one.
- Severity: a rating of how serious a bug is.
- CVSS: a standard scoring system for the severity of security issues.
- Regression: when a bug that was fixed comes back.