Thought CSRF Was Extinct? Think Again.
A project-deletion endpoint accepted JSON bodies without a CSRF token, and the server also accepted the same body sent as text/plain, so a cross-site form could delete a victim's project. The session cookie was set with SameSite=None, so it was sent on cross-site requests, and the Referer header was not checked.
Published on medium.com
In this write-up, I’ll walk you through how I discovered a Cross-Site Request Forgery (CSRF) vulnerability in a web application. This issue allowed me to delete projects on behalf of any authenticated user — without their knowledge or interaction
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the delete endpoint had no CSRF token, accepted text/plain bodies as JSON, did not validate the Referer header, and the session cookie used SameSite=None.
Impact
An attacker could delete any authenticated user's project without their knowledge, if the attacker knows the project id, which may be exposed when the victim publishes the site.
What the attacker needed
Victim is logged in; attacker knows victim's project id; victim visits attacker page
The fix
The endpoint should require a CSRF token, reject non-JSON content types, validate the Origin or Referer header, and set the session cookie to SameSite=Lax or Strict.
How it was found
- Create an account and a new project.
- Build an HTML page that posts a text/plain form to the delete endpoint with the victim's project id.
- Host the page and send the link to a victim.
- The victim's project is deleted and the response shows success.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Websites often rely on a secret token in each form to prove a request came from their own pages. Here that token was missing, and the site also accepted a request format that a page on another site can send. So a page the attacker controls could quietly tell the site to delete a logged-in visitor's project.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.