Skip to content
CSRF Write-up Intermediate

When SameSite=Strict Fails: A Real CSRF Bypass Using Redirects

The site's email-change endpoint accepted GET requests and a user-controlled postId parameter in a comment confirmation redirect allowed internal redirection to that endpoint. An attacker could craft a link that, when visited by a logged-in victim, changed their email despite SameSite=Strict cookies.

medium.com

Published on medium.com

In this article, we will understand CSRF Lab 8 from the Web Security Academy by PortSwigger.

Istiyak, on 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 email-change endpoint accepted GET requests and a user-controlled postId parameter allowed a client-side redirect to an internal path, so the request appeared same-site to the browser.

Impact

An attacker could change a logged-in victim's email address, which may lead to account takeover, although the text does not demonstrate the full takeover chain.

What the attacker needed

Victim is logged in; victim visits attacker link

The fix

The email-change endpoint should not accept GET requests and the redirect parameter should be validated to prevent internal path traversal.

How it was found

  1. Log in using the lab credentials.
  2. Open a blog post, add a comment, and intercept the request in Burp Suite.
  3. Send the request to Repeater and replace the path with a crafted postId value that redirects to the email-change endpoint.
  4. Send the request and confirm a 302 Found response.
  5. Deliver the final payload to the victim.

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.

SameSite=Strict is a browser setting that stops a website's login cookie from being sent when you click a link from a different site, which normally blocks cross-site request forgery (CSRF) attacks. Here, a page on the same site redirected to the email-change page, so the browser still sent the cookie and the change went through.

What is CSRF?

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

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.