From vuln-skills
Audits Go code for SSRF, XSS, and CSRF vulnerabilities in HTTP clients, URL handling, HTML templates, web frameworks like Gin/Echo/Fiber, webhooks, and CSRF protection.
npx claudepluginhub yhy0/ghsa-skill-builder --plugin vuln-skillsThis skill uses the workspace's default tool permissions.
当审计 Go 代码中涉及 HTTP 客户端请求、webhook 回调、URL 处理、HTML 模板渲染、CSRF 防护时加载此 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.
Audits Go apps for security: input validation, SQL injection prevention, authentication/authorization, secrets management, TLS, OWASP Top 10, secure coding patterns. Use for vulnerability checks, hardening services, auth reviews.
Share bugs, ideas, or general feedback.
当审计 Go 代码中涉及 HTTP 客户端请求、webhook 回调、URL 处理、HTML 模板渲染、CSRF 防护时加载此 Skill。
Sources(攻击入口):
apiCall URLSinks(HTTP 请求发起点):
http.Get(userURL) / http.Post(userURL, ...)http.Client{}.Do(req) 其中 req.URL 来自用户net.Dial(userHost + ":" + port)grpc.Dial(userAddr)url.Parse(userURL) -> http.NewRequest("GET", parsedURL, nil)Sanitization(SSRF 防护):
127.0.0.1, 10.0.0.0/8, 169.254.169.254, ::1)CheckRedirect 返回错误)ssrf 防护库(如 github.com/trufflesecurity/of-ssrf)http.Client{Timeout: 10 * time.Second} -- 设置请求超时防止 hang(默认无超时)Sources(攻击入口):
Sinks(XSS 注入点):
template.HTML(userInput) -- 类型转换绕过 html/template 自动转义template.JS(userInput) / template.CSS(userInput) -- 同上c.HTML(200, template) (Gin) + text/template 而非 html/templatec.String(200, userInput) with Content-Type: text/htmlw.Write([]byte(userInput)) with text/html Content-TypeSanitization:
html/template 自动转义(但 template.HTML() 类型转换会绕过)bluemonday HTML sanitizerhtml.EscapeString(userInput)Content-Type header(application/json 而非 text/html)Sources(攻击入口):
Sinks(状态修改端点):
Sanitization:
gorilla/csrf 中间件SameSite=Strict / SameSite=Lax cookie 属性X-CSRF-Token header)检测路径:
# SSRF — HTTP 客户端调用
grep -rn "http.Get\|http.Post\|http.Client\|http.NewRequest" --include="*.go"
# URL 解析
grep -rn "url.Parse\|url.PathEscape\|net.Dial\|grpc.Dial" --include="*.go"
# XSS — template.HTML 类型转换
grep -rn "template.HTML\|template.JS\|template.CSS" --include="*.go"
# text/template 用于 HTML
grep -rn '"text/template"' --include="*.go"
# CSRF 中间件
grep -rn "csrf\|gorilla/csrf\|SameSite\|csrfToken" --include="*.go"
# Webhook 回调
grep -rn "webhook\|callback.*url\|notify.*url" --include="*.go"
# DNS rebinding 防护
grep -rn "net.LookupIP\|net.ResolveIPAddr\|IsPrivate\|IsLoopback" --include="*.go"
template.HTML() 类型转换和 text/template 使用,确认用户输入是否绕过了 auto-escapingSameSite 属性http.Get(userURL) SSRF 审计 (CWE-918):HTTP 客户端是否使用用户提供的 URL?是否验证了目标 URL 不指向内网地址(127.0.0.1, 10.x.x.x, 169.254.169.254)?apiCall 跨 Namespace SSRF 审计 (CWE-918):Kyverno policy 的 apiCall 是否使用了 ServiceAccount 的集群权限访问其他 namespace 的 API?低权限用户是否能通过 policy 间接发起请求?template.HTML() 类型转换审计 (CWE-79):是否将用户输入通过 template.HTML(userInput) 类型转换?这会绕过 html/template 的自动转义,等同于直接输出原始 HTML。text/html Content-Type 返回未转义的用户输入?c.HTML() 是否使用 html/template?gorilla/csrf 中间件是否正确注册?SameSite=Lax 或 SameSite=Strict?SameSite=None 需要 Secure 标志且仅在 HTTPS 下使用。以下模式不是此类漏洞:
http.Get("https://api.github.com/...") 无用户控制template.HTML 用于静态内容 -- 如硬编码的 HTML 片段以下模式需要深入检查:
http.Client 默认跟随重定向 -- 第一跳是合法 URL,但重定向到内网html/template + 自定义 FuncMap -- FuncMap 中的函数是否返回 template.HTML 类型?详见 references/cases.md(7 个真实案例,需要时加载)。