Skip to content
Open redirect Write-up Beginner

Evading Filters to perform the Arbitrary URL Redirection Attack

The login page's 'forward' parameter allowed redirection to an attacker-controlled domain because the filter blocked HTTPS and hostnames/IPs but not HTTP or integer IP representations. An attacker could craft a link that, after login, redirected the victim to a malicious site.

Harsh Bothra Follow

Published on medium.com

Arbitrary URL Redirection Attack often is popularly known as an Open Redirection attack, which is a common web vulnerability that allows an attacker to redirect the victim user to an attacker-controlled domain. This attack can leveraged to steal sensitive information such as tokens, perform social engineering, and…

Harsh Bothra, 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.

Open redirects are often dismissed as low-impact, but the mechanics of getting past a filter are where the interesting work sits. This is a short account of a private-program finding where a forward parameter blocked the obvious payloads and still let me send a logged-in user to an external domain.

Context

The target was a private application, referred to here as target.com. The endpoint involved is the login page, which carries a forward parameter pointing at a destination such as /my-profile or /account/address. In normal use this is a convenience, so that a user who was bounced to the login page lands back on the page they originally wanted, such as /my-profile or /account/address.

An arbitrary URL redirection attack, commonly called an open redirection, lets an attacker redirect a victim to an attacker-controlled domain. The report notes it can be leveraged to steal sensitive information such as tokens, to perform social engineering, and for other attacks. It typically appears at endpoints where the application accepts a user-supplied URL and redirects to it. Common parameter names include ?return=, ?returnURI=, ?forwardedTo=, ?redirect=, ?redirectURI=, ?url=, ?forward= and similar names that suggest loading or redirecting to another endpoint.

Setup

The work was done manually against the private target, using the first of the three approaches below rather than tooling. No versions or specific tooling configurations are given in the report.

Finding it

The researcher's checklist moved on to URL redirection after the other checks. Three approaches are described for hunting this class of bug.

Approach 1: harvest the parameter from the login flow

  1. Log in to the application and navigate to any authenticated page, for example My Profile.
  2. The URL generally looks like this:
Text
https://www.target.com/my-profile/
  1. Log out. Many applications then throw a redirection parameter that points back to the /my-profile page.
  2. The URL looks like the following:
Text
https://www.target.com/login?forward=/my-profile
  1. The forward parameter is then a potential attack vector for arbitrary URL redirection.

Approach 2: parameter enumeration

  1. Use parameter enumeration tools such as ParamSpider and Arjun.
  2. Test each suspicious parameter against the arbitrary URL redirection attack.

Approach 3: historical URLs and GF patterns

  1. Run gau and waybackurls on the target application and save the output to a file.
  2. Run Open Redirection GF Patterns over that file and store the output in another file.
  3. The resulting URLs are suspected, potential endpoints for the attack.

On this target the researcher used Approach 1 and found the following potential endpoint:

Text
https://www.target.com/login?forward=/account/address

Exploitation

The forward parameter was validating whether a URL was supplied and was blocking the redirection from happening. Further investigation showed what the filter was actually doing:

  • The application was filtering the HTTPS protocol.
  • The application was filtering the Host & IP Address.

However, the application was allowing the use of the HTTP protocol. However, the application was allowing the use of the HTTP protocol, and the integer form of the address was accepted.

Step 1: bypass the filter with an integer IP

After some thought, the following payload was used as a bypass:

Text
http://2899905732

2899905732 is the integer representation of google.com's IP, [redacted]. The value is a bare number rather than a dotted IP or a hostname, and the scheme is http rather than https.

Step 2: deliver the full URL

The final payload looked like the following:

Text
https://www.target.com/login?forward=http://2899905732

Step 3: authenticate and observe the redirect

The researcher navigated to that URL and logged in with valid credentials. Upon login, the application redirected to google.com, confirming a successful arbitrary URL redirection attack.

From the original on medium.com

Root cause

The application tried to prevent open redirects by inspecting the supplied value, but the inspection was a blocklist of specific shapes rather than a check that the destination is trusted. It rejected https URLs and it rejected values containing a host or IP address, yet it accepted the http scheme and did not recognise an integer-form IP as an IP address. The redirect logic then used the value as given. The report does not describe the implementation, so the exact matching logic is not known; the behaviour is consistent with pattern matching on the scheme and on dotted-quad or hostname syntax.

Impact

A crafted login URL with an external value in forward redirected the logged-in user to google.com. The report frames the consequences generally: theft of sensitive information such as tokens, social engineering, and other attacks that rely on a trusted-looking link. In the reported case the redirect happened after logging in with valid credentials.

Fix

The report does not state what was changed. The durable fix is to stop blocklisting and instead only redirect to destinations that are known to be safe, for example relative paths or an explicit allowlist of hosts, resolving and normalising the value before comparing it. Any scheme and host parsing should happen on a canonical form so that alternate encodings of the same address cannot slip past.

Variants to test

  • Alternate IP encodings. Try integer, octal, hexadecimal and mixed forms of an external address in redirect parameters. A positive result is a redirect to the external host after login.
  • Scheme switching. Where https is blocked, try http, and where both are blocked, try protocol-relative values such as //host. A positive result is any redirect off-site.
  • Credential and authority tricks. Try values with userinfo or extra @ segments so the parser and the filter disagree about which host is the destination. A positive result is a redirect to the host after the @.
  • Parameter discovery. Run ParamSpider, Arjun, gau and waybackurls with Open Redirection GF Patterns as described above, then test every candidate parameter. A positive result is a parameter that changes the redirect destination.
  • Post-authentication flows. Check logout and login redirect parameters, as in Approach 1, since these are frequently overlooked. A positive result is a forward-style parameter that accepts an external value.

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 private website (called target.com in the write-up) and found a way to make its login page send people to a different website after they signed in. This kind of bug is called an open redirect or arbitrary URL redirection. The site had tried to stop this: it filtered the HTTPS protocol and values containing a host or IP address. The researcher found a way around those checks by writing the destination address in an unusual form, and the site then happily sent the logged-in user to google.com.

The interesting part is not the redirect itself. It is how the filter was dodged. This article walks through the whole thing from zero: what the feature does, why it exists, how the researcher found the weak spot, and what the exact requests looked like.

The feature being abused

Some login pages carry a parameter that holds a destination to return to after login. Imagine you open a link to your profile page while logged out. The site cannot show you the profile, so it sends you to the login page instead. After you log in, it would be annoying to dump you on the home page, so it sends you back to the profile page you originally wanted.

To do this, the site puts the destination in the web address itself, as a parameter. A parameter is a named value attached to the end of a URL after a question mark, like ?colour=blue. The server reads it and acts on it. In this case the parameter is called forward, and the report shows it holding a path such as /my-profile.

That is convenient, but it means the site is trusting a value that anyone can type into the address bar. If the site does not check that value carefully, an attacker can put their own website there instead of /my-profile.

What an open redirect is

An arbitrary URL redirection attack, usually called an open redirection or open redirect, is when a site takes a destination from the user and sends the browser there without checking that the destination is safe. The victim sees a link that starts with the real, trusted domain, clicks it, and ends up somewhere else entirely.

Why does that matter? The write-up lists the consequences: stealing sensitive information such as tokens, performing social engineering, and other attacks. A token here means a short piece of text that proves who you are, a bit like a wristband at an event: show it and you are let in. If an attacker can bounce you to their own site at the right moment, they may be able to capture such values or trick you into handing them over. Social engineering means manipulating a person rather than a machine, for example by sending a link that looks official because it begins with the real company's name.

Open redirects usually live wherever an application accepts a URL from the user and then redirects to it. The write-up lists common parameter names to look for:

  • ?return=
  • ?returnURI=
  • ?forwardedTo=
  • ?redirect=
  • ?redirectURI=
  • ?url=
  • ?forward=

All of these names suggest the same thing: load or redirect the user to another place.

Why filters exist, and why they are hard

Modern web frameworks, the toolkits developers use to build sites, usually include security checks by default to prevent open redirects. The write-up describes the kinds of checks it saw: validating whether a third-party URL or IP is used, and validating whether the HTTPS:// protocol is used. If the check finds something suspicious, the application blocks the redirect.

Two ideas need explaining here.

A protocol (also called a scheme) is the first part of a web address, before the ://. https:// means the connection is encrypted; http:// means it is not. Browsers and servers treat them as different schemes even though they often lead to the same place.

An IP address is the numeric address of a machine on the internet, written as four numbers separated by dots, such as [redacted]. A host is the human-friendly name for that machine, such as google.com. Behind the scenes, the name is translated into the number.

The filter in this story was a blocklist: a list of shapes it refused. It refused https addresses and it refused values containing a host or an IP address. Blocklists are fragile because they only stop the exact shapes someone thought of. Anything written in a different but equally valid form slips through.

How the researcher hunted for it

The write-up describes three general approaches for finding this class of bug. They are worth knowing because the first one is what worked here.

Approach 1: harvest the parameter from the login flow

  1. Log in to the application and navigate to any authenticated page, for example My Profile.
  2. The URL generally looks like this:
Text
https://www.target.com/my-profile/
  1. Log out. Many applications then throw a redirection parameter that points back to the /my-profile page.
  2. The URL looks like the following:
Text
https://www.target.com/login?forward=/my-profile
  1. The forward parameter is then a potential attack vector for arbitrary URL redirection.

In plain words: you sign in, visit a page that only logged-in users can see, then sign out. The site often hands you a login link that remembers where you were. That link contains the parameter you want to test. You did not have to guess the parameter name; the site told you by putting it in the address bar. An attack vector simply means a way in, a place where an attacker can try something.

Approach 2: parameter enumeration

  1. Use parameter enumeration tools such as ParamSpider and Arjun.
  2. Test each suspicious parameter against the arbitrary URL redirection attack.

Parameter enumeration means systematically discovering which parameters a site accepts. ParamSpider and Arjun are tools that do this automatically, a bit like trying every key on a keyring to see which ones fit a lock. Once you have a list of candidate parameters, you test each one by hand to see whether it changes where the site sends you.

Approach 3: historical URLs and GF patterns

  1. Run gau and waybackurls on the target application and save the output to a file.
  2. Run Open Redirection GF Patterns over that file and store the output in another file.
  3. The resulting URLs are suspected, potential endpoints for the attack.

gau and waybackurls collect URLs that have been seen before, for example from public archives of the web. The idea is that old links may reveal parameters that are no longer linked from the site but still work. GF patterns are ready-made search patterns that pick out URLs likely to be vulnerable to a particular bug class, here open redirects. An endpoint is a specific address on a server that does something, such as handling a login.

On this target the researcher used Approach 1 and found the following potential endpoint:

Text
https://www.target.com/login?forward=/account/address

This is the login page with a forward parameter pointing at /account/address. The question is what happens if you put something else in that parameter.

Hitting the filter

The forward parameter was validating whether a URL was supplied, and it was blocking the redirection from happening. In other words, when the researcher tried to put an outside address there, the site refused.

Further investigation showed what the filter was actually doing:

  • The application was filtering the HTTPS protocol.
  • The application was filtering the Host & IP Address.

So an address beginning with https:// was rejected, and so were values containing a host or an IP address. That covers most of what a person would try first.

However, the application was allowing the use of the HTTP protocol. However, the application was allowing the use of the HTTP protocol, and the integer form of the address was accepted.

Step 1: bypass the filter with an integer IP

After some thought, the following payload was used as a bypass:

Text
http://2899905732

A payload is the specific value an attacker puts into an input to try to trigger the bug. Here it is an address made of two parts.

  • http:// is the plain, unencrypted scheme. The filter only blocked https, so this part passes.
  • 2899905732 is a number. It is the integer representation of google.com's IP, [redacted]. An IP address is really just a large number, and the dotted form is one way of writing that number down. The same number can also be written as a single integer. Browsers understand this and convert it back.

The value is a bare number rather than a dotted IP or a hostname, and the scheme is http rather than https. The filter looked at the value and saw nothing it had been told to block, even though a browser would happily treat it as a real destination.

Step 2: deliver the full URL

The final payload looked like the following:

Text
https://www.target.com/login?forward=http://2899905732

Read it piece by piece:

  • https://www.target.com/login is the real login page. This is what makes the link look trustworthy: it starts with the genuine domain.
  • ? starts the parameters.
  • forward= is the parameter the site uses to decide where to send you after login.
  • http://2899905732 is the value, the integer form of google.com's address over plain HTTP.

To a person glancing at the link, it points at target.com. To the server, the forward value points somewhere else entirely.

Step 3: authenticate and observe the redirect

The researcher navigated to that URL and logged in with valid credentials. Upon login, the application redirected to google.com, confirming a successful arbitrary URL redirection attack.

In the reported case the redirect happened after logging in with valid credentials. That is why the write-up frames the impact in terms of social engineering: the attacker needs the victim to trust the link enough to log in through it.

From the original on medium.com

Root cause

The application tried to prevent open redirects by inspecting the supplied value, but the inspection was a blocklist of specific shapes rather than a check that the destination is trusted. It rejected https URLs and it rejected values containing a host or IP address, yet it accepted the http scheme and did not recognise an integer-form IP as an IP address. The redirect logic then used the value as given.

The write-up does not describe the implementation, so the exact matching logic is not known. The behaviour is consistent with pattern matching on the scheme and on dotted-quad or hostname syntax. In everyday terms: the guard was checking for the disguises it had seen before, not asking whether the person at the door was actually invited.

Impact

A crafted login URL with an external value in forward redirected the logged-in user to google.com. The write-up frames the consequences generally: theft of sensitive information such as tokens, social engineering, and other attacks that rely on a trusted-looking link.

Fix

The write-up does not state what was changed. The durable fix is to stop blocklisting and instead only redirect to destinations that are known to be safe, for example relative paths or an explicit allowlist of hosts, resolving and normalising the value before comparing it. Any scheme and host parsing should happen on a canonical form so that alternate encodings of the same address cannot slip past.

A relative path is a destination on the same site, such as /my-profile, with no domain at all. An allowlist is the opposite of a blocklist: a list of things that are permitted, with everything else refused. Normalising means rewriting a value into one standard form before checking it, so that every way of writing the same address looks identical to the check.

Variants to test

  • Alternate IP encodings. Try integer, octal, hexadecimal and mixed forms of an external address in redirect parameters. A positive result is a redirect to the external host after login.
  • Scheme switching. Where https is blocked, try http, and where both are blocked, try protocol-relative values such as //host. A positive result is any redirect off-site.
  • Credential and authority tricks. Try values with userinfo or extra @ segments so the parser and the filter disagree about which host is the destination. A positive result is a redirect to the host after the @.
  • Parameter discovery. Run ParamSpider, Arjun, gau and waybackurls with Open Redirection GF Patterns as described above, then test every candidate parameter. A positive result is a parameter that changes the redirect destination.
  • Post-authentication flows. Check logout and login redirect parameters, as in Approach 1, since these are frequently overlooked. A positive result is a forward-style parameter that accepts an external value.

A parser is the part of the software that reads a URL and works out its pieces. When the parser and the filter read the same value differently, the filter may approve something the parser then treats as a different destination. Octal and hexadecimal are simply other ways of writing numbers, just as 10 can be written 012 in octal or 0xA in hexadecimal.

Glossary

  • Open redirect (arbitrary URL redirection): a bug where a site sends the user to a destination supplied by the user without checking that it is safe.
  • Parameter: a named value attached to a URL after a question mark, such as ?forward=/my-profile.
  • Endpoint: a specific address on a server that performs an action, such as handling a login.
  • Protocol (scheme): the first part of a URL before ://, such as http or https; https is encrypted, http is not.
  • IP address: the numeric address of a machine on the internet, usually written as four dotted numbers such as [redacted].
  • Host: the human-friendly name of a machine, such as google.com, which is translated into an IP address.
  • Integer representation of an IP: the same address written as one large number instead of dotted form, for example 2899905732 for [redacted].
  • Token: a short piece of text that proves who you are, like a wristband at an event.
  • Social engineering: manipulating a person rather than a machine, for example with a link that looks official.
  • Filter: a check that inspects input and blocks values it considers dangerous.
  • Blocklist: a list of things that are refused, with everything else allowed.
  • Allowlist: a list of things that are permitted, with everything else refused.
  • Payload: the specific value an attacker puts into an input to try to trigger a bug.
  • Attack vector: a way in, a place where an attacker can try something.
  • Parameter enumeration: systematically discovering which parameters a site accepts, often with tools such as ParamSpider and Arjun.
  • gau / waybackurls: tools that collect URLs seen before, for example from public web archives.
  • GF patterns: ready-made search patterns that pick out URLs likely to be vulnerable to a particular bug class.
  • Relative path: a destination on the same site, such as /my-profile, with no domain.
  • Normalising: rewriting a value into one standard form before checking it, so alternate spellings look identical.
  • Parser: the part of the software that reads a URL and works out its pieces.
  • Octal / hexadecimal: other ways of writing numbers, such as 012 or 0xA for ten.
  • Protocol-relative URL: an address beginning with //host, which uses whatever scheme the current page uses.

More by Harsh Bothra

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.