Skip to content
Open redirect Write-up Beginner

Three Cases, Three Open Redirect Bypasses

Three open redirect endpoints validated the redirect target in ways that could be bypassed with crafted URLs. An attacker could craft a link that appears to point at the trusted domain but sends the victim to an attacker-controlled site.

Mmohammed Eldeeb Follow

Published on medium.com

today i will write about three cases i faced and i manged to bypass the redirect in all

Mohammed Eldeeb, 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.

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

This is a short write-up about open redirects, covering three separate cases where a redirect parameter could be abused to send a user to an attacker-controlled domain. The report does not name the affected product or program, and the only asset recorded is medium.com. What the three cases share is a redirect feature that takes a URL from a query parameter and forwards the user to it, with some form of validation intended to keep the destination on the legitimate domain.

Before going into the cases, the author lists the areas of a URL he probes when hunting for redirect bypasses:

  1. Before the http protocol, so that a value such as attacker.com/http://mytarget.com can be tried.
  2. In the www area and before the redirect domain.
  3. After the .com, so that @ can be used.
  4. After the port, for example www.target.com:attacker.com.

He notes that these areas allow a bypass in some cases but not in all. The three cases below each use a different trick.

Setup

No accounts, roles, tools or versions are described. Each case starts from a redirect parameter that the author found on a target, and the work is done by manipulating the value of that parameter and observing where the browser ends up. In the third case he uses a public payload collection as a reference:

Text
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Open%20redirect

Finding it

In each case the redirect parameter itself is the finding: it accepts a destination from the user and the validation around it can be defeated. The author's method is to work out which part of the URL the validation actually checks, then find a character that the target accepts and that changes how the URL is parsed, so the checked part stays intact while the real destination moves elsewhere.

Exploitation

Case 1: backslash in the www area

The redirect parameter was ?redirect=, and it redirected to http://www.mytarget.com. The author found he could only play with the www part. His first attempt was:

Text
http://www.evil.com.mytarget.com

This did not work. He then looked for characters that were allowed and could create a break between mytarget and evil.com. He found that a backslash was allowed, so he tried:

Text
http://www.evil.com\mytarget.com

This also did not work, and he was getting a Forbidden response. After some time he realised he had to put .mytarget in the value. The final URL was:

Text
http://www.evil.com\.mytarget.com

With this value he was redirected to the evil.com domain.

Case 2: @ combined with a backslash

Here the parameter was ?ref=, which redirects users to the main domain. The author again found he could play with the www area, so at first it looked the same as case 1, but the bypass worked a different way.

This parameter did not accept any of the characters that could be used to make a break as in case 1. After some time he had the idea of deceiving the target with @. Putting:

Text
http://[redacted]

was accepted. Following the pattern from case 1, he then tried:

Text
http://attacker.com\@mytarget.com

but he realised the final destination would be @mytarget.com. His next attempt was:

Text
@attacker.com\@mytarget.com

This worked. The final URL was:

Text
https://@attacker.com\@mytargt.com

and the user was redirected to:

Text
https://attacker.com//mytarget.com

This worked, and the user was redirected to https://attacker.com//mytarget.com.

Case 3: fullwidth full stop

The redirect endpoint was ?redirect=https://mytarget.com. None of the techniques from cases 1 and 2 were accepted here. Looking at the payload collection linked above, the author found he could use only %E3%80%82 to bypass the blacklisted . character. In his description, %E3%80%82 makes a new line or space.

The final URL was:

and the user was redirected to:

Text
https://attacker.com mytarget.com

%E3%80%82 is the URL encoding of the ideographic full stop, a character that looks like a full stop but is not the ASCII . the blacklist checks for.

Root cause

In all three cases a character the validation accepted changed where the redirect ended up. The code looks for the expected domain or rejects the ASCII dot, but the value is later parsed by something that applies different rules: a backslash that ends the host, an @ that turns the preceding text into user information, or a Unicode character that is treated as a separator. The report does not show the validation code, so the exact implementation is not known.

Impact

Each bypass results in a redirect from the trusted target to an attacker-controlled domain. The author does not describe what an attacker would do with the redirect, and no bounty or severity is recorded. The practical value depends on where the redirect is used: a link on the legitimate domain that lands on an attacker page is useful for phishing and for stealing tokens that are passed in URLs, but the report does not demonstrate either.

Fix

No fix is described. The general remedy for this class of bug is to stop validating the destination as a string and instead resolve it, then compare the resulting host against an allowlist of permitted hosts, rejecting anything that does not match exactly. Redirecting only to relative paths, or to identifiers that the server maps to known destinations, avoids the problem entirely.

Variants to test

  1. Backslash before the trusted suffix: send http://www.evil.com\.mytarget.com in the redirect parameter. A positive result is a redirect to evil.com rather than to the target.
  2. @ with a backslash: send @attacker.com\@mytarget.com. A positive result is a final URL of the form https://attacker.com//mytarget.com.
  3. Unicode dot: send https://attacker.com%E3%80%82.mytarget.com where the ASCII dot is blacklisted. A positive result is a redirect to the attacker host.
  4. The other areas from the introduction: try attacker.com/http://mytarget.com before the protocol, and www.target.com:attacker.com after the port. A positive result is a redirect that leaves the trusted domain.

Happy Hunting!

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. 8 min read.

What happened, in plain words

This is a story about a common feature on websites: the redirect. You have seen it many times. You click a link on a site, and the site sends your browser to another page. Often the site does this by putting the destination in the address itself, something like ?redirect=https://example.com/page. The site then reads that value and forwards you there.

The problem is that if the site does not check the destination carefully, an attacker can change the value to point to their own website. That is called an open redirect. The danger is that the link still starts with the trusted site's address, so it looks safe, but it ends up on the attacker's page. Attackers use this for phishing: they send a link that looks like it belongs to a bank or a social network, but it takes you to a fake login page.

In this write-up, the author found three different redirect features on a target (the report only records the asset medium.com, but does not name the product or program). Each feature tried to keep you on the legitimate domain, but each could be tricked. The author shows three tricks: using a backslash, using the @ symbol, and using a special Unicode character that looks like a dot. All three bypass the checks and send the user to an attacker-controlled domain.

Before the cases, the author explains where he looks when hunting for redirect bypasses. He lists four areas of a URL:

  1. Before the http protocol, so you can try something like attacker.com/http://mytarget.com.
  2. In the www area and before the redirect domain.
  3. After the .com, so you can use @.
  4. After the port, for example www.target.com:attacker.com.

He notes that these areas allow a bypass in some cases but not all. The three cases below each use a different trick.

No accounts, tools, or versions are described. The work is done by changing the value of a redirect parameter and watching where the browser ends up. In the third case, the author uses a public collection of payloads as a reference:

Text
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Open%20redirect

This is a GitHub repository called PayloadsAllTheThings, which contains lists of example inputs for testing many kinds of vulnerabilities, including open redirects. The author uses it as a source of ideas for characters that might bypass filters.

In each case, the redirect parameter itself is the finding: it accepts a destination from the user, and the validation around it can be defeated. The author's method is to figure out which part of the URL the validation actually checks, then find a character that the target accepts and that changes how the URL is parsed, so the checked part stays intact while the real destination moves elsewhere.

Case 1: backslash in the www area

The redirect parameter was ?redirect=, and it redirected to http://www.mytarget.com. The author found he could only play with the www part. His first attempt was:

Text
http://www.evil.com.mytarget.com

This is a URL where the host is www.evil.com.mytarget.com. The idea is that the validation might only check that the string ends with .mytarget.com, so this would pass. But it did not work. But it did not work.

He then looked for characters that were allowed and could create a break between mytarget and evil.com. He found that a backslash was allowed, so he tried:

Text
http://www.evil.com\mytarget.com

But this also did not work, and he was getting a Forbidden response. That means the server rejected the request.

After some time he realised he had to put .mytarget in the value. The final URL was:

Text
http://www.evil.com\.mytarget.com

With this value he was redirected to the evil.com domain. The backslash separates the attacker host from the .mytarget.com suffix that the validation is looking for, while the browser treats evil.com as the host.

Case 2: @ combined with a backslash

Here the parameter was ?ref=, which redirects users to the main domain. The author again found he could play with the www area, so at first it looked the same as case 1, but the bypass worked a different way.

This parameter did not accept any of the characters that could be used to make a break as in case 1. After some time he had the idea of deceiving the target with @. Putting:

Text
http://[redacted]

was accepted. In a URL, the @ symbol separates the user information (username and password) from the host. So http://[redacted] means: connect to mytarget.com, but use attacker.com as the username. Browsers often ignore the user information when connecting, so the actual host is mytarget.com. But some validation code might see attacker.com and think that is the host. The author tried this and it was accepted, but he realised the final destination would be @mytarget.com.

Following the pattern from case 1, he then tried:

Text
http://attacker.com\@mytarget.com

but he realised the final destination would be @mytarget.com. His next attempt was:

Text
@attacker.com\@mytarget.com

This worked. The final URL was:

Text
https://@attacker.com\@mytargt.com

and the user was redirected to:

Text
https://attacker.com//mytarget.com

The @ makes the browser treat everything before it as user information and the part after it as the host, so the value that passes validation is not the host the browser actually connects to.

Case 3: fullwidth full stop

The redirect endpoint was ?redirect=https://mytarget.com. None of the techniques from cases 1 and 2 were accepted here. Looking at the payload collection linked above, the author found he could use only %E3%80%82 to bypass the blacklisted . character. In his description, %E3%80%82 makes a new line or space.

The final URL was:

and the user was redirected to:

Text
https://attacker.com mytarget.com

%E3%80%82 is the URL encoding of the ideographic full stop, a character that looks like a full stop but is not the ASCII . the blacklist checks for. The validation therefore does not see a dot where the browser or the downstream parser does.

Root cause

In all three cases a character the validation accepted changed where the redirect ended up. The code looks for the expected domain or rejects the ASCII dot, but the value is later parsed by something that applies different rules: a backslash that ends the host, an @ that turns the preceding text into user information, or a Unicode character that is treated as a separator. The report does not show the validation code, so the exact implementation is not known.

Impact

Each bypass results in a redirect from the trusted target to an attacker-controlled domain. The author does not describe what an attacker would do with the redirect, and no bounty or severity is recorded. The practical value depends on where the redirect is used: a link on the legitimate domain that lands on an attacker page is useful for phishing and for stealing tokens that are passed in URLs, but the report does not demonstrate either.

Fix

No fix is described. The general remedy for this class of bug is to stop validating the destination as a string and instead resolve it, then compare the resulting host against an allowlist of permitted hosts, rejecting anything that does not match exactly. Redirecting only to relative paths, or to identifiers that the server maps to known destinations, avoids the problem entirely.

Variants to test

  1. Backslash before the trusted suffix: send http://www.evil.com\.mytarget.com in the redirect parameter. A positive result is a redirect to evil.com rather than to the target.
  2. @ with a backslash: send @attacker.com\@mytarget.com. A positive result is a final URL of the form https://attacker.com//mytarget.com.
  3. Unicode dot: send https://attacker.com%E3%80%82.mytarget.com where the ASCII dot is blacklisted. A positive result is a redirect to the attacker host.
  4. The other areas from the introduction: try attacker.com/http://mytarget.com before the protocol, and www.target.com:attacker.com after the port. A positive result is a redirect that leaves the trusted domain.

Happy Hunting!

Glossary

  • Open redirect: A vulnerability where a website takes a user-supplied destination and redirects the user there without proper validation, allowing attackers to send users to malicious sites.
  • Redirect parameter: A part of a URL (after ?) that tells the server where to send the user next, for example ?redirect=... or ?ref=....
  • URL: Uniform Resource Locator, the address of a resource on the internet, like https://example.com/page.
  • Host: The part of a URL that identifies the server, like example.com in https://example.com/page.
  • Protocol: The scheme part of a URL, like http or https, which tells the browser how to communicate.
  • Port: A number that identifies a specific service on a server, like :80 or :443; often omitted when default.
  • Backslash: The character \, which in some contexts is treated like a forward slash / by browsers.
  • Forbidden response: An HTTP status code (403) meaning the server understood the request but refuses to authorise it.
  • @ symbol: In a URL, separates user information (username:password) from the host; browsers may ignore the user information when connecting.
  • Blacklist: A list of characters or strings that are blocked by a filter.
  • URL encoding: A way to represent special characters in a URL using percent signs and hexadecimal numbers, like %20 for space.
  • Unicode: A standard for representing text characters from all writing systems; includes characters that look similar to ASCII ones.
  • Ideographic full stop: A Unicode character (U+3002) that looks like a full stop but is used in some Asian writing systems; encoded as %E3%80%82 in URLs.
  • Payload: The input or data sent to a system to test or exploit a vulnerability.
  • Allowlist: A list of permitted items; anything not on the list is rejected.
  • Phishing: A scam where attackers trick users into revealing sensitive information by pretending to be a trustworthy entity.
  • Token: A piece of data, often a string, used to authenticate a user or authorise an action; can be stolen if exposed in URLs.
  • API: Application Programming Interface, a set of rules that allows different software to communicate; not directly used in this report but relevant to web features.
  • Cookie: A small piece of data stored by the browser and sent with requests to a website, often used for sessions; not directly used in this report but related to tokens.

More by Mmohammed Eldeeb

View all

1 more disclosed report, 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.