CSRF to Delete a Pet — How I Found a Vulnerability in the `/pets/delete` Endpoint
The /pets/delete endpoint lacked CSRF protection on both GET and POST requests, so an attacker could trick a logged-in user into submitting a form that deleted a pet from their account.
On February,I reported an interesting Cross-Site Request Forgery (CSRF) vulnerability .What made this bug unique was the impact — it allowed an attacker to delete a pet from a user’s account without their consent.
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 endpoint accepted state-changing requests without a CSRF token or origin check, and also allowed GET requests to perform deletion.
Impact
An attacker could delete any pet from a victim's account with a single click, requiring only that the victim was authenticated; the text rates severity as low.
What the attacker needed
Victim is logged in; victim visits attacker's page
How it was found
- Create a page with a form that posts to the pet deletion endpoint, including the target pet's identifier.
- Trick a logged-in victim into visiting that page.
- The form submits automatically or after a click, and the pet is deleted.
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.
CSRF (Cross-Site Request Forgery) is when a malicious website makes a logged-in user's browser send a request to another site without the user knowing. Here, the pet-deletion page accepted such requests without checking they came from the real site, so visiting a bad page could delete a pet.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.