Skip to content
Open redirect Write-up Beginner

How a Logout Endpoint Led to an Open Redirect Vulnerability

The logout endpoint accepted a user-controlled redirect_to parameter and redirected the browser to an arbitrary external URL. An attacker could craft a link starting with the trusted domain that sends users to a phishing site.

Samadhan shimple Follow

Published on radiohackers.com

Cybersecurity

Samadhan shimple, on radiohackers.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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

A logout endpoint is one of the least scrutinised parts of a web application. Users expect it to end their session and return them to a login page, and they rarely think about where the application sends them afterwards. This write-up looks at a logout URL that accepted a parameter named redirect_to, and at what happened when that parameter was given an external destination.

The endpoint under test is /api/logout, and the report uses example.com to stand for the application's domain. The report does not describe the application's normal post-logout behaviour beyond the expectation that a user is taken back to a login page. The finding is classified as Open Redirect, also known as an unvalidated redirect, mapped to CWE-601: URL Redirection to Untrusted Site ('Open Redirect'). No severity score or bounty amount is given.

This image is a AI Generated From the original on radiohackers.com

The image is a generated illustration for the article; it carries no technical content.

Setup

The report does not describe any accounts, roles, tools or software versions. The researcher modified the value of redirect_to and observed where the browser was sent. The only precondition stated is that the logout endpoint accepts a redirect_to parameter at all.

Finding it

While testing the application, the researcher looked at a logout URL that accepted a parameter named redirect_to. That detail stood out because redirect parameters become a security problem when an application does not validate their values properly.

The working method described is not to assume that every parameter behaves as its name suggests, but to change its value and watch what changes. In this case the question was whether the application restricted redirects to its own domain or accepted external destinations. A controlled test URL was used to check how an external redirect target was handled.

Exploitation

Step 1: Send the logout request with an external destination

The request used for the test was:

HTTP
GET /api/logout?redirect_to=https://evil.com HTTP/1.1Host: example.com

The important part is the value supplied to redirect_to. In the example, example.com stands for the application's domain and evil.com stands for an external destination used for testing. A secure implementation should validate that value before using it in a redirect response; accepting a URL simply because it appeared in a request is not sufficient.

Step 2: Observe the redirect response

The application redirected the browser to the external destination supplied in the parameter. The relevant response is shown as:

HTTP
HTTP/1.1 302 FoundLocation: https://evil.com

The 302 Found status indicates a temporary redirect, and the Location header specifies the destination. This confirmed the open redirect condition in the tested scenario: the application accepted an external redirect destination instead of restricting the user to an approved location.

Root cause

The problem is not the logout functionality itself. It is that the application trusts a destination supplied by the user without restricting where that destination can lead. The redirect_to parameter appears to control where the browser goes after the logout request, and when an arbitrary external URL is accepted, the destination is effectively controlled by whoever creates the link.

What the observed behaviour implies is that no effective check on the destination was applied before the Location header was built.

Impact

At first glance this does not look serious: the user is visiting a logout endpoint, not accessing private information, changing account settings or performing a sensitive operation. The concern is trust. The domain shown in a link influences whether someone trusts it, and a user may recognise the application's domain and assume the whole link leads to a legitimate page. An attacker could share a link that begins with the legitimate domain but redirects to an unrelated external site. A user might see the trusted domain in a message, click, and arrive at a fake login page hosted elsewhere. The redirect itself does not steal credentials, but it can make a phishing attempt more convincing.

The report is explicit about the limits. An open redirect can support a phishing attack, but it does not automatically mean credential theft, account takeover or token leakage has occurred. The confirmed concern for a logout endpoint is the ability to redirect a user from a trusted domain to an arbitrary external destination. Potential consequences listed are:

  • Phishing support: the trusted domain may make a malicious link appear more legitimate.
  • Trust abuse: an attacker can use the application's domain as the starting point of a redirect.
  • Security control weaknesses: redirects may create problems for systems that rely on trusted-domain checks, depending on how those checks are implemented.
  • Authentication-flow risks: if similar redirect behaviour exists in OAuth, SSO or other sensitive workflows, the impact could be greater.

The last point needs care. A redirect vulnerability in a logout endpoint does not prove that OAuth tokens, authorisation codes or session credentials can be stolen; those outcomes require separate evidence that sensitive information is exposed or that another control can be bypassed. The report recommends focusing on the demonstrated behaviour: an externally controlled redirect after logout.

On severity, the report argues that for a logout-only endpoint where the main impact is trust abuse and phishing support, Low severity may be more appropriate under some bug bounty programs, and that a program may classify the issue as informational or decline it if its policy excludes standalone open redirects. Assigning High severity based only on a possible combination with OAuth, SSO or token leakage is not justified without testing and evidence.

Fix

The report describes recommended fixes rather than changes that were made.

  1. Allow only approved destinations. Accept relative paths such as /login or /dashboard when the application only needs internal redirects. If external destinations are required, use a strict allowlist of approved hosts rather than accepting arbitrary URLs.
  2. Validate the destination on the server. Parse the URL and verify its scheme, hostname and other relevant components before sending the redirect response. Checking only whether the string contains the trusted domain is not sufficient: in https://[redacted] the hostname is evil.com, even though the trusted domain appears in the URL.
  3. Handle unusual URL formats carefully. Consider scheme-relative URLs, backslashes, encoded characters and differences between URL parsers. Validation must match how the application ultimately interprets the URL, otherwise a value that looks safe in a string check may still resolve to an untrusted destination.
  4. Use a fixed destination after logout. If customisable destinations are not needed, remove the user-controlled parameter and send the user to a predefined location such as /login.

Variants to test

The report frames open redirect testing around three questions: can you control the destination, does the server actually redirect to an untrusted external destination, and what impact can you demonstrate beyond the redirect itself.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

A security researcher was testing a website, referred to in the report as example.com. Like most websites, it has a logout button: the place you go when you want to sign out. Normally, when you log out, the site ends your session and sends you back to a login page.

But this logout page had an extra feature. Its web address could carry a small piece of information called a redirect_to parameter, which tells the site where to send you after you log out. The researcher changed that value to point at a completely different website, and the site obeyed: it sent the browser to that outside address.

That behaviour has a name: an open redirect. It means the site will forward visitors to any destination someone puts in the link, including destinations the site does not control. On its own it does not steal passwords or break into accounts, but it can make a scam link look far more trustworthy, because the link starts with the real site's address.

The finding is classified as Open Redirect, also known as an unvalidated redirect, and mapped to CWE-601: URL Redirection to Untrusted Site ('Open Redirect'). No severity score or bounty amount is given.

This image is a AI Generated From the original on radiohackers.com

The image is a generated illustration for the article; it carries no technical content.

Some words you will need first

Before the details, a handful of everyday ideas. None of them require any security background.

  • A web address (URL) is the text you type in the browser's address bar, like https://example.com/login. It has parts: the https bit is the scheme (the rules for how to talk to the site), example.com is the host (which computer to talk to), and /login is the path (which page on that computer).
  • A parameter is extra information stuck on the end of an address after a question mark. In ?redirect_to=https://evil.com, the parameter's name is redirect_to and its value is https://evil.com. Think of it like the note you write in the "special instructions" box of a food order: the kitchen reads it and acts on it.
  • An endpoint is a specific address on a server that does one job. /api/logout is the endpoint whose job is to log you out. Think of a building with many doors, each labelled with what happens behind it.
  • An API is the part of a website that programs talk to, rather than people clicking buttons. When your browser loads a page, it is often quietly asking an API for data. The /api/ in the address is a hint that this door is meant for that kind of request.
  • A request is the message your browser sends to a server asking for something. A response is the message the server sends back.
  • A status code is a three-digit number in the response that says how it went. 200 means "here is your page". 302 means "not here, go somewhere else instead".
  • A header is a labelled line in a request or response carrying extra details, a bit like the address block on an envelope. The Location header is the one that says where to go next.
  • A cookie or token is a small piece of data the site gives your browser to remember who you are, like a cloakroom ticket. You show it on each visit so the site knows you are already signed in. Logging out normally throws the ticket away.
  • A redirect is the server telling your browser "go to this other address instead". Your browser follows it automatically, usually without you noticing.
  • An open redirect is a redirect where the destination is chosen by whoever made the link, not by the site. The site acts as a helpful signpost to anywhere at all.
  • Phishing is a scam where someone pretends to be a trusted site to trick you into typing your password. A fake login page is the classic example.
  • Severity is how serious a finding is judged to be, usually from informational (barely a problem) up to critical.

The setup

The report does not describe any accounts, roles, tools or software versions. The researcher changed the value of redirect_to and watched where the browser was sent. The only precondition stated is that the logout endpoint accepts a redirect_to parameter at all.

Finding it

While testing the application, the researcher looked at a logout URL that accepted a parameter named redirect_to. That detail stood out because redirect parameters become a security problem when an application does not check their values properly.

The method described is simple and worth copying: do not assume a parameter does what its name suggests. Change its value and watch what changes. Here the question was whether the site only allowed redirects back to its own pages, or whether it would accept an outside address. A controlled test address was used to see how an external destination was handled.

Why bother? Because a parameter that says "where should I send you next" is effectively a request from a stranger. If the site trusts that request blindly, the stranger decides where visitors end up.

Trying it out

Step 1: Send the logout request with an outside destination

The request used for the test was:

HTTP
GET /api/logout?redirect_to=https://evil.com HTTP/1.1Host: example.com

Line by line, in plain words:

  • GET /api/logout?redirect_to=https://evil.com HTTP/1.1 is the request itself. GET means "please fetch this for me". /api/logout is the endpoint being asked. ?redirect_to=https://evil.com is the parameter and its value: the researcher is asking the logout endpoint to send them to https://evil.com afterwards. HTTP/1.1 is simply the version of the request language being used.
  • Host: example.com tells the server which website the request is for. In the example, example.com stands for the application's own domain, and evil.com stands for an outside destination used only for testing.

The important part is the value given to redirect_to. A safe implementation should check that value before using it in a redirect. Accepting an address just because it appeared in a request is not enough, in the same way a receptionist should not let anyone into any office just because they asked politely.

Step 2: Watch the response

The application redirected the browser to the outside destination supplied in the parameter. The relevant response is shown as:

HTTP
HTTP/1.1 302 FoundLocation: https://evil.com

Again, line by line:

  • HTTP/1.1 302 Found is the server's reply. 302 Found is the status code meaning "the thing you asked for is not here; go somewhere else instead". It is a temporary redirect, not a permanent one.
  • Location: https://evil.com is the header that says exactly where to go. The browser reads it and follows it automatically.

This confirmed the open redirect in the tested scenario: the application accepted an outside destination instead of keeping the user on an approved page. Changing one value in the address and watching where the browser landed was enough to confirm the behaviour.

Why it happens

The problem is not the logout feature itself. It is that the application trusts a destination supplied by the user without limiting where that destination can lead. The redirect_to parameter appears to control where the browser goes after the logout request, and when any outside address is accepted, the destination is effectively chosen by whoever creates the link.

The report does not show the server-side code, so the exact checking logic, or its absence, is not visible. What the observed behaviour implies is that no effective check on the destination was applied before the Location header was built.

Why a logout redirect matters

At first glance this does not look serious. The user is visiting a logout endpoint, not reading private information, changing account settings or doing anything sensitive.

The concern is trust. The domain shown in a link influences whether someone trusts it. A user may recognise the application's domain and assume the whole link leads to a legitimate page. An attacker could share a link that begins with the real domain but redirects to an unrelated outside site. A user might see the trusted domain in a message, click, and arrive at a fake login page hosted elsewhere. The redirect itself does not steal credentials, but it can make a phishing attempt far more convincing.

The report is explicit about the limits. An open redirect can support a phishing attack, but it does not automatically mean credential theft, account takeover or token leakage has occurred. The confirmed concern for a logout endpoint is the ability to send a user from a trusted domain to an arbitrary outside destination. The potential consequences listed are:

  • Phishing support: the trusted domain may make a malicious link appear more legitimate.
  • Trust abuse: an attacker can use the application's domain as the starting point of a redirect.
  • Security control weaknesses: redirects may create problems for systems that rely on trusted-domain checks, depending on how those checks are implemented.
  • Authentication-flow risks: if similar redirect behaviour exists in OAuth, SSO or other sensitive workflows, the impact could be greater.

The last point needs care. A redirect vulnerability in a logout endpoint does not prove that OAuth tokens, authorisation codes or session credentials can be stolen. Those outcomes need separate evidence that sensitive information is exposed or that another control can be bypassed. The report recommends focusing on the demonstrated behaviour: an externally controlled redirect after logout.

On severity, the report argues that for a logout-only endpoint where the main impact is trust abuse and phishing support, Low severity may be more appropriate under some bug bounty programs, and that a program may classify the issue as informational or decline it if its policy excludes standalone open redirects. Assigning High severity based only on a possible combination with OAuth, SSO or token leakage is not justified without testing and evidence.

How to fix it

The report describes recommended fixes rather than changes that were made.

  1. Allow only approved destinations. Accept relative paths such as /login or /dashboard when the application only needs internal redirects. A relative path is one that stays on the same site, like telling someone "go to room 12" rather than giving them a street address anywhere in the world. If outside destinations are genuinely required, use a strict allowlist of approved hosts rather than accepting arbitrary addresses.
  2. Validate the destination on the server. Parse the address and verify its scheme, hostname and other relevant parts before sending the redirect response. Checking only whether the text contains the trusted domain is not sufficient: in https://[redacted] the hostname is evil.com, even though the trusted domain appears in the address. The part before the @ is a username, not the host, which is exactly the kind of detail a careless text check misses.
  3. Handle unusual address formats carefully. Consider scheme-relative addresses, backslashes, encoded characters and differences between address parsers. Validation must match how the application ultimately interprets the address, otherwise a value that looks safe in a text check may still resolve to an untrusted destination.
  4. Use a fixed destination after logout. If customisable destinations are not needed, remove the user-controlled parameter and send the user to a predefined location such as /login. The simplest fix is often to stop asking the question at all.

Things to try on other sites

The report frames open redirect testing around three questions: can you control the destination, does the server actually redirect to an untrusted outside destination, and what impact can you demonstrate beyond the redirect itself.

Lessons for anyone starting out

This test is a useful reminder that security testing is not only about finding complicated bugs. Small parameters can reveal big assumptions in a site's design. A redirect parameter may look harmless, but its safety depends on how the server checks and uses the value.

When investigating a possible open redirect, answer three questions:

  1. Can I control the destination?
  2. Does the server actually redirect to an untrusted outside destination?
  3. What impact can I demonstrate beyond the redirect itself?

The third question matters most. A technically valid vulnerability and a reportable bug bounty finding are not always the same thing. Understanding the difference helps produce better reports, supports more accurate severity ratings, and avoids overstating what a proof of concept actually shows.

Final thoughts

An open redirect in a logout endpoint may appear minor, but it is worth investigating because it shows how an application handles destinations supplied by users. The key is to report what the evidence proves. If the browser is redirected to an arbitrary outside address, document the request, the response and the resulting behaviour. Then explain the realistic risks without claiming an account takeover or credential leak that has not been demonstrated.

For developers, strict redirect validation or a fixed post-logout destination can prevent this class of issue. For bug bounty hunters, the lesson is simple: test carefully, verify the behaviour, and let the evidence determine the severity.

Glossary

  • API: the part of a website that programs talk to, rather than people clicking buttons.
  • Authentication flow: the sequence of steps a site uses to confirm who you are, such as logging in or signing in through another service.
  • Authorisation code: a short-lived code used in some login systems to prove a user approved access.
  • Bug bounty program: a scheme where organisations pay people for reporting security problems responsibly.
  • Cookie: a small piece of data a site stores in your browser to remember who you are.
  • CWE-601: the standard catalogue entry for an open redirect, titled URL Redirection to Untrusted Site.
  • Endpoint: a specific address on a server that performs one job.
  • GET: the request method meaning "please fetch this for me".
  • Header: a labelled line in a request or response carrying extra details.
  • Host: the part of a web address naming which computer to talk to, such as example.com.
  • Hostname: the name of a computer on the network, as used in an address.
  • HTTP: the language browsers and servers use to exchange requests and responses.
  • Informational: the lowest severity rating, meaning a finding with little or no direct security impact.
  • Location header: the response header that tells the browser where to go next.
  • Low severity: a rating for a finding with limited impact, such as phishing support without credential theft.
  • OAuth: a common system that lets you sign in to one site using an account from another.
  • Open redirect: a redirect whose destination is chosen by whoever made the link, not by the site.
  • Parameter: extra information attached to an address after a question mark, made of a name and a value.
  • Path: the part of an address naming which page on the server, such as /login.
  • Phishing: a scam that impersonates a trusted site to trick people into giving up information.
  • Redirect: a server telling the browser to go to a different address instead.
  • Relative path: an address that stays on the same site, such as /login.
  • Request: the message a browser sends to a server asking for something.
  • Response: the message a server sends back.
  • Scheme: the part of an address saying how to talk to the site, such as https.
  • Scheme-relative address: an address beginning with // that borrows the scheme from the current page.
  • Session: the period during which a site remembers you as signed in.
  • Severity: how serious a finding is judged to be.
  • SSO (single sign-on): a system where one login gives access to several separate services.
  • Status code: a three-digit number in a response saying how the request went.
  • 302 Found: a status code meaning a temporary redirect to another address.
  • Token: a piece of data proving who you are or granting access, often stored by the browser.
  • URL: a web address.
  • Userinfo: the optional username part of an address, before an @ sign.
  • Validate: to check that a value is acceptable before using it.
  • Allowlist: a list of values that are explicitly permitted, with everything else refused.

More by Samadhan shimple

View all

7 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.