Skip to content
Info disclosure Disclosed report Intermediate

Private information exposed through GraphQL filters

A GraphQL endpoint applied its field-level access restrictions to only the first condition inside an `or` filter, so later conditions were evaluated against the unrestricted schema. An attacker could therefore infer the value of fields they were not allowed to read, such as a team's state, by observing which records came back.

reigertje Follow

Originally disclosed on HackerOne

Medium 6.1 View original
  • Disclosed after 7 days

Summary: secure schema can be circumvented for graphql where filters by using or operator.

Description: When passing a where clause to a collection in the graphql endpoint, like teams(where:{ state: {_eq: soft_launched}}) it queries the state through the secure schema - so it will not return any teams where the state does equal soft_launched but you're not allowed to see the state.

However, when using an or operator. like teams(where:{_or: [{state: {_eq: soft_launched}, {state: {_eq: soft_launched}]} - only the first condition in the list seems to be converted to the secure variant. The second condition seems to be queried in the unprotected schema. So this will return teams where the state equals soft_launched - but I'm not allowed to see the state.

Looking at the resulting query also verifies this. for _or:[{submission_state: {_eq: open}}, {submission_state: {_eq: closed}}]:

vuln0.png
vuln0.png From the original on HackerOne

As you can see, for the first condition, submission_state has been converted to the secure __new_filterable_submission_state - but not for the second one. This probably also happens for and operator, but or was easier to verify.

Steps To Reproduce

  1. Open any graphql client (eg. https://electronjs.org/apps/graphiql)
  2. Run query
query {
  teams(where:{_or:[{state:{_eq:soft_launched}}, {state:{_eq:soft_launched}}]}) {
    edges {
      node {
        id
        state
      }
    }
  }
}
  1. Note that it returns teams with state: null, because you're not allowed to see it - but now we know it's soft_launched.
  2. Optionally, also note that removing one of the conditions from the or list does not return these teams. This is because the first item is converted to query through the secure schema.

████

Impact

Expose/derive private information from any filterable field for collections that use the where graphql filters. Potentially extra risky as we introduce more filter fields.

The original report as published on HackerOne, by reigertje. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the filter-rewriting logic that maps fields to their access-controlled equivalents only walked the first element of an `_or` (and probably `_and`) list, leaving the remaining conditions pointing at the raw schema.

Impact

Private information could be exposed or derived from any filterable field on collections that use `where` GraphQL filters, and the risk may grow as more filter fields are added.

What the attacker needed

Access to the GraphQL endpoint; a filterable field the user cannot read

How it was found

  1. Open any GraphQL client.
  2. Send a teams query whose where clause uses an `_or` list with the same restricted field condition twice.
  3. Observe that teams are returned with the state shown as null, revealing the hidden value.
  4. Remove one of the conditions and note the teams are no longer returned.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Some systems hide certain fields from users, and when you filter a list by a hidden field they quietly swap in a safe version of that field. Here that swap only happened for the first item in an `or` list, so the second item was checked against the real, hidden value. By seeing which records appeared, a user could work out the hidden value without ever being shown it.

What is Info disclosure?

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

More by reigertje

View all

1 more disclosed report, best first.

More from HackerOne

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

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