From vuln-skills
Audits Python code for SSRF (CWE-918) vulnerabilities in HTTP clients (requests, httpx, urllib, aiohttp), webhooks, proxies, file/model downloads, and SVG/XML external resources.
npx claudepluginhub yhy0/ghsa-skill-builder --plugin vuln-skillsThis skill uses the workspace's default tool permissions.
当审计 Python 代码中涉及外部 URL 请求、HTTP 客户端调用、文件下载、资源代理等操作时加载此 Skill。
Detects SSRF vulnerabilities in HTTP requests from user URLs, proxies, webhooks, and URL previews. Flags risks and suggests fixes with scheme/host/IP checks and redirect handling.
Analyzes PHP code for SSRF vulnerabilities. Detects unvalidated URLs, internal network access, DNS rebinding, cloud metadata access, URL parsing bypasses. Use for PHP web app security audits.
Detects Server-Side Request Forgery (SSRF) vulnerabilities where user-controlled URLs access internal services, cloud metadata, or bypass networks in JS/TS, Python, Go, Ruby code. Audits webhooks, URL previews, imports.
Share bugs, ideas, or general feedback.
当审计 Python 代码中涉及外部 URL 请求、HTTP 客户端调用、文件下载、资源代理等操作时加载此 Skill。
Sources(用户可控 URL 来源):
ImageUrl、AudioUrl、DocumentUrl)xlink:href、@import url()、<use href=>)Sinks(发起请求的函数/操作):
requests.get(url) / requests.post(url) / session.request(method, url)httpx.AsyncClient().get(url) / httpx.Client().stream("GET", url)urllib.request.urlopen(url) / urllib.request.Request(url)aiohttp.ClientSession().get(url)SimpleWebPageReader().load_data([url])(LlamaIndex 等 LLM 框架)url_fetcher)socket.create_connection() / 底层 TCP 连接Sanitization(URL 验证/限制):
http:// 和 https://,拒绝 file://、gopher://、ftp:// 等ipaddress 模块检查,推荐 ipaddress.ip_address(ip).is_private 或 is_reserved 或 is_loopback。需覆盖 RFC 1918 私有地址、环回地址、链路本地地址及 IPv6 对应段metadata.google.internal 等 DNS 名称socket.getaddrinfo() 解析再检查 IP,防止 DNS rebindingallow_redirects=False 手动跟踪validators.domain() 验证或 allowed_urls 配置检测路径:
搜索 SSRF sink 的 Grep 模式:
# HTTP 客户端调用
grep -rn "requests\.\(get\|post\|put\|delete\|head\)" --include="*.py"
grep -rn "httpx\.\|AsyncClient\|Client()" --include="*.py"
grep -rn "urlopen\|urllib\.request" --include="*.py"
grep -rn "aiohttp.*\.get\|ClientSession" --include="*.py"
# URL 验证函数
grep -rn "is_private\|is_reserved\|is_loopback\|gethostbyname" --include="*.py"
grep -rn "allow_redirects\|follow_redirects" --include="*.py"
# SVG/XML 外部资源
grep -rn "xlink\|url_fetcher\|external_resource" --include="*.py"
requests.get、httpx.get、urlopen、session.request 等)http/https 协议而未检查目标 IP?(如 is_http_url() 只检查 scheme)gethostbyname() 验证与实际 HTTP 请求之间是否存在时间窗口?follow_redirects=True/allow_redirects=True 而未验证重定向目标?xlink:href、CSS @import)?allowed_urls 默认值:URL 白名单的默认值是否过于宽松(如 .*)?::1、::ffff:127.0.0.1、IPv4-mapped IPv6)?以下情况通常不是 SSRF 漏洞:
requests.get("https://api.github.com/..."))unsafe=True 模式:如 CairoSVG 的 unsafe 参数,用户明确选择允许外部资源open(path) 读取本地文件不属于 SSRF(但可能是路径遍历)os.getenv() 获取的 URL 通常由运维人员配置