Searching-Internal-Gatekeeper-Constants
An endpoint for checking media effect metadata did not restrict access to employees, allowing anyone to search internal gatekeeper constants. An attacker could enumerate internal feature flag names by querying keywords.
Published on philippeharewood.com
Within Media Effects, https://www.facebook.com/fbcameraeffects/home/. There is a call for Facebook employees to check the metadata for allowing certain media effects to be published.
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.
Context
Facebook's Media Effects product lived at https://www.facebook.com/fbcameraeffects/home/. Within that product there is a call intended for Facebook employees: it lets them check the metadata that governs whether certain media effects are allowed to be published. That metadata is expressed as gatekeeper constants, the internal flags Facebook uses to toggle new features and experiments for employees and whitelisted groups. The researcher links to a public talk segment describing Gatekeeper as an internal tool for exactly that purpose.
The feature under test is therefore a typeahead lookup over gatekeeper constant names, exposed to the Media Effects front end so that employees can find the right constant when configuring an effect.
Setup
The report describes no special accounts, roles, tools or versions. The only precondition that matters is that the typeahead call is reachable from a normal, non-employee session: the researcher's point is precisely that it does not check who is calling.
Finding it
The employee-facing call to check effect metadata does not filter out non-employees. Because of that, an ordinary user can query the same typeahead and read back the names of Facebook's gatekeeper constants, including ones tied to internal projects. The researcher frames this as searching the gatekeeper constants that are being checked for media effects.
The embedded clip is the Gatekeeper talk segment the researcher cites to explain what these constants are: internal switches used to enable features and experiments for employees and whitelisted groups.
Exploitation
Step 1: query a known keyword
The typeahead takes the search term in the value query parameter. Starting from a keyword already associated with internal work, zuck, the request is:
HTTP POST https://www.facebook.com/media_effects/gk_typeahead/?value=zuck
The response returns a JSON payload wrapped in the usual anti-hijacking prefix:
for (;;);{"__ar":1,"payload":[{"order":0,"title":"zuck_team_early_access","uniqueID":"zuck_team_early_access"}],"bootloadable":{},"ixData":{},"gkxData":{},"lid":"1"}
The payload array holds one entry, with title and uniqueID both set to zuck_team_early_access. That is a gatekeeper constant name, disclosed to a caller who is not an employee.
Step 2: pivot on a returned term
The lookup can be repeated for keywords known to be associated with internal work. The researcher notes that you can start from a term returned by a previous query and use it to obtain more properties. Searching for early_access:
HTTP POST https://www.facebook.com/media_effects/gk_typeahead/?value=early_access
returns four entries:
for (;;);{"__ar":1,"payload":[{"order":0,"title":"face_filter_partnership_early_access","uniqueID":"face_filter_partnership_early_access"},{"order":1,"title":"archive.early_access_partners","uniqueID":"archive.early_access_partners"},{"order":2,"title":"highlights.early_access_partners","uniqueID":"highlights.early_access_partners"},{"order":3,"title":"zuck_team_early_access","uniqueID":"zuck_team_early_access"}],"bootloadable":{},"ixData":{},"gkxData":{},"lid":"1"}
Each result carries an order index, a title and a uniqueID, and the previously found zuck_team_early_access appears again at order 3. The other three names, face_filter_partnership_early_access, archive.early_access_partners and highlights.early_access_partners, are new constants surfaced by the pivot.
Step 3: enumerate in bulk
For grabbing constants in bulk, a single-character query is enough. The researcher gives the example of /media_effects/gk_typeahead/?value=a and then iterating from a to z.
Root cause
The typeahead endpoint was built for an employee-only workflow but did not enforce that restriction on the caller. The report's own summary is that the endpoint was inadvertently exposing a list of internal gating project names. The report's own summary is that the endpoint was inadvertently exposing a list of internal gating project names, and that the call does not filter non-employees. The report does not describe any additional defence that was bypassed; the exposure came from the absence of the access restriction, not from defeating one.
Impact
An endpoint was inadvertently exposing a list of internal gating project names. Anyone able to call it could search and enumerate those names, including constants tied to internal projects and early-access programmes, and could pivot from one disclosed name to related ones. The report does not describe any ability to read the values or state of the constants, only their names, and does not claim any further access beyond that disclosure.
Fix
The endpoint has been updated to restrict access appropriately. The timeline records it as fixed by Facebook on Dec 22, 2017.
Timeline
| Date | Event |
|---|---|
| Dec 21, 2017 | Report sent |
| Dec 21, 2017 | Further investigation by Facebook |
| Dec 22, 2017 | Fixed by Facebook |
| Jan 10, 2018 | Bounty awarded by Facebook |
Variants to test
- Typeahead endpoints behind employee-only UIs. Find any autocomplete or lookup that backs an internal admin or configuration screen, then call it from a normal account. A positive result is a JSON payload listing internal identifiers, feature flag names or project names that a non-employee should not see.
- Prefix enumeration. Send single-character queries across the alphabet and collect the union of results. A positive result is a stable, growing list of names that no public documentation mentions.
- Pivot chaining. Feed names returned by one query back in as the next
value. A positive result is additional related constants that share a naming convention, such as anearly_accessorpartnerssuffix. - Method and parameter handling. Try the same lookup with
GETas well asPOST, and with the search term in the body rather than the query string. A positive result is the same payload returned through a path that may sit behind different access rules. - Response wrapper checks. Look for the
for (;;);prefix on JSON responses; it marks Facebook-style endpoints where the front end trusts the response shape, and a lookup that returns internal names through it is worth reporting even when the UI never shows them.
What happened, in plain words
Facebook has a product called Media Effects, which lived at https://www.facebook.com/fbcameraeffects/home/. Inside that product there is a small helper that was meant for Facebook employees. When an employee configures a media effect (a filter, an effect you can apply to a photo or video), they need to check some settings that decide whether that effect is allowed to be published. Those settings are called gatekeeper constants.
A gatekeeper constant is an internal name for a switch. Facebook uses these switches to turn new features and experiments on or off for employees and for whitelisted groups (groups of people Facebook has explicitly allowed). Think of it like the fuse box in an office building: each fuse has a label, and flipping it turns a particular light or machine on. The labels themselves tell you what is being built and tested inside the building.
The problem was that the helper which lets employees look up these labels did not check whether the person calling it was actually an employee. Anyone with a normal Facebook account could call it and read back the names of Facebook's internal switches. The researcher found this and reported it.
This kind of mistake belongs to a broad family called broken access control: the feature works as designed, but it does not check who is allowed to use it. A useful everyday comparison is a staff-only door with a keypad that is wired to open for anyone who presses the button, without asking for the code.
The product and the feature
Media Effects is the part of Facebook where effects and filters live. Within it, there is a call intended for Facebook employees: it lets them check the metadata (the descriptive settings) that governs whether certain media effects are allowed to be published. That metadata is expressed as gatekeeper constants.
The researcher links to a public talk segment that describes Gatekeeper as an internal tool Facebook uses to toggle new features and experiments for employees and whitelisted groups. That link is the background for what the constants are.
The feature under test is therefore a typeahead lookup over gatekeeper constant names. A typeahead is the same thing as the suggestion box you see when you start typing in a search bar: as you type letters, matching suggestions appear. Here the suggestions are the names of internal switches, and the lookup is exposed to the Media Effects front end so employees can find the right constant when configuring an effect.
What you need before starting
The report describes no special accounts, roles, tools or versions. The only precondition that matters is that the typeahead call is reachable from a normal, non-employee session. That is exactly the researcher's point: the call does not check who is calling.
A session here means the state of being logged in. When you log in to a website, the site gives your browser a small piece of data (often a cookie) so it can recognise you on the next request. A normal session is just an ordinary logged-in account, not a staff account.
Finding it
The employee-facing call to check effect metadata does not filter out non-employees. Because of that, an ordinary user can query the same typeahead and read back the names of Facebook's gatekeeper constants, including ones tied to internal projects. The researcher frames this as searching the gatekeeper constants that are being checked for media effects.
The embedded clip is the Gatekeeper talk segment the researcher cites to explain what these constants are: internal switches used to enable features and experiments for employees and whitelisted groups.
Exploitation
Exploitation here just means using the feature in the way that reveals the problem. There is no trickery involved: the researcher simply sends the same kind of request the employee screen would send, from an ordinary account.
Step 1: query a known keyword
The typeahead takes the search term in the value query parameter. A query parameter is the part of a web address after the question mark. In ?value=zuck, the parameter is named value and its content is zuck. The server reads that and uses it as the search term.
Starting from a keyword already associated with internal work, zuck, the request is:
HTTP POST https://www.facebook.com/media_effects/gk_typeahead/?value=zuck
Line by line:
HTTP POSTsays this is a POST request. A request is a message your browser sends to a server asking it to do something. POST is one of the standard request types; it is normally used when you are sending data to the server rather than just asking for a page.https://www.facebook.comis the server being contacted, over HTTPS, the encrypted version of the web protocol./media_effects/gk_typeahead/is the path, the address of the specific feature on that server.gkis short for gatekeeper andtypeaheadis the suggestion lookup.?value=zuckis the search term being passed in. The researcher chosezuckbecause it is a keyword known to be associated with internal work.
The response returns a JSON payload wrapped in the usual anti-hijacking prefix:
for (;;);{"__ar":1,"payload":[{"order":0,"title":"zuck_team_early_access","uniqueID":"zuck_team_early_access"}],"bootloadable":{},"ixData":{},"gkxData":{},"lid":"1"}
Line by line:
for (;;);is a tiny piece of JavaScript placed at the very start of the response. It is an infinite loop that does nothing. Its purpose is to stop another website from being able to read the response as data: if a malicious page tried to load this response as a script, the loop would simply spin. This is the anti-hijacking prefix the report mentions.- Everything after that prefix is JSON, a text format for structured data made of names and values in curly braces and square brackets.
"__ar":1is a field in the response. The report does not explain what it means."payload"is the list of results. It is wrapped in square brackets because it is an array, an ordered list that can hold several items.- Inside it there is one entry:
{"order":0,"title":"zuck_team_early_access","uniqueID":"zuck_team_early_access"}.orderis the position in the list, starting at 0.titleis the name shown to the user.uniqueIDis the internal identifier for the same thing. "bootloadable":{},"ixData":{}and"gkxData":{}are empty objects, meaning they carry no data in this response."lid":"1"is another field.
The payload array holds one entry, with title and uniqueID both set to zuck_team_early_access. That is a gatekeeper constant name, disclosed to a caller who is not an employee. In other words, an ordinary account just learned the name of an internal switch.
Step 2: pivot on a returned term
The lookup can be repeated for keywords known to be associated with internal work. The researcher notes that you can start from a term returned by a previous query and use it to obtain more properties. This is called pivoting: using one piece of information you have found to discover more. It is like finding one word in a dictionary and using it to look up the words defined next to it.
Searching for early_access:
HTTP POST https://www.facebook.com/media_effects/gk_typeahead/?value=early_access
Line by line:
- The structure is identical to the first request. Only the search term changes:
value=early_accessinstead ofvalue=zuck. early_accesswas chosen because it appeared inside the name returned by the first query,zuck_team_early_access. The researcher is feeding part of a discovered name back in as a new search term.
This returns four entries:
for (;;);{"__ar":1,"payload":[{"order":0,"title":"face_filter_partnership_early_access","uniqueID":"face_filter_partnership_early_access"},{"order":1,"title":"archive.early_access_partners","uniqueID":"archive.early_access_partners"},{"order":2,"title":"highlights.early_access_partners","uniqueID":"highlights.early_access_partners"},{"order":3,"title":"zuck_team_early_access","uniqueID":"zuck_team_early_access"}],"bootloadable":{},"ixData":{},"gkxData":{},"lid":"1"}
Line by line:
- The
for (;;);prefix is the same anti-hijacking guard as before. - The
payloadarray now holds four entries instead of one. {"order":0,"title":"face_filter_partnership_early_access","uniqueID":"face_filter_partnership_early_access"}is the first result: a constant namedface_filter_partnership_early_access.{"order":1,"title":"archive.early_access_partners","uniqueID":"archive.early_access_partners"}is the second:archive.early_access_partners.{"order":2,"title":"highlights.early_access_partners","uniqueID":"highlights.early_access_partners"}is the third:highlights.early_access_partners.{"order":3,"title":"zuck_team_early_access","uniqueID":"zuck_team_early_access"}is the fourth: the same constant found in step 1, now appearing again.- The trailing fields
bootloadable,ixData,gkxDataandlidare unchanged from the first response.
Each result carries an order index, a title and a uniqueID, and the previously found zuck_team_early_access appears again at order 3. The other three names, face_filter_partnership_early_access, archive.early_access_partners and highlights.early_access_partners, are new constants surfaced by the pivot. The point of this step is that one name leads to more names, so the disclosure grows with each query.
Step 3: enumerate in bulk
For grabbing constants in bulk, a single-character query is enough. The researcher gives the example of /media_effects/gk_typeahead/?value=a and then iterating from a to z.
A prefix is the beginning of a word; a substring is any run of characters inside it. Iterating means repeating the same request with a different value each time, here one for each letter of the alphabet. Doing this across all 26 letters gives you the union of everything the lookup will reveal, without needing to guess individual names.
Root cause
The typeahead endpoint was built for an employee-only workflow but did not enforce that restriction on the caller. The report's own summary is that the endpoint was inadvertently exposing a list of internal gating project names. The report's own summary is that the endpoint was inadvertently exposing a list of internal gating project names, and that the call does not filter non-employees.
Authorisation is the process of deciding whether a person is allowed to do something. Authentication is proving who you are; authorisation is checking what you may do once you are known. Here the problem was authorisation: the server did not check that the caller was an employee. The report does not describe any additional defence that was bypassed; the exposure came from the absence of the access restriction, not from defeating one.
Impact
An endpoint was inadvertently exposing a list of internal gating project names. Anyone able to call it could search and enumerate those names, including constants tied to internal projects and early-access programmes, and could pivot from one disclosed name to related ones.
In plain terms: the leak was of labels, not of the switches themselves.
Fix
The endpoint has been updated to restrict access appropriately. The timeline records it as fixed by Facebook on Dec 22, 2017.
Timeline
| Date | Event |
|---|---|
| Dec 21, 2017 | Report sent |
| Dec 21, 2017 | Further investigation by Facebook |
| Dec 22, 2017 | Fixed by Facebook |
| Jan 10, 2018 | Bounty awarded by Facebook |
A bounty is a reward a company pays to someone who reports a security problem responsibly, rather than using it or telling everyone about it first.
Variants to test
These are the same kinds of checks applied to other features, for anyone learning from this report.
- Typeahead endpoints behind employee-only UIs. Find any autocomplete or lookup that backs an internal admin or configuration screen, then call it from a normal account. A positive result is a JSON payload listing internal identifiers, feature flag names or project names that a non-employee should not see. A feature flag is the same idea as a gatekeeper constant: a switch that turns a feature on or off.
- Prefix enumeration. Send single-character queries across the alphabet and collect the union of results. A positive result is a stable, growing list of names that no public documentation mentions.
- Pivot chaining. Feed names returned by one query back in as the next
value. A positive result is additional related constants that share a naming convention, such as anearly_accessorpartnerssuffix. A suffix is the end of a word. - Method and parameter handling. Try the same lookup with
GETas well asPOST, and with the search term in the body rather than the query string. A positive result is the same payload returned through a path that may sit behind different access rules. GET is the request type normally used when you simply ask for a page; the body is the part of a request that carries data separately from the address. - Response wrapper checks. Look for the
for (;;);prefix on JSON responses; it marks Facebook-style endpoints where the front end trusts the response shape, and a lookup that returns internal names through it is worth reporting even when the UI never shows them.
Glossary
- API: a way for one piece of software to ask another for data or actions, usually over the web, without a human clicking through pages.
- Array: an ordered list of items in JSON, written inside square brackets.
- Authentication: proving who you are, for example by logging in.
- Authorisation: deciding what a known user is allowed to do.
- Body: the part of a web request that carries data separately from the address.
- Bounty: a reward paid for a responsibly reported security problem.
- Broken access control: a class of bug where a feature does not check whether the caller is allowed to use it.
- Cookie: a small piece of data a site stores in your browser so it can recognise your session.
- Endpoint: a specific address on a server that a request can be sent to.
- Enumeration: systematically listing items one by one, for example by trying every letter.
- Feature flag: a switch that turns a feature on or off for certain people.
- Gatekeeper constant: Facebook's internal name for a switch used to toggle features and experiments for employees and whitelisted groups.
- GET: a request type normally used to ask for a page or resource.
- HTTPS: the encrypted version of the web protocol.
- JSON: a text format for structured data made of names and values.
- Media Effects: Facebook's product for effects and filters, at
https://www.facebook.com/fbcameraeffects/home/. - Metadata: descriptive settings about something, rather than its content.
- Parameter: a named value passed in a web address, such as
value=zuckafter the question mark. - Path: the part of a web address that points to a specific feature on the server.
- Payload: here, the list of results inside a JSON response.
- POST: a request type normally used when sending data to a server.
- Prefix: the beginning of a word.
- Pivot: using one piece of discovered information to find more.
- Query parameter: a parameter in the part of the address after the question mark.
- Request: a message a browser sends to a server asking it to do something.
- Session: the state of being logged in, recognised by the site across requests.
- Substring: any run of characters inside a word.
- Suffix: the end of a word.
- Typeahead: a search box that suggests matches as you type.
- Whitelisted group: a set of people explicitly allowed to access something.