Skip to content
CSRF Write-up Beginner

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.

dr34m14 Follow

Published on dr34m14.medium.com

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.

dr34m14, on dr34m14.medium.com

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

  1. Create a page with a form that posts to the pet deletion endpoint, including the target pet's identifier.
  2. Trick a logged-in victim into visiting that page.
  3. 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.

More by dr34m14

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.