OpenRedirect + CSRF Leads To Forced Victime to login as Attacker Account
The login flow lacked a CSRF token and trusted an unvalidated returnUrl parameter, so an attacker could craft a page that logs a victim into the attacker's account. The author claims this forced the victim to act under the attacker's account, though the write-up gives few concrete details.
Published on medium.com
Bug Bounty
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.
Context
This is a short write-up by Amine Amrouch about a paid finding he describes as an open redirect combined with CSRF in an authentication flow. The report does not name the target program, the product or the specific feature beyond the authentication and redirect behaviour it describes. What it does say is that the flow involves a returnUrl parameter and an endpoint that accepts a POST parameter carrying an access token, and that the response sets account cookies.

The author frames the finding as an $800 bounty for CSRF plus open redirect, and characterises the underlying problem as developers forgetting guard tokens and trusting whatever returnUrl value is supplied.
Setup
The report does not describe a lab, tooling, versions or a test account setup. The only precondition it mentions is the researcher's starting habit: clearing out cookies so that the authentication cookie can be set cleanly, which is how he first inspected the flow.
Finding it
The researcher describes two observations made while looking at the authentication flow.
- After removing the useless cookies and setting the authentication cookie, he noticed that the CSRF token was not present. He anticipates the reader's objection that forcing a victim to log in as the attacker is a common weakness in authentication flows, and notes that developers usually protect those functions with state tokens. In this case, he says, the token was missing.
- He then found an open redirect in the
returnUrlparameter, which he says is not validated and is trusted as client-side input. He expresses surprise that this happens on such sites.
He also notes that the endpoint involved takes a POST parameter with an access token, and that the response contains a set-cookie header tying the account cookies to that access.
Exploitation
Step 1: Combine the two issues into a scenario
The missing CSRF protection on the authentication endpoint and the unvalidated returnUrl are combined into a scenario in which a victim is forced to log in as the attacker's account. The researcher says he built two CSRF HTML proofs of concept for this.
Step 2: Redirect the victim through the vulnerable redirect
The flow he describes is that the victim is sent to the vulnerable redirect endpoint with a returnUrl pointing at the CSRF HTML page, which then redirects to the account profile:
Are Redirected to Vulrnable/Redirect?ReturnUrl=CSRF-HTML==> Redirect to Account/Profile
In other words, the crafted returnUrl value causes the redirect endpoint to send the victim to the attacker-hosted CSRF page, and from there the flow lands on the account profile. The report does not include the full HTML of either proof of concept, the exact URL of the redirect endpoint, or the POST body used against the token-accepting endpoint.
Root cause
Two design mistakes combine here, as the report presents them:
- The authentication endpoint that accepts the access token as a POST parameter does not require a CSRF token, so a cross-site request can drive a login without the victim's consent.
- The
returnUrlparameter is not validated and is trusted as client-side input, so it can point anywhere, including an attacker-controlled page.
Because the login response sets the account cookies for whichever account the access token belongs to, a forged request logs the victim's browser into the attacker's account.
Impact
The consequence described is that a victim is forced to log in as the attacker's account. The report does not go further into what the attacker gains afterwards, such as data the victim might enter while believing they are in their own account. The report describes only the outcome, a victim forced to log in as the attacker's account, and does not set out the preconditions.
Fix
The defences it names as the expected norm are state tokens on the authentication functions and validation of the returnUrl value rather than trusting client-side input.
Variants to test
- Look for authentication endpoints that accept a token or credential as a request parameter and check whether a CSRF token is required. A positive result is a login response that sets account cookies when the request carries no anti-CSRF token.
- Test
returnUrl,redirect_uriand similar parameters with an external host. A positive result is a redirect to that host rather than to the application. - Chain the two: point the redirect parameter at a page you host that submits the token-bearing request. A positive result is the victim's browser ending up authenticated as your account.
- Check whether the login response's
set-cookieheaders bind the session to the submitted token. A positive result is account cookies issued for the token's account regardless of who sent the request.
What happened, in plain words
A security researcher, Amine Amrouch, found a way to make someone else's browser log in to his account without that person realising it. He describes it as an open redirect combined with CSRF, and says it earned an $800 bounty. The report does not name the company, the product or the exact page involved; it only describes the behaviour of the login flow.
The trick relies on two separate mistakes in the same login flow:
- The login step that accepts an access token does not ask for a CSRF token, so another website can trigger it on the victim's behalf.
- A parameter called
returnUrlis not checked, so it can send the victim's browser to any address, including a page the attacker controls.
Put together, the victim is sent to the real site's redirect endpoint, which sends them on to the attacker's CSRF page, and the flow ends on the account profile. The victim's browser ends up holding the attacker's account cookies, so the victim is now logged in as the attacker.

The author introduces himself as a 20-year-old from Morocco who has been studying bug bounty web application testing for eight months, and says this was his first paid bug.
Background: the pieces you need to know
Before following the steps, here are the everyday ideas behind the words used in the report.
- Cookie: a small piece of text a website asks your browser to store and send back on every later request. It is how a site remembers that you are logged in. Think of it as a wristband you get at an event: show it at the door and you are let in without showing your ID again.
- Authentication cookie: the specific cookie that proves who you are. If someone else's browser gets your authentication cookie, that browser is you as far as the site is concerned.
- Token: a short string of characters that stands for something, usually a permission or an identity. An access token here is a value that, when submitted to the login endpoint, tells the site which account to log in.
- CSRF token (also called a state token or anti-CSRF token): a secret, unpredictable value that the real site puts into its own pages and expects back when a form is submitted. Because another website cannot guess it, a request coming from another site will not carry it, and the server can refuse the request. Think of a cloakroom ticket: only the person who was handed the ticket can collect the coat.
- CSRF (Cross-Site Request Forgery): an attack where a page on one site makes your browser send a request to another site, using the cookies your browser already has for that other site. The other site sees a normal logged-in request and cannot tell that you did not mean to send it.
- Open redirect: a feature that takes a destination address from the URL and sends the visitor there, without checking that the destination belongs to the same site. If the address can be anything, an attacker can use the trusted site as a springboard to their own page.
returnUrlparameter: the name of the parameter in this flow that holds the address to send the user to afterwards. The report says it is not validated and is trusted as client-side input.- POST parameter: a value sent in the body of an HTTP request rather than in the URL. Forms use POST when they submit data, for example a login form.
set-cookieheader: a line in the server's response that tells the browser to store a cookie. This is how a login response hands the browser its authentication cookie.- Endpoint: a specific address on a server that does one job, such as "log in" or "redirect".
- Proof of concept (PoC): a small, working demonstration that the bug is real, usually a page or a script that triggers it.
Setup
The report does not describe any lab, tool, version or test account. The only starting habit it mentions is the researcher's own: he clears out cookies so that the authentication cookie can be set cleanly, and that is how he first looked at the flow. Clearing cookies is like taking off all the old wristbands before testing how a new one is issued: you see exactly which response hands one out and what it contains.
Finding it
The researcher describes two observations made while looking at the authentication flow.
- After removing the useless cookies and setting the authentication cookie, he noticed that the CSRF token was not present. He expects readers to object that forcing a victim to log in as the attacker is a common weakness in authentication flows, and he notes that developers usually protect those functions with state tokens. In this case, the token was missing.
- He then found an open redirect in the
returnUrlparameter, which he says is not validated and is trusted as client-side input. He says he was surprised that this happens on such sites.
He also notes that the endpoint involved takes a POST parameter with an access token, and that the response contains a set-cookie header tying the account cookies to that access.
Exploitation
Step 1: Combine the two issues into a scenario
The missing CSRF protection on the authentication endpoint and the unvalidated returnUrl are combined into a scenario in which a victim is forced to log in as the attacker's account. The researcher says he built two CSRF HTML proofs of concept for this. The report says two CSRF HTML proofs of concept were created but does not show or describe their contents.
Step 2: Redirect the victim through the vulnerable redirect
The flow he describes is that the victim is sent to the vulnerable redirect endpoint with a returnUrl pointing at the CSRF HTML page, which then redirects to the account profile:
Are Redirected to Vulrnable/Redirect?ReturnUrl=CSRF-HTML==> Redirect to Account/Profile
Line by line, in plain words:
Are Redirected to Vulrnable/Redirect?ReturnUrl=CSRF-HTMLmeans the victim's browser is sent to the site's redirect endpoint, and thereturnUrlparameter is set to the address of the attacker's CSRF HTML page. Because the endpoint does not check wherereturnUrlpoints, it obeys and sends the victim there.==> Redirect to Account/Profilemeans that after the CSRF page has done its work, the flow lands on the account profile page. In other words, the craftedreturnUrlvalue causes the redirect endpoint to send the victim to the attacker-hosted CSRF page, and from there the flow ends up on the account profile.
The report does not include the full HTML of either proof of concept, the exact URL of the redirect endpoint, or the POST body used against the token-accepting endpoint.
Root cause
Two design mistakes combine here, as the report presents them:
- The authentication endpoint that accepts the access token as a POST parameter does not require a CSRF token, so a cross-site request can drive a login without the victim's consent.
- The
returnUrlparameter is not validated and is trusted as client-side input, so it can point anywhere, including an attacker-controlled page.
Because the login response sets the account cookies for whichever account the access token belongs to, a forged request logs the victim's browser into the attacker's account.
Impact
The consequence described is that a victim is forced to log in as the attacker's account. The report does not go further into what the attacker gains afterwards, such as data the victim might enter while believing they are in their own account. The report describes only the outcome, a victim forced to log in as the attacker's account, and does not set out the preconditions.
Fix
The defences it names as the expected norm are state tokens on the authentication functions and validation of the returnUrl value rather than trusting client-side input.
Variants to test
- Look for authentication endpoints that accept a token or credential as a request parameter and check whether a CSRF token is required. A positive result is a login response that sets account cookies when the request carries no anti-CSRF token.
- Test
returnUrl,redirect_uriand similar parameters with an external host. A positive result is a redirect to that host rather than to the application. - Chain the two: point the redirect parameter at a page you host that submits the token-bearing request. A positive result is the victim's browser ending up authenticated as your account.
- Check whether the login response's
set-cookieheaders bind the session to the submitted token. A positive result is account cookies issued for the token's account regardless of who sent the request.
Glossary
- Access token: a value that, when submitted to the login endpoint, tells the site which account to log in.
- Authentication cookie: the cookie that proves to a site which account a browser is logged in as.
- Cookie: a small piece of text a site asks the browser to store and send back on later requests, used to remember state such as a login.
- CSRF (Cross-Site Request Forgery): an attack where a page on one site makes the victim's browser send a request to another site using the victim's existing cookies there.
- CSRF token (state token, anti-CSRF token): an unpredictable secret value that the real site expects back with a form submission, so that requests coming from other sites can be refused.
- Endpoint: a specific address on a server that performs one job, such as logging in or redirecting.
- Open redirect: a feature that sends the visitor to an address taken from the URL without checking that the address belongs to the same site.
- Proof of concept (PoC): a small working demonstration that a bug is real.
returnUrlparameter: the parameter in this flow that holds the address to send the user to afterwards; the report says it is not validated.set-cookieheader: a line in a server response that tells the browser to store a cookie.- Token: a short string of characters that stands for a permission or an identity.