Skip to content
Account takeover Write-up Intermediate

Session fixation | Cookie injection leading to ATO Write-Up

The application did not issue a new session cookie after login, so a pre-authentication session ID was upgraded to an authenticated one. A separate endpoint allowed injecting arbitrary cookies for the whole domain via an unsanitised parameter, letting an attacker fix a victim's session and later take over the account.

infosecwriteups.com

Published on infosecwriteups.com

There are numerous ways you can handle an authorization on your website. From session-based authentication to token-based authorization, any method you consider to use has to be properly configured or else the whole application might become prone to potential account takeovers.

rAmpancist, on infosecwriteups.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 application reused the pre-authentication session identifier after login instead of generating a new one, and a cookie-setting endpoint failed to sanitise the cookie name parameter.

Impact

An attacker could take over a victim's account, including high-privilege panels, if the victim followed the crafted link and logged in.

What the attacker needed

Victim clicks a crafted link; victim logs in afterwards; attacker can reach the opt-out endpoint

The fix

The application should issue a new session identifier after authentication and sanitise the cookie name parameter to prevent cookie injection.

How it was found

  1. Attacker visits the login site and obtains an unauthenticated session cookie.
  2. Attacker places that session ID in a crafted link to the opt-out endpoint.
  3. Victim opens the link, which sets the attacker's session cookie in the victim's browser.
  4. Victim logs in through the normal login page.
  5. Attacker visits the panel and finds the session is now authenticated.

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 session cookie is like a wristband that proves you are logged in. Normally a site gives you a fresh wristband when you log in, but here it kept the old one and simply marked it as logged in. A second bug let the attacker put their own wristband on the victim's browser, so when the victim logged in, the attacker's wristband became valid too.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.