From vuln-skills
Audits Go code for TLS/crypto vulnerabilities including InsecureSkipVerify, improper JWT algorithm checks, weak HMAC comparisons, SAML signature flaws, and certificate validation issues. Covers CWE-295/347/345.
npx claudepluginhub yhy0/ghsa-skill-builder --plugin vuln-skillsThis skill uses the workspace's default tool permissions.
当审计 Go 代码中涉及 TLS 配置、证书验证、JWT 解析、SAML 验证、Webhook 签名校验时加载此 Skill。
Audits JWT implementations for vulnerabilities like algorithm confusion, none alg bypass, weak secrets, JWK injection, and kid attacks in JS/TS/Python/Go code.
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.
Guides secure cryptography: hashing (Argon2id, bcrypt), encryption (AES-256-GCM), key management, JWT signing, TLS hardening, digital signatures for sensitive data.
Share bugs, ideas, or general feedback.
当审计 Go 代码中涉及 TLS 配置、证书验证、JWT 解析、SAML 验证、Webhook 签名校验时加载此 Skill。
Sources(不可信输入):
Authorization header)Sinks(密码学验证点):
tls.Config{InsecureSkipVerify: true} -- 跳过 TLS 证书验证,允许中间人攻击(MITM)http.Transport{TLSClientConfig: &tls.Config{...}} -- HTTP 客户端 TLS 配置jwt.Parse(tokenString, keyFunc) -- JWT 解析(无 WithValidMethods)xmldsig.Verify() / SAML signature validation -- XML 签名验证hmac.New() + == 比较 -- 非时间常量的 HMAC 比较x509.Certificate.Verify(opts) -- 证书链验证Sanitization(正确的密码学验证):
tls.Config{InsecureSkipVerify: false} + 正确的 RootCAs / ClientCAsjwt.Parse(token, keyFunc, jwt.WithValidMethods([]string{"RS256"})) -- 限制算法hmac.Equal(expected, actual) -- 时间常量比较x509.VerifyOptions 配置完整的 CA pool 和 usage 约束MinVersion: tls.VersionTLS12检测路径:
# InsecureSkipVerify
grep -rn "InsecureSkipVerify" --include="*.go"
# TLS 配置
grep -rn "tls.Config\|TLSClientConfig\|tls.Dial" --include="*.go"
# JWT 解析
grep -rn "jwt.Parse\|jwt.ParseWithClaims\|jwt.NewParser" --include="*.go"
# SAML 处理
grep -rn "saml\|SAML\|xmldsig\|xml.*signature" --include="*.go"
# HMAC 比较
grep -rn "hmac.New\|hmac.Equal\|crypto/hmac" --include="*.go"
# Cosign/Sigstore
grep -rn "cosign\|sigstore\|Verify.*signature\|VerifyImage" --include="*.go"
# 证书验证
grep -rn "x509.Verify\|x509.Certificate\|CertPool" --include="*.go"
# mTLS 配置
grep -rn "ClientAuth\|RequireAndVerifyClientCert\|ClientCAs" --include="*.go"
InsecureSkipVerify 是否为 true?alg: none 或算法混淆)?hmac.Equal(而非 == 或 bytes.Equal)?ClientAuth: tls.RequireAndVerifyClientCert)?InsecureSkipVerify: true 审计 (CWE-295):所有 tls.Config 实例是否将 InsecureSkipVerify 设为 false?设为 true 将跳过 TLS 证书验证,攻击者可实施中间人攻击(MITM)窃取或篡改通信内容。仅测试环境可接受,生产环境应正确配置 RootCAs CA 证书池。搜索所有 InsecureSkipVerify 出现的位置,包括测试代码中被复制到生产环境的情况。tls.Config.SessionTicketsDisabled 是否需要在 CA 更换时设为 true?jwt.Parse 是否指定了 jwt.WithValidMethods([]string{"RS256"})?未指定时攻击者可能用 HS256(对称算法)伪造 token,使用服务器的公钥作为 HMAC key。iss(签发者)、aud(受众)、exp(过期)claims?Mattermost 曾因未验证 OAuth state token 导致认证绕过。hmac.Equal() 而非 == 或 bytes.Equal()?非常量时间比较允许时间侧信道攻击逐字节猜测签名。tls.RequireAndVerifyClientCert?是否正确设置了 ClientCAs CA pool?NeuVector 曾因 mTLS 配置错误导致 MITM。以下模式不是此类漏洞:
InsecureSkipVerify: true -- _test.go 中连接 localhost 测试服务器hmac.Equal 用于非安全场景 -- 如校验数据完整性而非认证以下模式需要深入检查:
InsecureSkipVerify 通过配置文件控制 -- 默认值是什么?文档是否建议在生产环境禁用?VerifyPeerCertificate 回调 -- 是否正确验证了证书链?空回调 func(...) error { return nil } 等于跳过验证jwt.Parse 的 keyFunc 返回错误时的行为 -- 是否 fallback 到不验证?MinVersion 未设置 -- Go 默认 TLS 1.2,但显式设置更安全详见 references/cases.md(7 个真实案例,需要时加载)。