Skip to content
Open redirect Write-up Beginner

How I discovered a 1000$ open redirect in Facebook

Facebook's open redirect protection could be bypassed by using a shortened Facebook link (fb.me) as the redirect target, allowing an attacker to redirect victims to a malicious site. The author found several bypasses, including using subdomains like d.fb.me and www.fb.me, and reported them to Facebook.

Yassine Aboukir Follow

Published on yassineaboukir.com

Bounty$1,000 View original

bug bouties appsec

Yassine Aboukir, on yassineaboukir.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

Facebook's web application exposes a number of logging endpoints under paths such as /ads/manage/log/ and /browsegroups/addcover/log/. Because the destination is supplied by the request, the endpoint is an open redirect if the value is not validated properly: an attacker can craft a Facebook URL that lands the victim on a page of the attacker's choosing. The report describes exactly this class of issue, and notes that open redirects of this kind are used in phishing to get users onto malicious sites without them realising it.

The author also notes that Facebook had already implemented protection against open redirection, so the interesting part of the work is not finding the parameter but getting past that protection.

Setup

No special accounts, roles or tools are described. The testing is done against the two public endpoints below, with the redirect target being a Facebook short link (fb.me) that the author had seen in his Twitter feed. Those short links are generated automatically when a Facebook account is linked with Twitter, and in the author's case the short link resolved to evil.com. That short link is the ingredient the whole bypass depends on.

Finding it

Two endpoints were identified as taking a redirect-style parameter:

Text
https://www.facebook.com/ads/manage/log/?uri=xxxxx&event=view_power_editor&ad_account_id=1
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=xxxxx

The author first tried the usual open redirect bypasses against the groupuri parameter, and all of them were blocked by Facebook's protection:

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://www.evil.com/
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=../evil.com
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://l.facebook.com/l.php?u=https://evil.com

That is: a plain absolute URL, a relative path trick, and wrapping the target in Facebook's own l.facebook.com link shim were all rejected. At that point the author was close to giving up.

Exploitation

Step 1: use a Facebook short link as the destination

While looking at his Twitter feed, the author noticed Facebook short links of the form https://fb.me/7kFH9QAMH, which redirected to evil.com. Because these links are generated automatically when a Facebook account is linked with Twitter, they are legitimate Facebook-owned URLs that happen to point anywhere the account owner chooses. He went back to the endpoint and supplied the short link as the groupuri value:

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://fb.me/7kFH9QAMH
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://l.facebook.com/l.php?u=https:// fb.me/7kFH9QAMH

The result was a redirect to evil.com. The second payload wraps the short link in the l.facebook.com/l.php?u= shim, which is the same construction that had failed earlier with a direct evil.com target; with an fb.me target inside it, it passes.

Step 2: a different short-link subdomain

The author then went back to look for another way past the protection. He examined the fb.me domain and found subdomains such as https://on.fb.me, used for Facebook pages, and then guessed further valid subdomains. One of the guesses, https://d.fb.me/7kFH9QAMH, worked and bypassed the protection again:

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://d.fb.me/7kFH9QAMH
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://d.fb.me/7kFH9QAMH

This was escalated to the Facebook security team on 22/12/2014 and fixed on 24/12/2014, but no bounty was paid because it was considered similar to the original report.

Step 3: add www to the short link

Unhappy with that decision, the author tried further tricks, all of which failed, until he unintentionally added www to the shortened Facebook link, producing https://www.fb.me/7kFH9QAMH. The open redirect worked again:

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://www.fb.me/7kFH9QAMH
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://www..fb.me/7kFH9QAMH

In other words, the previous fix was bypassed once more. He followed up with the security engineer who had escalated the bug on 24/12/2014; it was fixed on 30/12/2014 and Facebook awarded 500$ for it.

Root cause

The report does not show the validation code, so the mechanism can only be inferred. The pattern across the three bypasses is that the check accepted destinations on Facebook-controlled short-link hosts (fb.me, d.fb.me, www.fb.me) and then let the browser follow the short link, which resolves to an arbitrary external URL. The report does not state what the fixes changed.

Impact

An attacker who can get a victim to click a crafted Facebook URL is redirected to a page of the attacker's choosing, which is the standard open redirect impact: lending Facebook's domain and reputation to a phishing page so the victim does not realise where they are going.

Fix

Variants to test

  1. Short-link hosts as the destination. Supply a known URL shortener on the target's own domain (or a domain it trusts) as the redirect value. A positive result is a redirect that lands on the short link's external destination rather than being rejected.
  2. Subdomain guessing on the short-link domain. Enumerate plausible subdomains of the shortener (the report found on.fb.me and d.fb.me this way) and try each as the destination. A positive result is any subdomain that passes validation and still resolves onward.
  3. www prefix on the short-link host. Try www. in front of the shortener host, as in https://www.fb.me/7kFH9QAMH. A positive result is the same redirect behaviour as the bare host.
  4. Wrapping in the site's own link shim. Put the short link inside a trusted redirector parameter such as l.facebook.com/l.php?u=. A positive result is that the shim passes the value through to the short link and onward to the external target.
  5. Malformed host spellings. A positive result is acceptance of a host that the browser still resolves to the shortener.

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

What happened, in plain words

A security researcher found a way to make a Facebook web address send visitors to a website of the attacker's choosing. This kind of flaw is called an open redirect. The word "redirect" means "send the browser somewhere else", and "open" means the destination is not fixed: whoever builds the link decides where it goes.

Why does that matter? Because people trust a link that starts with facebook.com. If a link on Facebook's own domain quietly forwards you to a fake login page, you are far more likely to believe the fake page is real. That is the basis of phishing: tricking someone into visiting a malicious site without realising it. The report says exactly this, that open redirects are used in phishing to get users onto malicious sites without them noticing.

The interesting part of this story is not the first discovery. Facebook already had protection in place against open redirects, and the researcher had to get past that protection three separate times. Each time Facebook fixed one hole, he found a slightly different address that slipped through the same check.

The two Facebook addresses involved

Facebook runs many small internal web addresses that do a job and then send you onward. Two of them are shown in the report:

Text
https://www.facebook.com/ads/manage/log/?uri=xxxxx&event=view_power_editor&ad_account_id=1
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=xxxxx

To read these, you need to know what the pieces of a web address are. Everything after the ? is called the query string, and it is made of parameters: pairs of a name, an equals sign, and a value, joined by &. They are how a browser passes small pieces of information to a website, a bit like the fields on a paper form.

In the first address, uri is a parameter whose value is xxxxx. In the second, groupuri is a parameter whose value is xxxxx. The names uri and groupuri both suggest a destination address, and that is exactly what they turned out to be:

That design is the whole problem. If a website takes a destination from the visitor and forwards them there without checking it properly, anyone can build a Facebook link that ends up on any site at all.

The report does not describe any special account, tool or setup. The researcher simply opened these public addresses in a browser and changed the values.

First attempts, and why they failed

Before the successful trick, the researcher tried the obvious approaches against the groupuri parameter. All three were blocked by Facebook's protection:

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://www.evil.com/
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=../evil.com
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://l.facebook.com/l.php?u=https://evil.com

Line by line:

  1. The first address puts a complete external address, https://www.evil.com/, into groupuri. This is the simplest possible attack: just name the bad site. It was rejected.
  2. The second uses ../evil.com, a relative path. In file systems and web addresses, .. means "go up one level". Attackers use it because some checks look only at the start of a value and miss what the .. turns into once the browser resolves it. This was rejected too.
  3. The third hides the bad destination inside a Facebook address, l.facebook.com/l.php?u=. Facebook uses this kind of address as a link shim: a Facebook-owned page that takes a u parameter and forwards you to it. The idea was that a check might trust anything on Facebook's own domain and let the shim do the forwarding. It was rejected as well.

At this point the researcher was close to giving up. The protection was doing its job against the standard tricks.

Step 1: use a Facebook short link as the destination

Then something unrelated gave him the idea. In his Twitter feed he noticed Facebook short links of the form https://fb.me/7kFH9QAMH, and those links redirected to evil.com.

A short link is a very short web address that exists only to forward you to a longer one, like a cloakroom ticket that you hand in to get your coat back. Facebook creates these automatically when someone links their Facebook account with Twitter, so the short link is a genuine Facebook-owned address that can point anywhere its owner chooses.

That is the key insight. The protection was checking whether the destination was a Facebook address. fb.me is a Facebook address. But its entire purpose is to forward you somewhere else. So a check that only asks "is this a Facebook address?" says yes, and the browser then follows the short link straight to the attacker's site.

He went back to the endpoint and put the short link into groupuri:

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://fb.me/7kFH9QAMH
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://l.facebook.com/l.php?u=https:// fb.me/7kFH9QAMH

Line by line:

  1. The first address sets groupuri to the Facebook short link. Facebook accepts it because it is a Facebook-owned host, and the browser is sent to the short link, which then forwards to evil.com.
  2. The second wraps the short link inside the same l.facebook.com/l.php?u= shim that had failed earlier with a direct evil.com target. With a Facebook short link inside it instead, the value passes the check, and the chain runs: Facebook, then the shim, then the short link, then evil.com.

The result in both cases was a redirect to evil.com. The researcher reported this to Facebook on 13/12/2014. It was fixed on 17/12/2014, and Facebook paid a 500$ bounty.

Step 2: a different short-link subdomain

A subdomain is the part added in front of a domain name, as in on.fb.me where on sits before fb.me. Large sites use many of them for different jobs, and each one is still under the main domain.

The researcher went back to see whether he could get past the new protection. He looked closely at the fb.me domain and found subdomains such as https://on.fb.me, which Facebook uses for pages. He then guessed other plausible subdomains, and one guess worked: https://d.fb.me/7kFH9QAMH.

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://d.fb.me/7kFH9QAMH
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://d.fb.me/7kFH9QAMH

Both lines put the d.fb.me short link into groupuri. The two lines are identical in the report.

He escalated this to the Facebook security team on 22/12/2014. It was fixed on 24/12/2014, but no bounty was paid, because the team considered it too similar to the first report.

Step 3: add www to the short link

Unhappy with that decision, the researcher kept trying. Several new tricks failed. Then, by accident, he put www in front of the short link, producing https://www.fb.me/7kFH9QAMH, and the open redirect worked again.

Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://www.fb.me/7kFH9QAMH
Text
https://www.facebook.com/browsegroups/addcover/log/?groupid=1&groupuri=https://www..fb.me/7kFH9QAMH

Line by line:

  1. The first address uses www.fb.me as the destination.
  2. The second shows the same host with a doubled dot, www..fb.me. The report presents it as part of this third proof of concept without further comment.

In other words, the previous fix was bypassed once more. He followed up with the security engineer who had escalated the bug on 24/12/2014. It was fixed on 30/12/2014, and Facebook awarded another 500$, making 1000$ in total across the reports.

Why it worked

The report does not show the checking code, so the exact mechanism is not stated. What the three bypasses have in common is that the check accepted destinations on Facebook's own short-link hosts, and then let the browser follow the short link to wherever it pointed.

What the impact was

Someone who can persuade a victim to click a crafted Facebook link can send that victim to a page of the attacker's choosing. The harm is the standard open redirect harm: the victim sees a trusted Facebook address and does not realise where they will end up, which makes a phishing page far more convincing.

How it was fixed

Things worth trying on other sites

  1. Short-link hosts as the destination. Put a known URL shortener on the target's own domain, or a domain it trusts, into the redirect value. You have a result if the site accepts it and the browser lands on the short link's external destination.
  2. Guessing subdomains of the shortener. Try plausible subdomains of the short-link domain; the report found on.fb.me and d.fb.me this way. You have a result if any subdomain passes the check and still forwards onward.
  3. A www prefix on the short-link host. Try www. in front of the shortener host, as in https://www.fb.me/7kFH9QAMH. You have a result if it behaves like the bare host.
  4. Wrapping in the site's own link shim. Put the short link inside a trusted redirector parameter such as l.facebook.com/l.php?u=. You have a result if the shim passes the value through to the short link and onward to the external target.
  5. Odd spellings of the host. You have a result if a host the browser still resolves to the shortener is accepted.

Glossary

  • Open redirect: a flaw where a website takes a destination address from the visitor and forwards them there without proper checking, so an attacker can send people to any site.
  • Redirect: an instruction from a website telling the browser to load a different address instead.
  • Phishing: tricking someone into visiting a fake site, usually to steal a password or other information, by making it look trustworthy.
  • Parameter: a named value passed in a web address after the ?, written as name=value and separated from others by &.
  • Query string: the whole part of a web address after the ?, made up of parameters.
  • Endpoint: a specific web address on a site that performs a particular job when it is requested.
  • Relative path: an address written relative to the current location, where .. means "go up one level".
  • Link shim: a page on a trusted site that takes a destination in a parameter and forwards the visitor to it, used to wrap outgoing links.
  • Short link: a very short web address that exists only to forward the browser to a longer address.
  • Domain: the main name of a website, such as fb.me.
  • Subdomain: a name placed in front of a domain, such as d in d.fb.me, used to separate parts of a site.
  • Host: the part of a web address that names the server, such as www.facebook.com or fb.me.
  • Allow-list: a list of values that are permitted, with everything else rejected.
  • Bypass: getting past a protection that is supposed to stop you.
  • Bounty: a reward a company pays to someone who reports a security flaw to it responsibly.
  • Escalate: to pass a finding up to a more senior person or team, here the Facebook security team.
  • Proof of concept: a concrete request or set of steps that demonstrates a flaw really works.

More by Yassine Aboukir

View all

2 more disclosed reports, best first.

More from Meta

View all

The newest disclosed reports for this program.

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.