GraphQL field on Team node can be used to determine if External Program runs invite-only program
A GraphQL field on the Team node returned the internal policy text for programs that run a private, invite-only programme, even though that policy was not meant to be public. An attacker could use it to tell whether an external programme also runs a private programme and to read that private policy.
- Triaged in 28 days
- Fixed in 38 days
- Paid in 38 days
- Disclosed after 2 months
Summary by the program
Summary by the researcher
On 19th May, A new parameter policy_markdown_html been introduced inside the team Graphql query.
Using Graphql query, We can able to determine External program running privately on Hackerone as policy_markdown_html parameter was able to fetch private internal policy.
[Note: Using this parameter, it was also possible to determine any left private program's policy]
GRAPHQL TEAM QUERY
Request
query{
team(handle:"example") //handle - Program running externally or left private program's handle
{
name
policy_markdown_html
}
}
Response
{
"data": {
"team": {
"name": "example test",
"policy_markdown_html": "No Technology is perfect and example believes that working with skilled security researchers............"
}
}
}
There were 3 different conditions which I explained in this report:-
-
Condition 1 - When an external program doesn't have any policy defined,
policy_markdown_htmlwill benull. -
Condition 2- When an external program has defined policy but not running a private program internally,
policy_markdown_htmlwill fetch the same policy on the mentioned front-end page. -
Condition 3- When an external program has defined policy but running privately,
policy_markdown_htmlwill fetch internal policy and different from public policy.
On 26th June, patchwork was completed and the report was successfully resolved after doing retest.
I would like to thank Hackerone Team for resolving this issue. :)
Context
HackerOne exposes program data through a GraphQL API. A team node in that API carries fields describing a program, including its name and its policy. On 19 May a new field, policy_markdown_html, was added to the team GraphQL query. The field is named policy_markdown_html and returns the program policy.
The report describes how that new field could be used to tell whether an external program was also running an invite-only (private) program on HackerOne, because the field returned the internal policy rather than the public one.
Setup
The researcher only needed the ability to send GraphQL queries to HackerOne and to know the handle of a program. The handle is the program identifier used in the query, and the report notes it can be either an external program's handle or the handle of a program that has been left private. No special role, account or tooling is described.
Finding it
The researcher noticed that the newly introduced policy_markdown_html parameter could fetch a private internal policy. That is, for a program whose public page shows one policy, the GraphQL field could return a different, internal one. The researcher also noted that the same parameter made it possible to determine the policy of any program that had been left private.
The researcher set out three conditions describing what the field returns in each case.
Exploitation
Step 1: Query the team node for the policy field
The researcher sent a GraphQL query against the team node, selecting the program name and the new policy field. The handle in the query is the program's handle.
query{
team(handle:"example") //handle - Program running externally or left private program's handle
{
name
policy_markdown_html
}
}
The team(handle: ...) selection addresses a single program by its handle. name returns the program name, and policy_markdown_html returns the policy as HTML. The comment in the query records the researcher's point that the handle can belong either to an external program or to a program that has been left private.
Step 2: Read the response
The response returned the program name and the policy HTML.
{
"data": {
"team": {
"name": "example test",
"policy_markdown_html": "No Technology is perfect and example believes that working with skilled security researchers............"
}
}
}
The policy_markdown_html value is the rendered policy text. The researcher's point is that this value can differ from what the public front-end page shows, which is what reveals the private program.
Step 3: Interpret the three conditions
The researcher set out three conditions that determine what the field returns:
- When an external program does not have any policy defined,
policy_markdown_htmlisnull. - When an external program has a defined policy but is not running a private program internally,
policy_markdown_htmlreturns the same policy shown on the mentioned front-end page. - When an external program has a defined policy and is running privately,
policy_markdown_htmlreturns the internal policy, which differs from the public policy.
Condition 3 is the disclosure: a value that differs from the public policy indicates that the program also runs privately. Condition 1 and condition 2 are the baselines that make the difference meaningful.
Root cause
For a program that runs privately, the field returned the internal policy, which differed from the public policy. Because the field is reachable through the GraphQL API, the internal policy is exposed to anyone who can query it. The report does not describe the resolver code or any authorisation check, so the precise implementation mistake is not stated; the behaviour is that the field does not separate the public view from the internal one.
Impact
An attacker who knows a program handle can query the team node and compare the returned policy_markdown_html with the public policy page. A difference reveals that the external program is also running an invite-only program internally, and the internal policy text itself is disclosed. The same field also allowed the researcher to determine the policy of any program that had been left private. The report does not describe any further data being exposed beyond the policy.
Fix
The report states that a patchwork was completed on 26 June and that the report was resolved after a retest.
Variants to test
- Query other fields on the team node for a known external program and compare each value with the public page.
Hunting notes
What happened, in plain words
HackerOne is a website where companies (called programs) publish information about how security researchers can report bugs to them. Each program has a page with a policy: a document explaining what is in scope, what is not, and how to report a problem.
Some companies run two kinds of program on HackerOne. One is public: anyone can see it and read its policy. The other is invite-only (also called private): only invited researchers know it exists, and its policy is internal.
HackerOne also offers an API. An API is a way for one computer program to talk to a website and ask for data directly, without loading the normal web page. Think of it as a waiter: you ask for a specific dish by name, and the kitchen sends it back, without you walking into the kitchen yourself. HackerOne's API uses a style called GraphQL, which lets the caller describe exactly which pieces of data they want.
On 19 May, HackerOne added a new piece of data to the API: policy_markdown_html, which returns a program's policy as formatted web content (HTML). The researcher found that this new field did not always return the same policy that the public page shows. For a company that also ran a private program, the API returned the internal policy instead. That difference let anyone with an API query tell whether a public program was secretly running a private one, and it exposed the internal policy text itself.
The report states that a patchwork was completed on 26 June and that the report was resolved after a retest.
Background you need first
A few ideas come up again and again below, so here they are from zero.
- Program: a company's presence on HackerOne. It has a name, a page, and usually a policy.
- Handle: the short identifier a program uses in the API, a bit like a username. The report uses
exampleas a placeholder handle. - Policy: the document that says what a program wants reported and how. On the public page it is written for everyone to read.
- API: the direct data channel a website offers to programs, described above with the waiter comparison.
- GraphQL: a way of asking an API for data where you write a request shaped like the answer you want. You name the object you want (here, a team) and list the fields you want back (here, the name and the policy).
- Query: a single GraphQL request. It is just text you send to the API.
- Field: one named piece of data inside a query or response, such as
nameorpolicy_markdown_html. - Node: GraphQL's word for a single object you can ask about. The team node is one program.
- HTML: the language web pages are written in. When something is returned "as HTML", it comes with formatting instructions rather than as plain text.
null: the programming word for "nothing here". A field that isnullhas no value at all.- Information disclosure: the vulnerability class in this report. It means a system reveals something it should have kept hidden. Nothing is broken or changed; the problem is that data leaks to someone who should not see it.
- Private (invite-only) program: a program only invited researchers can see. Its existence and its policy are meant to stay internal.
- Front-end page: the normal web page a person sees in a browser, as opposed to the raw data the API returns.
The setup
To reproduce this, the researcher needed only two things: the ability to send GraphQL queries to HackerOne, and the handle of a program. No special account, role or tool is described in the report.
That low bar matters. If a bug can be triggered by anyone who can send a query, then anyone who can send a query is exposed to it.
Finding it
The researcher noticed that the newly added policy_markdown_html field could return a private internal policy. In other words, for a program whose public page shows one policy, the API could hand back a different, internal one. The researcher also noted that the same field made it possible to work out the policy of any program that had been left private.
The researcher set out three conditions describing what the field returns in each case. So whatever it returns can leak the existence of that private program.
Exploitation
Step 1: Ask the API for the policy field
The researcher sent a GraphQL query to the team node, asking for the program's name and the new policy field. The handle in the query is the program's handle.
query{
team(handle:"example") //handle - Program running externally or left private program's handle
{
name
policy_markdown_html
}
}
Line by line:
query{opens the request. Everything until the closing brace is what you are asking for.team(handle:"example")says: give me the single program whose handle isexample. The text after//is a comment, ignored by the API, recording the researcher's point that the handle can belong either to an external program or to one that has been left private.{opens the list of fields wanted for that program.nameasks for the program's display name.policy_markdown_htmlasks for the policy, formatted as HTML.- The two closing braces close the field list and the query.
Why this step: the researcher wanted to see what the new field actually returns, and to compare it with what the public page shows for the same program.
Step 2: Read the answer
The API replied with the program name and the policy HTML.
{
"data": {
"team": {
"name": "example test",
"policy_markdown_html": "No Technology is perfect and example believes that working with skilled security researchers............"
}
}
}
Line by line:
"data"is the wrapper GraphQL uses for a successful answer."team"is the single program that was asked about."name": "example test"is the program's display name."policy_markdown_html"holds the rendered policy text, starting with the sentence shown above.
The researcher's point is that this value can differ from what the public front-end page shows. That difference is what reveals the private program.
Step 3: Understand the three conditions
The researcher set out three conditions that decide what the field returns:
- When an external program does not have any policy defined,
policy_markdown_htmlisnull. - When an external program has a defined policy but is not running a private program internally,
policy_markdown_htmlreturns the same policy shown on the front-end page. - When an external program has a defined policy and is running privately,
policy_markdown_htmlreturns the internal policy, which differs from the public policy.
Condition 3 is the disclosure: a value that differs from the public policy tells you the program also runs privately. Conditions 1 and 2 are the baselines. Without them, a different value could just be noise; with them, the difference is meaningful evidence.
Why it happened
For a program that runs privately, the field returned the internal policy, which differed from the public policy. Because the field can be reached through the GraphQL API, the internal policy is exposed to anyone who can query it.
The report does not describe the code behind the field or any permission check, so the exact implementation mistake is not stated. What is clear is the behaviour: the field does not separate the public view from the internal one.
What an attacker could do with it
Someone who knows a program handle can query the team node and compare the returned policy_markdown_html with the public policy page. A difference reveals that the external program is also running an invite-only program internally, and the internal policy text itself is disclosed. The same field also let the researcher work out the policy of any program that had been left private.
The report does not describe any data beyond the policy being exposed.
The fix
Other things worth trying
These are variations on the same idea, useful if you want to look for similar bugs yourself:
Notes for someone starting out
Glossary
- API: a way for one program to ask a website for data directly, without loading the normal web page.
- Bounty: a payment a company makes to a researcher who reports a valid security problem.
- Disclosure: making a bug report public, here on 25 July 2020.
- Field: one named piece of data in a GraphQL query or response.
- Front-end page: the normal web page a person sees in a browser.
- GraphQL: a style of API where you write a request shaped like the answer you want.
- Handle: the short identifier a program uses in the API, like a username.
- HTML: the language web pages are written in; content returned as HTML carries formatting.
- Information disclosure: a vulnerability where a system reveals data it should have kept hidden.
- Invite-only (private) program: a program only invited researchers can see, whose existence and policy are meant to stay internal.
null: the programming value meaning "nothing here".- Policy: the document describing what a program wants reported and how.
- Query: a single GraphQL request.
- Retest: checking again after a fix to confirm the problem is gone.
- Vulnerability class: the general category a bug belongs to, such as information disclosure.