CSRF To 1-Step Account Takeover
The session cookie was set with SameSite=None, allowing cross-site requests to include it, and the email change endpoint accepted form-encoded POST requests without CSRF protection or verification of the original email. An attacker could change a victim's account email to an attacker-controlled address, leading to account takeover.
medium.com
Published on medium.com
During the review of the client’s HTTP traffic, I observed that the SESSIONIDcookie is configured with SameSite=None. This configuration allows the cookie to be included in cross-site requests, thereby making the application susceptible to CSRF attacks, including those performed via the POST method.
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
The session cookie was set with SameSite=None and the email change endpoint lacked CSRF protections and did not require verification of the original email address.
Impact
An attacker could change a victim's account email to an attacker-controlled address, leading to account takeover, as no verification from the original email was required.
What the attacker needed
Victim is logged in; victim visits attacker's page
The fix
The application should set the session cookie with SameSite=Lax or Strict, implement CSRF tokens or origin checks, and require verification of the original email before changing it.
How it was found
- Observe that the session cookie is set with SameSite=None.
- Find the email change feature that does not require verification from the old email.
- Intercept the email change request and note it uses multipart/form-data but also accepts application/x-www-form-urlencoded.
- Craft a malicious HTML page that auto-submits a POST form to the email change endpoint with the attacker's email.
- Host the page and trick a logged-in victim into visiting it.
- The request is processed, changing the victim's email to the attacker's address.
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.
A website uses a cookie to remember that you are logged in. If that cookie is sent with requests from other websites, an attacker can make your browser perform actions on your behalf without you knowing. Here, the attacker could change the email address on your account to one they control, and then use that to take over your account.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.