/vuln-skills:go-vuln-ssrf-requestforgeryfrom vuln-skills
Audits Go code for SSRF, XSS, and CSRF vulnerabilities, covering HTTP client calls, URL handling, template rendering, and CSRF protection patterns.
Ships in vuln-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
当审计 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 个真实案例,需要时加载)。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
go-security, ssrf, xss, csrf, vulnerability-audit, code-review
26 skills in this plugin
/go-vuln-auth-bypassUse when auditing Go code involving authentication flows, RBAC policies, Kubernetes admission webhooks, JWT/OAuth token validation, or privilege escalation in cloud-native infrastructure. Covers CWE-287/863/269/284/285/862. Keywords: authentication bypass, authorization bypass, RBAC, admission webhook, JWT, OAuth, privilege escalation, Rancher, Kyverno, impersonation, namespace isolation, middleware auth/go-vuln-crypto-tlsUse when auditing Go code involving TLS configuration, certificate validation, JWT token parsing, SAML assertion verification, webhook signature checking, or cryptographic operations. Covers CWE-295/347/345. Keywords: InsecureSkipVerify, TLS, mTLS, certificate validation, JWT algorithm, SAML signature, cosign, sigstore, hmac.Equal, X.509, webhook HMAC/go-vuln-dosUse when auditing Go code involving goroutine management, channel operations, HTTP request handling, resource allocation, or panic recovery. Covers CWE-400/770/476. Keywords: denial of service, goroutine leak, channel deadlock, panic recover, io.ReadAll, resource exhaustion, OOM, HTTP/2 abuse, protobuf, unbounded allocation, rate limiting/go-vuln-info-disclosureUse when auditing Go code involving logging, error handling, HTTP response data, Kubernetes Secret management, or credential storage. Covers CWE-200/532/522/312/552. Keywords: information disclosure, credential leak, log exposure, Kubernetes Secret, json tag, struct formatting, error message, stack trace, Rancher, Argo CD, sensitive data/go-vuln-injectionUse when auditing Go code involving OS command execution, SQL queries, template rendering, or child command invocation. Covers CWE-78/89/77/94/88. Keywords: command injection, SQL injection, exec.Command, os/exec, database/sql, text/template, html/template, argument injection, shell injection, Gogs, Grafana, MCP stdio/go-vuln-path-traversalUse when auditing Go code involving file path operations, archive extraction, symlink handling, container volume mounts, or HTTP file serving. Covers CWE-22/59. Keywords: path traversal, directory traversal, filepath.Join, symlink, archive extraction, zip slip, tar, volume mount, go-git, Helm chart, os.Open, filepath.Cleannpx claudepluginhub yhy0/ghsa-skill-builder --plugin vuln-skillsOther plugins' skills for the same job