SuperAPI AI Directory

api-semantic-fuzz

Coding & development

View repository

Updated 10-16 09:29

About this skill

API semantic analysis and intelligent Fuzz methodology

Unlike blindly running dictionaries, this skill usesendpoint semanticsto infer parameters and business logic, and precisely construct payloads.

⛔ In-depth reference (required reading)

  • ⛔Required reading Common API parameter dictionary + Fuzz payload templates → read_skill(id="api-semantic-fuzz", path="references/api-fuzz-payloads.md")
  • Authentication bypass techniques → read_skill(id="api-fuzz", path="references/api-attack-techniques.md")

Phase 1: Endpoint semantic analysis

After obtaining the endpoint list, first analyze each endpoint'sbusiness meaning:

1.1 RESTful CRUD inference

发现: GET /api/users/123
推断:
  GET    /api/users          → 列出所有用户(信息泄露)
  GET    /api/users/1        → 遍历用户 ID(IDOR)
  POST   /api/users          → 创建用户(未授权注册)
  PUT    /api/users/123      → 修改用户(越权修改)
  DELETE /api/users/123      → 删除用户(越权删除)
  PATCH  /api/users/123      → 部分更新(Mass Assignment)

1.2 Path semantics → parameter inference

Endpoint pattern Inferred parameters Testing direction
/api/users/{id} id (int) IDOR: enumerate 1-1000
/api/search?q= q (string) SQL injection, XSS
/api/upload file (multipart) File upload bypass
/api/export?type= type, format Path traversal, SSRF
/api/config key, value Configuration tampering
/api/execute, /api/run cmd, command, script Command injection
/api/proxy?url= url, target, redirect SSRF
/api/template, /api/render template, content SSTI
/api/login username, password Brute force, SQL injection
/api/reset-password email, token, code Logic bypass
/api/pay, /api/order amount, price, quantity Amount tampering

1.3 Naming pattern expansion

发现: /api/v1/user/info
扩展尝试:
  /api/v1/user/list         # 用户列表
  /api/v1/user/detail       # 用户详情
  /api/v1/user/update       # 修改资料
  /api/v1/user/delete       # 删除用户
  /api/v1/admin/user/list   # 管理员接口
  /api/v2/user/info         # 旧版本
  /api/internal/user/info   # 内部接口

Phase 2: Parameter discovery

2.1 Common parameter name dictionary

Grouped by business scenario (not blind running):

Identity category: id, uid, user_id, userId, account, username, email, phone Pagination category: page, pageNum, pageSize, limit, offset, size, start Query category: q, query, search, keyword, filter, sort, order, orderBy File category: file, filename, path, url, filePath, dir, attachment Authentication category: token, auth, session, key, apiKey, access_token, refresh_token Operation category: action, type, method, cmd, op, status, role

2.2 Parameter existence probing

# 方法 1: 逐一添加参数观察响应变化
BASE="http://target.com/api/users"

# 基线响应
curl -s "$BASE" | wc -c  # 记录长度

# 逐一测试参数
for param in id uid page limit search q role status; do
    len=$(curl -s "$BASE?$param=1" | wc -c)
    echo "$param → $len bytes"
done
# 长度/状态码变化 = 参数被接受
# 方法 2: POST JSON body 参数探测
curl -s -X POST "$BASE" \
  -H "Content-Type: application/json" \
  -d '{"id":1}' | head -5

# 观察报错信息——很多框架会提示缺少哪些参数
# "missing required field: username" → 参数名泄露

2.3 Content-Type variant testing

# 同一端点换不同 Content-Type 可能走不同处理逻辑
curl -X POST "$BASE" -H "Content-Type: application/json" -d '{"id":1}'
curl -X POST "$BASE" -H "Content-Type: application/xml" -d '<id>1</id>'
curl -X POST "$BASE" -H "Content-Type: application/x-www-form-urlencoded" -d 'id=1'
# XML 路径可能有 XXE,form 路径可能有不同的过滤规则

Phase 3: Intelligent Fuzz

3.1 Fuzz by vulnerability type

For each discovered parameter, select a payload based on its semantics:

参数名含 id/num → IDOR 遍历 + SQL 注入
参数名含 url/path/file → SSRF + 路径穿越
参数名含 search/q/query → SQL 注入 + XSS
参数名含 template/content → SSTI
参数名含 cmd/exec/run → 命令注入
参数名含 redirect/return/next → 开放重定向
参数名含 amount/price/qty → 业务逻辑(负数、零、极大值)

3.2 IDOR bulk verification

# 对数字 ID 端点做快速 IDOR 扫描
for i in $(seq 1 20); do
    resp=$(curl -s -o /dev/null -w "%{http_code}:%{size_download}" "$BASE/api/users/$i" -H "Cookie: $COOKIE")
    echo "ID=$i → $resp"
done
# 如果不同 ID 都返回 200 且内容不同 → IDOR 确认

3.3 Permission boundary testing

# 用普通用户 token 访问管理端点
curl -s "$BASE/api/admin/users" -H "Authorization: Bearer $USER_TOKEN"
# 200 → 垂直越权

# 去掉认证头
curl -s "$BASE/api/admin/users"
# 200 → 未授权访问

# 用 A 用户 token 访问 B 用户数据
curl -s "$BASE/api/users/OTHER_USER_ID" -H "Authorization: Bearer $A_TOKEN"
# 返回 B 的数据 → 水平越权

Phase 4: Response analysis

Key observations

  • Error information → framework, database type, internal path leakage
  • Extra fields → the API returned fields not displayed on the frontend (password_hash, internal_ip, role)
  • Debug information → debug=true parameter may enable detailed errors
  • Response time differences → basis for determining blind injection/blind SSRF
  • Abnormal data volume → limit=-1 or pageSize=99999 leads to full data leakage

Response pattern comparison

Response Meaning Next step
{"error": "missing field: xxx"} Parameter name leakage Complete parameters and retry
{"error": "invalid type"} Type information Try different types
{"data": [...], "total": 10000} Large data volume Try exporting everything
500 + SQL stack trace SQL injection entry point → sql-injection-methodology
200 但空数组 Endpoint exists Change parameters/method and retry

Precautions

  • Run semantic analysis before fuzzing; do not blindly send requests and waste time
  • Focus onResponse differences——Only when different parameter values at the same endpoint return different results does it have value
  • Management-type endpoints (/admin/, /manage/) have the highest priority
  • After discovering one valid parameter, try combining other parameters (e.g., id + role may trigger Mass Assignment)
  • Immediately upon confirming each vulnerability evidence_save + report_vuln