GraphQL Injection: Identify An Injection Point

GraphQLExploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

A server MUST accept POST requests, and MAY accept other HTTP methods, such as GET. - GraphQL Over HTTP

  • GET endpoint

    js
    GET /graphql?query={yourQueryHere}
    GET /graphql?query={__schema{types{name}}}
    GET /graphiql?query={__schema{types{name}}}
    GET /graphql?query=query%20%7B%20user(id:%221%22)%20%7B%20id%20name%20%7D%20%7D
  • POST endpoint

    js
    POST /graphql/v1 HTTP/1.1
    Host: example.com
    Content-Type: application/json
    
    {
    "query": "query { user { id name } }"
    }

Check if errors are visible.

javascript
?query={__schema}
?query={}
?query={thisdefinitelydoesnotexist}

Comments

No comments yet.