Skip to content
SSRF Write-up Intermediate

$10000 Facebook SSRF (Bug Bounty)

A hidden JavaScript file on a Facebook subdomain revealed a function that sent requests to a user-supplied URL. By manipulating the ewsUrl parameter, an attacker could make the server send requests to internal addresses, enabling blind SSRF.

Amine Aboud Follow

Published on amineaboud.medium.com

Bounty$10,000 View original

{{media:0}}

Amine Aboud, on amineaboud.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. 4 min read.

Context

This is a write-up of a blind server-side request forgery (SSRF) vulnerability that the researcher found in Facebook infrastructure and reported through the Meta / Facebook bug bounty programme. The affected host was phishme.thefacebook.com, a subdomain of thefacebook.com that was live at the time of testing. The name suggests a phishing simulation service. The report describes a function called sendPhishRequest that used XMLHttpRequest to request data from some specific links.

As the researcher puts it, the vulnerability could have allowed a malicious actor to send internal requests to the Facebook corporate network. The report is short and the chain is simple: subdomain enumeration, file brute forcing, JavaScript review, then abuse of one parameter that controls where the server-side request goes.

Amine Aboud
Amine Aboud From the original on amineaboud.medium.com

Setup

The report does not describe any accounts, roles, tooling versions or special preconditions. The work was done against the public host phishme.thefacebook.com with a custom wordlist for file brute forcing, and the only inputs needed for the exploit were the three parameters of the PhishGetItemData.ashx endpoint. No authentication step is mentioned.

Finding it

Subdomain enumeration

By doing some subdomain enumeration, the researcher discovered the following active subdomain:

Text
phishme.thefacebook.com

The researcher notes a prior interest in 403 Forbidden errors, referring to an earlier article, "Story of a weird vulnerability I found on Facebook". That interest is what made this host worth a closer look.

JavaScript file brute forcing

Using a custom wordlist, the researcher ran a file brute force on the path:

Text
https://phishme.thefacebook.com/******.js

This identified a hidden JavaScript file named Home.js, located at:

Text
https://phishme.thefacebook.com/Home.js

Code review of Home.js

Analysing Home.js, the researcher identified a function called sendPhishRequest that used XMLHttpRequest to request data from some specific links. A deeper analysis revealed its usage as follows:

Text
Util.sendPhishRequest('PhishGetItemData.ashx', { itemId: itemId, ewsUrl: ewsUrl, token: token })

The interesting part is ewsUrl, a URL-shaped value passed to the endpoint. A parameter that names a remote URL and is consumed server-side is exactly the shape of an SSRF sink.

Exploitation

Step 1: probe the function with different token formats

After a series of experiments and testing various token formats, the researcher was finally able to successfully exploit Util.sendPhishRequest to send internal requests. The report does not describe which token formats failed or what distinguished the working one.

Step 2: send the request with an internal URL

The working parameters were:

Text
itemId: 123
ewsUrl: http://[redacted]:PORT
token: [redacted]

itemId is a numeric identifier. ewsUrl points at the loopback interface on a port placeholder.

Step 3: the proof of concept

The full proof of concept was:

HTTP
https://phishme.thefacebook.com/PhishGetItemData.ashx?itemId=123&ewsUrl=http://[redacted]:PORT/&[redacted]

Because the response is blind, the evidence came from stack trace errors. Those errors, in the researcher's words, not only facilitated a deeper understanding of the internal request handling mechanisms but also provided concrete evidence of the blind SSRF vulnerability's existence. The report does not include the text of any stack trace or the content of any response.

Root cause

Because the value is attacker-controlled, the server can be pointed at [redacted] and other internal addresses.

Impact

A malicious actor could have used the endpoint to send internal requests to the Facebook corporate network. The vulnerability is blind: the attacker does not see the response body directly, and the evidence came from stack trace errors. The report does not enumerate which internal services were reachable or what data could be extracted beyond that.

Fix

The report states only that the issue was patched on August 11, 2020, the same day it was triaged.

Timeline

Date Event
August 7, 2020 Reported
August 11, 2020 Triaged
August 11, 2020 Patched
December 3, 2020 Resolved
December 3, 2020 $10000 bounty awarded

Variants to test

  1. Other URL-shaped parameters in the same JavaScript. Grep bundled and hidden .js files for names like url, uri, endpoint, callback, webhook, feed and target. A positive result is a parameter whose value the server fetches, confirmed by pointing it at a listener you control and seeing the request arrive from the server's address.
  2. Loopback and metadata addresses. Replace http://[redacted]:PORT/ with other internal targets such as http://localhost:PORT/ or cloud metadata endpoints. A positive result is a distinct error, timing difference or outbound hit that shows the server attempted the connection.
  3. Scheme and redirect tricks. Try file://, gopher:// and an external URL that redirects to an internal one. A positive result is content or behaviour that only the internal target could produce.
  4. Token handling. The researcher tested various token formats before one worked. On other targets, test whether the token is validated at all, whether it is tied to the URL, and whether a documentation example token is accepted. A positive result is a request that reaches the fetch stage with a token the server should have rejected.
  5. Error-based confirmation. Where the response is blind, look for stack traces, verbose errors and timing differences. A positive result is an error that names the internal host or port you supplied, which is the same evidence used here.

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

What happened, in plain words

A security researcher found a way to make a Facebook server send internal requests to the Facebook corporate network. The trick involved a URL-shaped parameter, ewsUrl, passed to the endpoint. Facebook paid a $10,000 bounty for the report.

The bug class is called SSRF, short for server-side request forgery. To understand it, imagine a hotel concierge who will fetch anything you ask for. Normally you ask for a newspaper from the shop across the street. But if the concierge will also walk into the staff-only back office and bring back whatever is there, you have just used the concierge's access to reach places you could never enter yourself. In SSRF, the "concierge" is a web server, and the "back office" is the internal network that only the server can reach.

The report calls it a blind SSRF. Blind means the attacker does not get to read the fetched page directly. The server does the fetching, but the answer is not shown back to the attacker. Instead, the researcher confirmed the bug through error messages, which is explained later.

The researcher's own summary of the chain is: subdomain enumeration plus file brute forcing plus JavaScript analysis equals a $10K blind SSRF. Each of those three steps is explained below.

Amine Aboud
Amine Aboud From the original on amineaboud.medium.com

Background concepts you need first

Before walking through the steps, here are the ideas the report relies on.

  • Subdomain: a smaller name under a main domain. facebook.com is the main domain; www.facebook.com and phishme.thefacebook.com are subdomains. Think of the main domain as a company and subdomains as different departments, each with its own door.
  • Enumeration: systematically listing things. Subdomain enumeration means trying many possible names to discover which ones exist and are live.
  • Brute forcing (in this context): guessing many names from a list, quickly and automatically, until something is found. It is not about cracking passwords here; it is about discovering hidden files.
  • Wordlist: a plain text file with one candidate name per line, used as the guesses for a brute force.
  • JavaScript: the programming language that runs inside web pages in your browser. Websites ship .js files full of code, and that code often reveals how the site talks to its servers.
  • API: a defined way for one piece of software to ask another for data or an action. Think of it as a service counter: you hand over a form with specific fields, and you get something back. Web APIs are often reached at a URL with parameters attached.
  • Parameter: a named value in a URL, after a ?, written as name=value and joined with &. In ?itemId=123&ewsUrl=..., itemId and ewsUrl are parameters.
  • Token: a short string that proves who you are or that a request is allowed, similar to a wristband at an event. The server checks it before doing sensitive work.
  • JWT: JSON Web Token, a common token format made of three dot-separated parts. The middle part is readable data about the token; the last part is a signature.
  • XMLHttpRequest: a browser feature that lets JavaScript send a request to a server without reloading the page. It is the older cousin of today's fetch.
  • [redacted]: the loopback address. It always means "this same computer". If a server connects to [redacted], it is talking to itself, not to the internet.
  • Stack trace: the debugging output a program prints when it crashes, listing the functions that were running. It often reveals internal details.
  • 403 Forbidden: the HTTP status code a server returns when it refuses to show you something. It means "I know what you asked for, and you may not have it."

1) Subdomain enumeration

By doing some subdomain enumeration, the researcher discovered the following active subdomain:

Text
phishme.thefacebook.com

What this means: the researcher tried many possible names under thefacebook.com and found that this one answered. The name suggests a phishing simulation service, that is, a tool a company uses to test whether its staff can spot fake emails.

The researcher also mentions a previous article, "Story of a weird vulnerability I found on Facebook", and says that because of it you would know about their interest in 403 Forbidden errors. In plain terms: a page that refuses access is not a dead end. It tells you something is there and protected, so it is worth poking at.

2) JavaScript file brute forcing

By employing a custom wordlist and conducting a file brute force on the path:

Text
https://phishme.thefacebook.com/******.js

I identified a hidden Javascript file named "Home.js" located at:

Text
https://phishme.thefacebook.com/Home.js

Line by line:

  1. The researcher took a list of common file names (the custom wordlist) and requested each one in turn, with .js on the end, under the host. The ****** in the report stands in for the guessed names.
  2. One of those guesses, Home.js, existed. It was not linked from the visible site, so it was effectively hidden, but the server still served it.

Why this step: the visible website is only the surface. The JavaScript files behind it contain the code that drives the site, including the names of the server endpoints it calls. Reading them is like finding the staff manual instead of just looking at the shop window.

3) Code review of Home.js

By analysing the code of the Home.js file, the researcher identified an interesting function called sendPhishRequest that was using XMLHttpRequest to request data from some specific links. A deeper analysis revealed its usage as follows:

Text
Util.sendPhishRequest('PhishGetItemData.ashx', { itemId: itemId, ewsUrl: ewsUrl, token: token })

Line by line:

  1. Util.sendPhishRequest(...) calls a helper function. Util is just a container object holding utility functions.
  2. The first argument, 'PhishGetItemData.ashx', is the name of the server-side endpoint to call. .ashx is a file extension used by Microsoft's ASP.NET technology for a handler that returns data rather than a full page.
  3. The second argument is an object with three fields: itemId, ewsUrl and token. These are the values that will be sent to the server.

The important one is ewsUrl, a URL-shaped value passed to the endpoint. A parameter that names a remote address and is used by the server is exactly the shape of an SSRF sink. "Sink" here means the place where untrusted input ends up doing something powerful.

Exploitation

Step 1: try different token formats

After conducting a series of experiments and testing various token formats, the researcher was finally able to successfully exploit the function Util.sendPhishRequest to send internal requests.

In plain words: the researcher tested various token formats until the function could be exploited. The report does not say which formats failed or what made the working one different.

Step 2: send the request with an internal address

The working parameters were:

Text
itemId: 123
ewsUrl: http://[redacted]:PORT
token: [redacted]

Line by line:

  1. itemId: 123 is a simple numeric identifier. It tells the endpoint which item is being asked about.
  2. ewsUrl: http://[redacted]:PORT is the key value. It points at the loopback address, meaning the server itself, on a port chosen by the researcher. PORT is a placeholder for a port number. The address points at the loopback interface, meaning the server itself, on a port chosen by the researcher.
  3. token: eyJ... is a JWT. This particular value is the well-known example token used throughout JWT documentation, with the payload naming "John Doe" and admin: true. The report does not say what validation it received.

Why this step: if the server fetches whatever URL you give it, then giving it an internal address makes the server knock on doors inside its own network that you could never reach from outside.

Step 3: the proof of concept

The full proof of concept was:

HTTP
https://phishme.thefacebook.com/PhishGetItemData.ashx?itemId=123&ewsUrl=http://[redacted]:PORT/&[redacted]

Line by line:

  1. https://phishme.thefacebook.com/PhishGetItemData.ashx is the endpoint from the JavaScript.
  2. ? starts the list of parameters.
  3. itemId=123 passes the item number.
  4. &ewsUrl=http://[redacted]:PORT/ passes the internal address the server should fetch.
  5. `&[redacted] passes the token.

A proof of concept, or PoC, is the smallest complete request that demonstrates the bug. Anyone can paste it into a tool and reproduce the behaviour.

Because the response is blind, the evidence came from stack trace errors. In the researcher's words, those errors not only facilitated a deeper understanding of the internal request handling mechanisms but also provided concrete evidence of the blind SSRF vulnerability's existence. In plain terms: the server did not hand back the fetched page, but when the internal fetch went wrong it printed debugging output, and that output proved the server had really tried to make the connection. The report does not include the text of any stack trace or the content of any response.

Root cause

Because the value is controlled by the person sending the request, the server can be pointed at [redacted] and other internal addresses. The stack trace errors were the evidence that the internal request was attempted.

An allowlist is the opposite of a blocklist: instead of listing what is forbidden, you list the only things that are permitted, and reject everything else.

Impact

A malicious actor could have used the endpoint to send internal requests to the Facebook corporate network. The vulnerability is blind: the attacker does not see the response body directly, and the evidence came from stack trace errors. The report does not enumerate which internal services were reachable or what data could be extracted beyond that.

Fix

The report states only that the issue was patched on August 11, 2020, the same day it was triaged. A robust fix would be to stop accepting arbitrary URLs in ewsUrl, or to validate them against a strict allowlist of expected hosts and reject loopback, link-local and private address ranges after DNS resolution.

Triaged means the security team reviewed the report and accepted it as a real issue worth fixing.

Timeline

Date Event
August 7, 2020 Reported
August 11, 2020 Triaged
August 11, 2020 Patched
December 3, 2020 Resolved
December 3, 2020 $10000 bounty awarded

Variants to test

If you want to look for similar bugs yourself, these are the directions the report suggests. Each one is a variation on the same idea: find a value the server fetches, then change where it points.

  1. Other URL-shaped parameters in the same JavaScript. Search bundled and hidden .js files for names like url, uri, endpoint, callback, webhook, feed and target. A positive result is a parameter whose value the server fetches, confirmed by pointing it at a listener you control and seeing the request arrive from the server's address.
  2. Loopback and metadata addresses. Replace http://[redacted]:PORT/ with other internal targets such as http://localhost:PORT/ or cloud metadata endpoints. A positive result is a distinct error, timing difference or outbound hit that shows the server attempted the connection.
  3. Scheme and redirect tricks. Try file://, gopher:// and an external URL that redirects to an internal one. A positive result is content or behaviour that only the internal target could produce.
  4. Token handling. The researcher tested various token formats before one worked. On other targets, test whether the token is validated at all, whether it is tied to the URL, and whether a documentation example token is accepted. A positive result is a request that reaches the fetch stage with a token the server should have rejected.
  5. Error-based confirmation. Where the response is blind, look for stack traces, verbose errors and timing differences. A positive result is an error that names the internal host or port you supplied, which is the same evidence used here.

Glossary

  • Allowlist: a list of things that are explicitly permitted; everything not on the list is rejected.
  • Blind SSRF: an SSRF where the attacker cannot read the fetched response directly and must infer success from side effects such as errors or timing.
  • Brute forcing: automatically trying many candidate names or values from a list until one works.
  • Bounty: a payment a company makes to a researcher who reports a valid security issue.
  • Endpoint: a specific URL on a server that accepts requests and performs an action or returns data.
  • Enumeration: systematically listing things, such as subdomains or files, to discover what exists.
  • 403 Forbidden: an HTTP status meaning the server refuses to fulfil the request.
  • JavaScript: the programming language that runs in web browsers and powers interactive pages.
  • JWT (JSON Web Token): a token format made of three dot-separated parts, carrying readable claims and a signature.
  • Loopback address: [redacted], which always refers to the same machine making the connection.
  • Parameter: a named value in a URL, written as name=value after a ? and separated by &.
  • Port: a numbered channel on a computer that a service listens on; the address plus the port identifies the service.
  • Proof of concept (PoC): the smallest complete request or set of steps that demonstrates a vulnerability.
  • Root cause: the underlying reason a vulnerability exists, as opposed to its symptoms.
  • SSRF (server-side request forgery): a bug where an attacker makes a server send a request to an address of the attacker's choosing.
  • Stack trace: debugging output listing the functions that were running when a program failed.
  • Subdomain: a name under a main domain, such as phishme.thefacebook.com under thefacebook.com.
  • Token: a string that proves identity or permission, checked by the server before doing sensitive work.
  • Triaged: reviewed and accepted by a security team as a genuine issue.
  • Wordlist: a text file of candidate names used as guesses in a brute force.
  • XMLHttpRequest: a browser feature that lets JavaScript send requests to a server without reloading the page.

More by Amine Aboud

View all

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

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.