CSRF Misconfigurations: Analyzing a Logout Vulnerability and Its
The logout endpoint accepted cross-site requests without CSRF validation, so an attacker could force an authenticated user to be logged out. The text claims only forced session termination, not account takeover or data access.
Published on medium.com
Csrf
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This write-up covers a logout Cross-Site Request Forgery (CSRF) issue found during an authorised web security assessment. The affected application and its domain are deliberately omitted, and the testing was carried out against a controlled test account in an environment where the researcher had permission to test.
The feature in question is the application's logout functionality, exposed at the endpoint /logout. Logout normally ends the user's authenticated session: the user clicks the control, the browser sends a request to the server, and the server terminates the session so that the user is no longer authenticated. Because logout changes authentication state, it sits inside the session lifecycle alongside login, password reset and account management, and the researcher argues it deserves the same scrutiny as those actions.

The image is described in the article as AI generated.
Setup
The assessment used Burp Suite to inspect the logout request and observe how the application handled it. Testing was performed with a controlled test account, authenticated to the application, in an environment where security testing was authorised. No specific application version, framework or server software is given.
The checks the researcher ran against the endpoint were:
- Identify the HTTP method used by the logout endpoint.
- Inspect the request for an anti-CSRF token.
- Check whether the server validated the token when one was absent.
- Review the session cookie configuration.
- Observe whether a cross-site request could terminate the authenticated session.
The researcher is explicit that a missing visible CSRF token does not by itself prove a vulnerability, because applications may rely on other defences such as the SameSite cookie attribute and Origin validation. The real question was whether the logout action could actually be triggered cross-site under the tested conditions.
Finding it
While examining how the application handled sessions and authentication-related actions, the researcher focused on logout. In the tested scenario, the logout action could be triggered without the expected CSRF validation, and the authenticated session was terminated. That gap between what the application should have enforced and what it actually did is the finding: the logout action could be triggered without the CSRF protection the researcher expected, and the session was terminated as a result.
Exploitation
Step 1: Capture the logout request
The researcher authenticated to the application and captured the logout request in Burp Suite, then reviewed the request method and the server's response to understand how logout was implemented.
Step 2: Test without a validated anti-CSRF token
The next step was to test whether the endpoint accepted a request without a validated anti-CSRF token. For an endpoint that uses POST, the researcher gives this minimal HTML form to illustrate the request pattern:
<form action="https://target.com/logout" method="POST"> <button type="submit">Log out</button></form>
The form posts to the logout path on the target origin. The researcher stresses that this only illustrates the request structure and does not establish that a cross-site request will succeed, since browser cookie policies, application defences and server-side validation can all prevent the action.
Step 3: Test a GET-based endpoint
For a GET-based logout endpoint, an image request is sometimes used to check whether merely requesting the URL triggers the logout action:
<img src="https://target.com/logout" alt="">
Again this is a test pattern rather than proof of exploitability. Whether it works depends on the endpoint's implementation, the browser's cookie behaviour and the application's defences.
Step 4: Validate against the test session
The researcher evaluated the observed result using their own test session. The validation criteria were:
- The request originated from a separate origin.
- The browser sent the necessary authentication context, if permitted by its cookie policy.
- The server processed the request as a logout action.
- The previously authenticated session was no longer usable.
These observations are what separate a genuine logout CSRF from an endpoint that simply lacks an obvious token but remains protected by other controls.
Expected versus actual behaviour
The application should have prevented unauthorised cross-site requests from triggering logout where CSRF protection is required, and should have processed logout only through the intended application flow, invalidating the relevant session appropriately. In the tested scenario, the logout action could be triggered without the expected CSRF validation and the authenticated session was terminated, which indicated a gap in protection against cross-site logout requests. The researcher notes that the finding should only be reported once this behaviour has been reproduced against the actual application; a missing token alone is insufficient evidence.
Root cause
In the tested scenario the expected CSRF validation was absent, and the logout action could be triggered without it. The report does not show the server-side code, so the precise implementation mistake is not stated; what is established is that the expected CSRF validation was absent in the tested scenario. The researcher checked for an anti-CSRF token, for server-side validation when the token was absent, and reviewed the session cookie configuration. The report does not state which, if any, of SameSite or Origin validation was configured.
Impact
The primary impact is forced session termination. An attacker who can trigger the vulnerable action may be able to disrupt an authenticated user's activity by causing an unexpected logout. Potential consequences listed are:
- Interrupting an active user session.
- Disrupting a workflow that depends on an authenticated session.
- Requiring the user to sign in again.
- Causing inconvenience or loss of unsaved work in applications that do not preserve it.
The researcher is careful not to overstate this. Logout CSRF does not by itself demonstrate account takeover, unauthorised data access or modification of another user's information; those outcomes would require additional vulnerabilities or specific application behaviour. Severity may be higher in unusual circumstances where forced logout has a demonstrable security consequence, but such scenarios need separate evidence.
Classification given in the report:
| Item | Value |
|---|---|
| Category | Cross-Site Request Forgery (Logout CSRF) |
| CWE | CWE-352, Cross-Site Request Forgery (CSRF) |
| OWASP mapping | A01:2021 Broken Access Control may be relevant as a broader category, though the most direct description is a CSRF protection weakness |
| Suggested severity | Informational or Low, depending on the program's policy and demonstrated impact |
The proposed CVSS vector in the initial assessment was:
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L
That vector produces a CVSS 3.1 base score of 4.3 (Medium) only if its assumptions are justified: PR:N assumes the attacker needs no privileges, and A:L assigns a low availability impact.
Fix
The report sets out defensive measures rather than describing a change that was made.
- Use POST for state-changing actions. Logout changes the user's authentication state, so a
POSTrequest is preferable to aGETrequest. - Implement CSRF protection. Where appropriate, require a valid anti-CSRF token and validate it on the server, rejecting requests that do not satisfy the application's CSRF requirements.
- Configure session cookies securely. Use
Secureso cookies are sent only over HTTPS,HttpOnlyso JavaScript cannot read the cookie directly, and an appropriateSameSitesetting such asLaxorStrictwhen compatible with the application's requirements.SameSiteis defence in depth, not a universal substitute for CSRF defences, because its protection depends on configuration and request context. - Validate the request origin. For relevant requests, validate the
Originheader and, where appropriate, useRefereras an additional signal, rejecting requests from unexpected origins under a clearly defined policy. - Invalidate sessions server-side. On logout the server should invalidate the associated session or authentication credentials; merely redirecting the browser to a login page does not necessarily terminate the underlying session.
- Logout over
GET. Request the logout URL directly from another origin, for example with the image pattern above. A positive result is that the victim's authenticated session is no longer usable afterwards. - Logout over
POSTwithout a token. Submit the form pattern above from a separate origin. A positive result is the same: the server processes the logout and the session is terminated. - Token present but not validated. Remove or alter the anti-CSRF token in the captured request and replay it. A positive result is that the server still processes the logout, showing the token is not checked server-side.
- Cookie attribute review. Inspect the session cookie for
Secure,HttpOnlyandSameSite. A positive result for the attacker is a session cookie without a restrictiveSameSitesetting, which makes cross-site delivery of the authentication context more likely. - Origin and Referer handling. Send the request with an unexpected
Originand withRefererremoved or altered. A positive result is that the server processes the logout anyway, showing origin validation is absent or ineffective. - Server-side session invalidation. After a logout, replay the old session cookie. A positive result is that the old session still works, meaning logout only redirected the browser rather than terminating the session.
For each variant, the researcher's validation criteria apply: the request must come from a separate origin, the browser must send the authentication context if its cookie policy permits, the server must process the request as a logout, and the previously authenticated session must no longer be usable. Anything short of that is a theoretical weakness, not a confirmed finding.
What happened, in plain words
Imagine you are logged in to a website, say your email or a shopping site. You click around, do some work, and then something you never clicked logs you out. You did not press the logout button. You did not close the tab. Yet the site suddenly treats you as a stranger and asks you to sign in again.
That is the situation described here. During an authorised security assessment, the researcher looked at how an application handled logging users out. The logout feature lived at a web address ending in /logout. In the tested scenario, the logout action could be triggered without the expected CSRF validation, and the authenticated session was terminated. This kind of trick is called Cross-Site Request Forgery, or CSRF for short.
The affected application and its domain are deliberately left out of the write-up. The testing was done against a controlled test account, in an environment where the researcher had permission to test. That matters: you should only ever do this kind of testing on systems you own or are explicitly allowed to assess.

The article labels this image as AI generated.
Before going further, a few words that will come up constantly.
- A session is the period during which a website remembers who you are after you sign in. It is like a wristband at an event: once you have it, staff let you move around without checking your ID at every door.
- A cookie is a small piece of data your browser stores for a website and sends back with requests to that site. The session wristband is usually kept in a cookie. Your browser attaches it automatically, which is convenient for you and also the reason this vulnerability exists.
- An endpoint is simply a specific address on a server that does one job.
/logoutis the endpoint whose job is to end your session. - An origin is the combination of scheme, host and port that a web page comes from, for example
https://target.com. Two pages on different origins are treated by the browser as belonging to different sites. A request from one origin to another is called cross-site. - CSRF is a class of bug where an attacker's page causes your browser to send a request to another site where you are logged in, and that site acts on it as if you had asked. The attacker never sees your cookie; your browser supplies it because the request goes to the right site.
Logout may sound unimportant next to login or password reset. The researcher's point is the opposite: security testing should cover the whole session lifecycle, meaning how sessions are created, kept alive, and ended. Logout is part of that lifecycle, so it deserves the same attention.
1. Understanding logout CSRF
CSRF, spelled out, is a web security weakness in which an attacker tricks a victim's browser into sending an unwanted request to an application where the victim is already signed in.
A useful everyday comparison: think of a office where the receptionist knows your face. If someone walks in wearing a mask that looks like you, the receptionist might wave them through. In CSRF, the mask is your browser's automatic cookie. The attacker does not need your password; they just need your browser to make the request for them.
Browsers may automatically attach session cookies to certain cross-site requests, depending on how the cookie is configured and what kind of request it is. If an application does not properly protect a sensitive action against CSRF, an attacker may be able to trigger that action without the user's informed consent.
Logout CSRF is the specific case where the unwanted request ends the victim's signed-in session. Unlike bugs that leak private information or let someone change account details, logout CSRF mainly affects whether the session stays available and how pleasant the experience is.
Picture a user halfway through filling in a long form on a website. An externally triggered request logs them out unexpectedly. They may lose unsaved work, or they have to sign in again. The exact impact depends on how the application behaves and the context in which the logout happens.
2. Investigating the logout endpoint
During testing, the researcher focused on the application's logout functionality.
Affected endpoint: /logout
The goal was to find out whether that endpoint could be triggered from another origin without the request being properly validated. In plain terms: can a page on a different website make your browser hit /logout and have the server accept it?
The researcher used a tool called Burp Suite to inspect the logout request and see how the application handled it. Burp Suite is a program that sits between your browser and the website and lets you read and change the traffic going back and forth. Think of it as a transparent pipe with a window in it.
The checks the researcher ran were:
- Identify the HTTP method used by the logout endpoint. The HTTP method is the verb of a request:
GETusually means "give me this page",POSTusually means "here is some data, act on it". - Inspect the request for an anti-CSRF token. A token here is a secret value the page includes in a request so the server can tell a genuine request from a forged one. It is like a numbered ticket that the server issued and can check.
- Check whether the server validated the token when one was absent. In other words, does the server notice when the ticket is missing, or does it let the request through anyway?
- Review the session cookie configuration. Cookie settings such as
SameSitecontrol when the browser is willing to send the cookie on cross-site requests. - Observe whether a cross-site request could terminate the authenticated session.
One important distinction: just because you cannot see a CSRF token does not automatically prove there is a vulnerability. Some applications use other defences, including the SameSite cookie attribute and Origin validation. SameSite tells the browser whether to send the cookie along with requests that come from another site. Origin validation means the server checks the Origin header, which the browser sets to say where the request came from, and rejects requests from places it does not expect.
The key question was whether the logout action could actually be triggered cross-site under the tested conditions. Not whether a token was missing on paper, but whether the trick worked in practice.
3. Validating the behaviour with a proof of concept
To investigate the issue, the researcher used a controlled test account in an environment where they had permission to perform security testing. A proof of concept is a small, safe demonstration that shows a bug is real rather than theoretical.
First, the researcher signed in to the application and captured the logout request in Burp Suite. They then reviewed the request method and the server's response to work out how logout was implemented. This step is like watching a door being opened normally before trying to open it from an unusual angle: you need to know what a legitimate request looks like.
Next, they tested whether the endpoint accepted a request without a validated anti-CSRF token. For an endpoint that uses POST, a minimal HTML form can illustrate the request pattern:
<form action="https://target.com/logout" method="POST"> <button type="submit">Log out</button></form>
Line by line, in plain words:
<form ...>starts an HTML form, a block that can collect input and send it somewhere.action="https://target.com/logout"says where the form sends its data: the logout address on the target site.method="POST"says the form uses thePOSTmethod, the verb normally used when you are asking the server to change something.<button type="submit">Log out</button>is the button a user would click to send the form. The text between the tags is just the label shown on the button.</form>closes the form.
This example illustrates the request structure; it does not establish that a cross-site request will succeed. Browser cookie policies, application defences, and server-side validation can all prevent the action. In other words, the form is a sketch of the attack, not a guarantee.
For a GET-based logout endpoint, an image request is sometimes used to test whether merely requesting the URL triggers the logout action:
<img src="https://target.com/logout" alt="">
Line by line:
<img ...>tells the browser to load an image.src="https://target.com/logout"is the address the browser will fetch to get that image. If the logout endpoint answersGETrequests by ending the session, then simply loading this "image" is enough to log the user out.alt=""is the text shown if the image cannot load. It is empty here because there is no real image.
Again, this is a test pattern, not proof of exploitability. Whether it works depends on the endpoint's implementation, the browser's cookie behaviour, and the application's defences. The trick relies on the browser happily fetching an image from another site and attaching the session cookie along the way.
I then evaluated the observed result using my own test session. The important validation criteria were:
- The request originated from a separate origin. If the request came from the same site, it proves nothing about cross-site attacks.
- The browser sent the necessary authentication context, if permitted by its cookie policy. Without the cookie, the server has no idea who the user is.
- The server processed the request as a logout action. A redirect to a login page is not the same as actually ending the session.
- The previously authenticated session was no longer usable. This is the real test: after the trick, can the old session still do things?
These observations help distinguish a genuine logout CSRF vulnerability from an endpoint that simply lacks an obvious token but remains protected by other controls. A missing ticket on the door is not the same as an unlocked door.
4. Expected versus actual behaviour
Expected behaviour
The application should prevent unauthorised cross-site requests from triggering logout where CSRF protection is required. The server should process logout only through the intended application flow and invalidate the relevant session appropriately. In everyday terms: the door should only open when you personally turn the handle, and once it opens, the wristband should actually be cancelled.
Actual behaviour
In the tested scenario, the logout action could be triggered without the expected CSRF validation, resulting in the authenticated session being terminated. This behaviour indicated a gap in the application's protection against cross-site logout requests.
The finding should be reported only when this behaviour has been reproduced against the actual application. A missing token by itself is insufficient evidence. This is a recurring theme in the write-up: evidence first, claims second.
5. Security impact
The primary impact of logout CSRF is forced session termination. An attacker who can trigger the vulnerable action may be able to disrupt an authenticated user's activity by causing an unexpected logout.
Potential consequences include:
- Interrupting an active user session.
- Disrupting a workflow that depends on an authenticated session.
- Requiring the user to sign in again.
- Causing inconvenience or loss of unsaved work in applications that do not preserve it.
However, the impact should not be overstated. A logout CSRF vulnerability does not, by itself, demonstrate account takeover, unauthorised data access, or modification of another user's information. Those outcomes would require additional vulnerabilities or specific application behaviour. In other words, being logged out is annoying, but it is not the same as someone reading your messages or changing your password.
The severity may be higher in unusual circumstances where forced logout has a demonstrable security consequence, but such scenarios need separate evidence.
6. Severity and classification
The finding can be classified as:
- Category: Cross-Site Request Forgery (Logout CSRF)
- CWE: CWE-352, Cross-Site Request Forgery (CSRF). CWE is a public catalogue of weakness types, and CWE-352 is the entry for CSRF.
- OWASP mapping: A01:2021, Broken Access Control, may be relevant as a broader category, although the most direct description is a CSRF protection weakness. OWASP is a well-known community project that publishes guidance and lists of common security risks.
- Suggested severity: Informational or Low, depending on the program's policy and demonstrated impact. Severity is a rough label for how serious a bug is, and different bug bounty programs set their own rules.
What about CVSS?
CVSS is a scoring system that turns a set of characteristics into a number, so different bugs can be compared. The proposed vector in the initial assessment was:
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L
Each part is a short code for one characteristic:
AV:Nmeans the attack can be carried out over the network rather than needing physical access.AC:Lmeans the attack complexity is low.PR:Nmeans the attacker needs no privileges on the target system.UI:Rmeans user interaction is required: the victim has to do something, such as visit a page.S:Umeans the impact stays within the same security scope.C:Nmeans there is no confidentiality impact: no private data is exposed.I:Nmeans there is no integrity impact: no data is changed.A:Lmeans there is a low availability impact: the service is disrupted a little.
However, this vector produces a CVSS 3.1 base score of 4.3 (Medium) only if its assumptions are justified. In particular, PR:N assumes no privileges are required by the attacker, and A:L assigns a low availability impact. If those assumptions do not hold, the score does not hold either.
7. How developers can fix logout CSRF
There are several ways to strengthen logout handling.
Use POST for state-changing actions
Logout changes the user's authentication state. It is preferable to use a POST request rather than a GET request. The reason is that GET requests are easy to trigger accidentally or maliciously, for example by loading an image, while POST is meant for actions that change something.
Implement CSRF protection
Where appropriate, require a valid anti-CSRF token and validate it on the server. Reject requests that do not satisfy the application's CSRF protection requirements. The server, not the browser, has to do the checking; a token that is never verified is just decoration.
Configure session cookies securely
Use suitable cookie attributes, including:
Secure, so cookies are sent only over HTTPS. This stops the cookie travelling over an unencrypted connection where someone could read it.HttpOnly, to prevent JavaScript from directly reading the cookie. This limits what a malicious script on the page can do with it.- An appropriate
SameSitesetting, such asLaxorStrictwhen compatible with the application's requirements.SameSitecontrols whether the browser sends the cookie on cross-site requests.
SameSite is a useful defence-in-depth control, but its protection depends on the configuration and request context. It should not be treated as a universal substitute for appropriate CSRF defences. Defence in depth means layering several protections so that one failing does not open the door.
Validate the request origin
For relevant requests, validate the Origin header and, where appropriate, use the Referer header as an additional signal. Reject requests from unexpected origins according to a clearly defined policy. The Referer header tells the server which page the request came from, so it can be used as a second opinion.
Invalidate sessions server-side
When a user logs out, the server should invalidate the associated session or authentication credentials. Merely redirecting the browser to a login page does not necessarily terminate the underlying session. Think of it as taking the wristband off at the desk rather than just walking away from the door: if the wristband still works, the session is still alive.
8. Lessons from this finding
This test reinforced an important lesson: small implementation details can still reveal gaps in an application's security controls. Logout functionality is often treated as routine application behaviour, but it is part of the authentication lifecycle and deserves attention during security assessments.
At the same time, responsible vulnerability reporting requires more than identifying a missing security mechanism. A valid report should demonstrate the actual behaviour, explain the conditions required to reproduce it, and describe the impact without making unsupported claims.
For logout CSRF in particular, the difference between a theoretical weakness and an accepted security finding often comes down to reproducibility, browser behaviour, application context, and the program's severity criteria. Reproducibility means someone else can follow your steps and see the same result.
Conclusion
Testing the logout endpoint revealed a potential weakness in how the application protected session termination against cross-site requests. For security researchers, the goal is to provide clear evidence and a realistic impact assessment. For developers, the goal is to ensure that authentication-related state changes follow secure request-handling practices.
Responsible disclosure and accurate severity assessment are just as important as discovering the vulnerability itself. Responsible disclosure means telling the owner privately and giving them time to fix it, rather than publishing details that could be misused.
If you are learning this, these are the variations the write-up lists. Each one is a different way the same idea can show up.
- Logout over
GET. Request the logout URL directly from another origin, for example with the image pattern above. A positive result is that the victim's authenticated session is no longer usable afterwards. - Logout over
POSTwithout a token. Submit the form pattern above from a separate origin. A positive result is the same: the server processes the logout and the session is terminated. - Token present but not validated. Remove or alter the anti-CSRF token in the captured request and replay it. A positive result is that the server still processes the logout, showing the token is not checked server-side. Replaying means sending the same request again, possibly with changes.
- Cookie attribute review. Inspect the session cookie for
Secure,HttpOnlyandSameSite. A positive result for the attacker is a session cookie without a restrictiveSameSitesetting, which makes cross-site delivery of the authentication context more likely. - Origin and Referer handling. Send the request with an unexpected
Originand withRefererremoved or altered. A positive result is that the server processes the logout anyway, showing origin validation is absent or ineffective. - Server-side session invalidation. After a logout, replay the old session cookie. A positive result is that the old session still works, meaning logout only redirected the browser rather than terminating the session.
For each variant, the researcher's validation criteria apply: the request must come from a separate origin, the browser must send the authentication context if its cookie policy permits, the server must process the request as a logout, and the previously authenticated session must no longer be usable. Anything short of that is a theoretical weakness, not a confirmed finding.
Glossary
- Anti-CSRF token: a secret value included in a request so the server can tell a genuine request from a forged one.
- Authentication: the process of proving who you are, usually by signing in.
- Availability: whether a service or session can be used when you need it. Logout CSRF mainly affects this.
- Browser cookie policy: the rules a browser follows about when to store and send cookies, including on cross-site requests.
- Burp Suite: a tool that sits between your browser and a website so you can inspect and modify the traffic.
- Cookie: a small piece of data a website stores in your browser and gets back on later requests, often used to remember your session.
- Cross-site: coming from a different origin than the one being requested.
- CSRF (Cross-Site Request Forgery): a weakness where an attacker's page makes your browser send a request to a site where you are signed in, and the site acts on it as if you had asked.
- CVSS: a scoring system that turns a set of attack characteristics into a number for comparing vulnerabilities.
- CWE: a public catalogue of weakness types; CWE-352 is the entry for CSRF.
- Defence in depth: layering several protections so that one failing does not open the door.
- Endpoint: a specific address on a server that performs one job, such as
/logout. - Forced session termination: ending a user's signed-in session without their consent.
- GET: an HTTP method normally used to ask for a page or resource.
- HTTP method: the verb of a request, such as
GETorPOST, saying what kind of action is intended. - HttpOnly: a cookie attribute that stops JavaScript from reading the cookie directly.
- Informational / Low: severity labels for findings that are minor or have limited demonstrated impact.
- Origin: the combination of scheme, host and port a page comes from, for example
https://target.com. - Origin header: a header the browser sets to say where a request came from, which the server can check.
- OWASP: a community project that publishes security guidance and lists of common risks.
- POST: an HTTP method normally used when sending data that should change something on the server.
- Proof of concept: a small, safe demonstration that a bug is real rather than theoretical.
- Referer header: a header that tells the server which page a request came from.
- Replay: sending a captured request again, possibly with changes.
- Reproducibility: the property that someone else can follow your steps and see the same result.
- Responsible disclosure: telling the owner of a system privately about a bug and giving them time to fix it before details are published.
- SameSite: a cookie attribute that controls whether the browser sends the cookie on cross-site requests.
- Secure: a cookie attribute that makes the browser send the cookie only over HTTPS.
- Server-side validation: checking a request on the server, rather than trusting what the browser or page claims.
- Session: the period during which a website remembers who you are after you sign in.
- Session cookie: the cookie that carries the session identifier so the server can recognise you.
- Session lifecycle: the stages of a session: how it is created, kept alive, and ended.
- Severity: a rough label for how serious a finding is, often set by the bug bounty program's policy.
- Token: a value used to prove something about a request, such as that it came from the real page.
- Vulnerability: a weakness in a system that could be used to cause harm.
- Web security assessment: an authorised test of a system's security, done with permission.