Skip to content
Info disclosure Write-up Intermediate

Why you shouldn’t share links on Facebook

Facebook's API allowed anyone to retrieve the URL of a link that had been shared on Facebook, even if the link was shared privately, by guessing or enumerating object identifiers. An attacker could access confidential links, including Google Docs with sensitive information, without permission.

Inti De Ceukelaire Follow

Published on medium.com

Earlier this week, security researchers at Checkpoint discovered a vulnerability that would have allowed attackers to change messages and links sent through Facebook messenger. Facebook quickly patched the bug … but did you know links sent privately through messenger can be read by anyone?

Inti De Ceukelaire, 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. 7 min read.

Context

Facebook's link sharing feature works like this: the first time a specific link is shared on Facebook, Facebook's crawler visits the shared page, extracts the title, the description and the thumbnail image, assigns a unique identifier and stores that information. The next time Facebook displays the link, it fetches the stored information from the database instead of crawling the page again. That caching behaviour is normal and harmless, provided the stored data stays private.

Every object stored on Facebook, whether a picture, a status or a link, gets a unique, non-chronological identification number. Mark Zuckerberg, for example, is object number four.

Now I’m wondering who’s number one From the original on medium.com

A developer can request an object by its number through the Facebook API, an interface for developers to connect with Facebook. The API is supposed to return the corresponding information only if the caller has permission to access it, so you cannot simply read someone else's private status update without their permission. The researcher found that requesting a link object by its number returned the stored URL.

Setup

The researcher used his own Facebook account and the Facebook API to request objects by their identification number. A friend, Bas, acted as the victim. Bas created a Google document with confidential information and shared the link privately, then sent that link to himself through Facebook Messenger and clicked it. Bas also used Facebook's debugger tool to read the object identification number attached to the post and passed that number to the researcher. No special tooling beyond the API, the debugger and a short script is described.

Finding it

Requesting objects by number mostly behaved as documented. Most of the time the API returned an error saying the object either did not exist or that the caller did not have permission to view it:

No permission to access 39402139014 From the original on medium.com

As the researcher was about to give up, a URL popped up. On its own it was not very useful: a timestamp and a string that said "website".

A website? How’s that an object in Facebook? From the original on medium.com

He then appended url to his initial request, asking Facebook to display the link address as well. To his surprise, this worked:

Apparently someone visited this URL from Facebook back in 2013 when it was still online From the original on medium.com

The response showed that someone had visited that URL from Facebook back in 2013, when it was still online. The API returned the stored link address for the object.

Exploitation

Step 1: create a private link on the victim side

The researcher asked Bas to create a Google document containing confidential information and to share the link privately. On Bas's side the document looked like this:

Bas’ side: An example of a Google Document with confidential information From the original on medium.com

Step 2: get the link scraped by Facebook

Bas then used Facebook Messenger to send the link to himself and clicked on it. Sharing a link with yourself looks harmless, but the click is what causes Facebook to crawl and store the link.

Bas’ side: sharing the link with himself on messenger. Harmless, right? From the original on medium.com

Step 3: read the object identifier

Because the link was saved to Facebook's database when Bas opened it via Messenger, the researcher asked him to use the Facebook debugger tool to obtain the object identification number and pass it on. The debugger showed that the URL had been scraped when it was clicked:

Bas side: the URL was scraped when it got clicked From the original on medium.com

The tool also displayed the number identifier attached to the post. That number was just another number that someone could have guessed or stumbled upon.

Step 4: request the object from the attacker account

Back on his own account, the researcher requested the object attached to that number. The URL popped up in the response:

On my side: enter a number, get a link From the original on medium.com

Moments later he was able to open the confidential Google document:

My view: successfuly ‘hacked’ into Bas’ secret document From the original on medium.com

Step 5: enumerate identifiers at scale

After reproducing the issue a couple of times, the researcher wanted to know whether other people's private links could be obtained the same way. He wrote a quick script that takes any identification number and increments it gradually to discover other links. It worked:

A script I wrote to extract links from Facebook. For this example, I checked all the links to make sure they weren’t confidential From the original on medium.com

For the example shown, he checked all the extracted links to make sure they were not confidential. The results did not include an ID for the user who shared the link, but some sharers could still be identified because their user id, the number corresponding to their account, was included in the link itself.

Facebook does block excessive requests, but the researcher notes there are ways to bypass that, for example using multiple access tokens and, if needed, VPNs. Rate limiting will not stop someone who is determined.

Root cause

The link object is stored with a unique identifier and the API returns its stored fields, including the URL, to any caller who knows or guesses the identifier. The API returned the stored URL of a link object to a caller who supplied its number. The researcher's script took an identification number and incremented it gradually to discover other links. Facebook does block excessive requests, but the researcher notes it can be bypassed with multiple access tokens and VPNs.

Impact

An attacker who knows or guesses an object identifier can retrieve the URL of a link that was shared privately, including links sent only to oneself through Messenger. The researcher states that, from his testing, a link is stored from the moment someone actually clicks it on Facebook; links that nobody clicks are not stored. As far as he knows, it does not matter where or how the link was shared: links shared through Messenger, private groups, status updates or the mobile application all seemed vulnerable to the methods described.

The value is not in the link itself but in what links often contain. In the small set of extracted URLs the researcher already found:

  • Names: Heather, Jenny, Paula, Yollanda, Bernardo, and others.
  • Location or language.
  • Attachments or pictures from the FB CDN: direct links that sometimes allow access bypassing privacy restrictions.
  • Application or game data: parameters such as friend_level, friend_chips, user_name, group, steal_amount.
  • Secret links or hidden keys: editable Google Drive links, or links to hidden pages, websites and beta environments.

These categories are not mutually exclusive; a single URL can contain several of them, letting a total stranger gain personal information about the person who shared it. The researcher shows a set of redacted, innocent-looking links from the earlier extraction to make the point:

From the original on medium.com

The researcher is explicit about the limits. There are lots of objects on Facebook, and scanning all of them through the API would be really hard, if not impossible. An attacker would have to be very unlucky to stumble on the number linking to a particular secret link, though the odds increase if attackers monitor these numbers regularly. In about ten minutes he extracted 70 links. He also does not claim to know whether the links people send are being tracked this way; only that they could be.

Facebook's response

The researcher reported the issue through Facebook's responsible disclosure programme, with which he had had successful experiences before. Facebook's official response was that the behaviour would be deemed a won't-fix and was actually intentional.

Apparently, it Facebook has no problems with our privately shared links being accessible From the original on medium.com

The timeline as given in the article:

Date Event
29 May Researcher reports through Facebook's whitehat tool
31 May Facebook replies that it needs more information
31 May Researcher provides the requested information
2 June Researcher sends a follow-up, considering it a critical issue
7 June Researcher sends another friendly ping
7 June Facebook replies that it needs more information
7 June Researcher provides the requested information
8 June Facebook replies that this is intentional behaviour
9 June Researcher publishes the blog article

In an update at the top of the article, the researcher notes that Facebook decided to fix the issue after all. He says the post received far more attention than he expected, that he is glad people responded and Facebook listened, and that had he known it would gain this much attention he would have spent even more time discussing his concerns with the vendor before going public.

Fix

The article does not describe the technical change Facebook made. What it records is that Facebook first classified the behaviour as intentional and won't-fix, and later decided to fix it after the publication drew attention.

Variants to test

  • Other object types with extra fields. Request an object by number and append field names such as url to the request, as the researcher did. A positive result is a response that returns a field you should not be able to see for an object you do not own.
  • Sequential identifier walking. Take a known object number and increment it, collecting whatever the API returns. A positive result is a run of objects belonging to other users, especially ones whose content is private.
  • Links shared only with oneself. Have a test account send a link to itself through Messenger and click it, then request the resulting object from a second account. A positive result is the second account receiving the URL.
  • Different sharing surfaces. Repeat the test with links shared in private groups, in status updates and from the mobile application. A positive result is the same disclosure on any of these surfaces.
  • Rate-limit bypass. Repeat the enumeration with multiple access tokens and, if needed, VPNs. A positive result is sustained enumeration past the point where a single token gets blocked.
  • Sensitive parameters in URLs. Inspect extracted links for names, location or language, CDN attachment links, application or game parameters and secret links or keys. A positive result is any extracted URL that carries personal data or a credential the sharer did not intend to expose.

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

What happened, in plain words

Facebook stores a copy of every link that gets shared on it. When you paste a link into a post or a message, Facebook sends a small program called a crawler to visit that page. The crawler reads the page's title, its description and a small preview picture, gives the whole thing a number, and saves all of it in Facebook's database. The next time anyone shares the same link, Facebook does not visit the page again; it just pulls the saved copy out of the database. That is a normal way to make a website fast, and there is nothing wrong with it, as long as the saved copy stays private.

The problem this article describes is that the saved copy did not stay private. Every saved thing on Facebook has a unique, non-chronological identification number. Facebook offers developers a way to ask for a saved thing by its number, and it is supposed to refuse if you are not allowed to see that thing. For the link object tested, the API returned the stored web address to a caller who supplied its number, even though the link had been sent privately.

The researcher proved this with a friend's help, then wrote a small script that walked through numbers one after another and collected the links behind them. Facebook's answer was that this was intended behaviour and would not be fixed. After the article drew attention, Facebook changed its mind and fixed it.

Background: how Facebook handles a link

The first time a specific link is shared on Facebook, Facebook's crawler takes a look at the shared page, extracts the title, the description and the thumbnail image, assigns a unique identifier and then stores this information. The next time Facebook displays the link, it simply fetches this information from the database.

Think of it like a library that, the first time a book arrives, writes a short card describing it: title, a summary, a picture of the cover. Later, when someone asks about the book, the librarian reads the card instead of fetching the book again. Fast and sensible, as long as the card is not left on the counter for anyone to read.

Workings. Illustration: (c) Facebook From the original on medium.com

The illustration shows this flow: the crawler visits the page once, the details are stored, and later displays reuse the stored copy.

Every object has a number

All objects stored on Facebook, whether it's a picture, a status or a link, are given a unique, non-chronological identification number. Mark Zuckerberg is object number four:

Now I’m wondering who’s number one From the original on medium.com

The screenshot shows the profile of Mark Zuckerberg reached through object number four. The point is that objects are identified by simple numbers.

Asking for an object: the API

An API is a way for one piece of software to ask another piece of software for something, using a fixed set of requests. Think of a restaurant: you do not walk into the kitchen, you order from the menu, and the kitchen either serves you the dish or tells you it is not available to you. Facebook's API is that menu and counter for developers.

A developer can request an object by its number through the Facebook API, an interface for developers to connect with Facebook, which will return the corresponding information only if you have permission to access it. This means that you can't simply access someone else's private status update without obtaining their permission. Seems logical, right?

That permission check is the whole safety mechanism. The number is not a secret; the check is what stops a stranger from reading your private things. The finding in this article is that a link object's stored URL could be retrieved by its number.

Finding it

The researcher started playing with this feature on his own account. Most of the time, he got an error message that the object either did not exist or that he did not have permission to view it:

No permission to access 39402139014 From the original on medium.com

The screenshot shows the error for object 39402139014: no permission to access it. This is the API behaving correctly, refusing to hand over something the caller may not see.

As he was about to give up, a URL popped up. Cool, but this left him none the wiser: you can't do much with a timestamp and a string that says: "website".

A website? How’s that an object in Facebook? From the original on medium.com

The response contained a date and the word "website", which told him the object was a link but not which link it was.

Then he appended "url" to his initial request, asking Facebook if it would be so nice as to display the link address as well. To his surprise, this worked:

Apparently someone visited this URL from Facebook back in 2013 when it was still online From the original on medium.com

Appending a field name to a request is like asking the librarian for one more detail on the card: you already have the card, you just ask for the address line too. The API answered with the stored web address, and the response showed that someone had visited that URL from Facebook back in 2013, when it was still online. The important part is that the API handed over the stored address of the object.

Proving it with a real private link

Step 1: create a private link on the victim side

At this point, the researcher wondered if he could also use this to view links users privately shared, so he asked his friend Bas to help him out, create a Google doc and privately share the link. Here's what he received:

Bas’ side: An example of a Google Document with confidential information From the original on medium.com

The screenshot shows Bas's side: a Google document containing confidential information, with its link shared privately rather than publicly.

Step 2: get the link scraped by Facebook

Then he asked Bas to use Facebook Messenger to send the link to himself and click on it:

Bas’ side: sharing the link with himself on messenger. Harmless, right? From the original on medium.com

The screenshot shows Bas sharing the link with himself in Messenger. It looks harmless, and in normal use it is: nobody else is in the conversation. But the click is the trigger. From the researcher's testing, a link is stored in Facebook's database from the moment someone actually clicks it on Facebook; links that nobody clicks are not stored.

Step 3: read the object identifier

Since the link was saved to Facebook's database when Bas opened the link via Messenger, the researcher asked him to use Facebook's debugger tool to get the object identification number and provide it to him:

Bas side: the URL was scraped when it got clicked From the original on medium.com

The debugger is a public tool Facebook offers to webmasters so they can check how their page will look when shared. It showed that the URL had been scraped when it was clicked.

The tool also showed the number identifier attached to the post. That number was just another number that someone could have guessed or stumbled upon. Nothing about it was secret or tied to the researcher's account.

Step 4: request the object from the attacker account

Back to his own account. When he tried to access the object attached to the number above, the URL popped up:

On my side: enter a number, get a link From the original on medium.com

The screenshot shows the researcher's side: he entered the number and received the link address. He entered the number and received the link address.

Moments later, he was able to access the confidential Google document:

My view: successfuly ‘hacked’ into Bas’ secret document From the original on medium.com

The screenshot shows the document open on the researcher's screen. The private link had become a door anyone with the number could walk through.

Step 5: walking the numbers at scale

He tried to reproduce this a couple of times until he decided to find out whether it was also possible to get other people's (private) links exploiting this. He wrote a quick script that would take any identification number and increment it gradually to discover other links. It worked:

A script I wrote to extract links from Facebook. For this example, I checked all the links to make sure they weren’t confidential From the original on medium.com

The screenshot shows the script and its output. Incrementing a number means adding one to it and asking again, then adding one more, and so on: 100, 101, 102. Incrementing the number walks through other objects one by one. For the example shown, he checked all the links to make sure they weren't confidential.

The results did not include an ID for the user who shared the link, but some sharers could still be identified because their user id, the number corresponding to their account, was included in the link itself.

Facebook does block excessive requests, but the researcher notes there are ways to bypass that, for example using multiple access tokens and, if needed, VPNs. An access token is a short piece of text that proves to the API who is asking, a bit like a wristband at an event: one wristband gets you a limited number of drinks, but several wristbands get you more. A VPN is a service that routes your traffic through a different network address, so the server sees requests coming from somewhere else. Rate limiting, the practice of refusing too many requests from one source, will not stop someone who is determined.

Why this is a big deal

While you may only share links to funny cat videos with your friends, you should still be worried about this exploit. Sometimes, sensitive information (personal data, secret keys, …) are included in links without you even noticing. Just take a look at the redacted and quite innocent looking links from earlier:

From the original on medium.com

The screenshot shows a set of extracted links with the sensitive parts blacked out. In this small set of extracted URLs, the researcher already found some interesting info:

  • Names: Heather, Jenny, Paula, Yollanda, Bernardo, …
  • Location or language
  • Attachments or pictures from the FB CDN: direct link that sometimes allow access bypassing privacy restrictions
  • Application or game data: some parameters are friend_level, friend_chips, user_name, group, steal_amount, …
  • Secret links or hidden keys: such as the editable Google Drive links or links to hidden pages, websites and beta environments

A parameter is the part of a web address after a question mark that carries extra details, like the colour and size you pick when ordering a shirt. CDN stands for content delivery network, a set of servers that serve files such as images quickly. These categories are not mutually exclusive: some URLs include multiple parameter types listed above in one single link, thereby allowing a total stranger to gain personal information about you.

The researcher is clear about the limits. There are lots of objects on Facebook, and scanning all of them through the API would be really hard, if not impossible. You would be really unlucky if an attacker stumbled upon the number linking to your secret link, but the odds increase if attackers start monitoring these numbers on a regular basis. In about ten minutes, he was able to extract 70 links. He also does not claim to know whether the links people send are being tracked this way; only that they could be.

Facebook's response

He reported this issue to Facebook under their responsible disclosure program, which he'd had successful experiences with before. Responsible disclosure means telling the company privately first and giving it time to react before telling the world. Here's their official response:

Apparently, it Facebook has no problems with our privately shared links being accessible From the original on medium.com

The screenshot shows Facebook's reply: the behaviour would be deemed a won't-fix and was actually intentional. Friendly and descriptive as always, they told him this would be deemed a won't-fix and is actually intentional behaviour. He was puzzled: how can Facebook let this happen? Whilst it's not possible to get links for a specific user, you could easily run through results all day until you find something interesting.

The timeline as given in the article:

Date Event
29 May Researcher reports through Facebook's whitehat tool
31 May Facebook replies that it needs more information
31 May Researcher provides the requested information
2 June Researcher sends a follow-up, considering it a critical issue
7 June Researcher sends another friendly ping
7 June Facebook replies that it needs more information
7 June Researcher provides the requested information
8 June Facebook replies that this is intentional behaviour
9 June Researcher publishes the blog article

In an update at the top of the article, the researcher notes that Facebook decided to fix the issue after all. He says the post received far more attention than he expected, that he is glad people responded and Facebook listened, and that had he known it would gain this much attention he would have spent even more time discussing his concerns with the vendor before going public.

What the fix had to change

The article does not describe the technical change Facebook made. What it records is that Facebook first classified the behaviour as intentional and won't-fix, and later decided to fix it after the publication drew attention. In restaurant terms: the kitchen should check your reservation before serving the dish, no matter which dish number you read off the menu.

Things worth testing if you look for similar bugs

These are the variations the finding suggests, each with what counts as a positive result:

  • Other object types with extra fields. Request an object by number and append field names such as url to the request, as the researcher did. A positive result is a response that returns a field you should not be able to see for an object you do not own.
  • Sequential identifier walking. Take a known object number and increment it, collecting whatever the API returns. A positive result is a run of objects belonging to other users, especially ones whose content is private.
  • Links shared only with oneself. Have a test account send a link to itself through Messenger and click it, then request the resulting object from a second account. A positive result is the second account receiving the URL.
  • Different sharing surfaces. Repeat the test with links shared in private groups, in status updates and from the mobile application. A positive result is the same disclosure on any of these surfaces.
  • Rate-limit bypass. Repeat the enumeration with multiple access tokens and, if needed, VPNs. A positive result is sustained enumeration past the point where a single token gets blocked.
  • Sensitive parameters in URLs. Inspect extracted links for names, location or language, CDN attachment links, application or game parameters and secret links or keys. A positive result is any extracted URL that carries personal data or a credential the sharer did not intend to expose.

Glossary

  • API: a fixed way for one program to ask another program for data or actions, like ordering from a menu instead of entering the kitchen.
  • Access token: a short piece of text that proves to an API who is making a request, similar to a wristband that grants limited access.
  • Crawler: a program that visits web pages automatically and reads their contents, here to build a preview of a shared link.
  • CDN (content delivery network): a set of servers spread around the world that serve files such as images quickly.
  • Database: an organised store of data that a website can look things up in later.
  • Debugger tool: a public Facebook tool for webmasters that shows how a page will appear when shared, including the object number attached to it.
  • Enumeration: going through values one after another, here numbers, to find things you were not meant to see.
  • Exploit: a way of using a weakness to get a result the system was not supposed to allow.
  • Identifier (object number): the unique number Facebook gives each stored thing, such as a picture, a status or a link.
  • Increment: to add one to a number, so 100 becomes 101.
  • Object: any single stored item on Facebook, such as a photo, a post or a link.
  • Parameter: the part of a web address after a question mark that carries extra details, such as a name or a setting.
  • Permission check: the step where a system decides whether the person asking is allowed to see a particular item.
  • Rate limiting: refusing or slowing requests when one source makes too many in a short time.
  • Responsible disclosure: reporting a security problem privately to the company first and giving it time to react before telling the public.
  • Scraping: automatically reading and copying information from a web page.
  • Sequential: following in order, one after another, as consecutive numbers do.
  • Timestamp: a record of the date and time something happened.
  • URL: the address of a page or file on the web, what you type in the browser's address bar.
  • User id: the number that corresponds to a particular Facebook account.
  • VPN (virtual private network): a service that routes your internet traffic through a different network address, so requests appear to come from elsewhere.
  • Won't-fix: a company's decision that a reported behaviour will not be changed.

More by Inti De Ceukelaire

View all

6 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.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.