全面的代码安全检查和服务器安全审计skill。适用于:(1) 代码漏洞扫描 - 检测SQL注入、XSS、SSRF等OWASP Top 10漏洞,(2) 依赖安全检查 - 识别过时或有漏洞的第三方库,结合实时搜索确认最新CVE,(3) 服务器配置审计 - 检查SSH、防火墙、权限等安全配置,(4) 敏感信息泄露检测 - API密钥、密码、令牌等硬编码检测,(5) 容器安全扫描 - Docker镜像和Kubernetes配置审计,(6) CI/CD安全检查。触发关键词:"安全检查"、"漏洞扫描"、"代码审计"、"security audit"、"vulnerability scan"、"SAST"、"dependency check"、"CVE检测"等。不用于:修复单个已定位的bug、编写新的安全功能代码、对无授权的第三方系统做扫描或渗透测试。
npx skills add https://github.com/staruhub/ClaudeSkills --skill security-audit
全面的安全审计工具,覆盖代码静态分析(SAST)、依赖检查(SCA)和服务器配置审计。
本文件不维护具体CVE清单。凡涉及"某版本是否有漏洞"的结论,必须现场查询:
用 web search 查 [框架/库名] CVE advisory [当前年份],或查官方 security advisory 页面。
正文中出现的具体CVE(如 Log4Shell CVE-2021-44228)仅作为漏洞类别的历史案例,不代表当前威胁全貌。
安全审计遵循以下步骤:
# 安装核心Python扫描工具(优先用 venv/pipx,避免污染系统 Python)
pipx install bandit semgrep || pip install safety bandit semgrep pip-audit
# 安装Node.js安全工具(如需要)
npm install -g npm-audit-html retire
运行综合扫描脚本:
python3 /path/to/skill/scripts/full_scan.py /path/to/project
只需单项检查时用独立脚本:scripts/dependency_check.py(仅依赖漏洞)、scripts/secrets_scan.py(仅敏感信息/密钥,输出已对命中值脱敏)。
注意:dependency_check.py 内置的是离线基线表(会过时),命中结果标注 source: offline-baseline,必须用 pip-audit/npm audit 或官方 advisory 实时确认后才能下结论——与上文"不维护 CVE 清单"原则一致,基线表是预筛工具而非权威来源。
| 漏洞类型 | 历史案例 | 检测方式 |
|---------|--------|---------|
| 框架/依赖 RCE | Log4Shell (CVE-2021-44228) | 依赖版本检查 + 现场搜索最新 advisory |
| SQL注入 | CWE-89 | SAST + 模式匹配 |
| 命令注入 | CWE-78 | SAST + 模式匹配 |
框架级 RCE 层出不穷(React/Next.js 等生态近年多次爆出),检查依赖前先 web search 该框架当年的 CVE 列表。
> 运行时先 web search 确认当前版本(现行为 2025 版);无法联网时使用下面这份记录时点的离线清单,并在报告中标注可能过时。以下条目为通用类别参考:
# Bandit - Python SAST
bandit -r ./src -f json -o bandit_report.json
# Safety - 依赖漏洞检查
safety check --json > safety_report.json
# pip-audit - 依赖审计
pip-audit --format json > pip_audit.json
# npm audit - 依赖漏洞
npm audit --json > npm_audit.json
# Retire.js - 检测过时库
retire --js --outputformat json > retire_report.json
框架专项检查:先 web search 确认该框架当前的高危 CVE 及官方检测工具,再执行(历史案例见 references/remediation_guide.md)。
# Semgrep - 多语言SAST
semgrep scan --config=auto --json > semgrep_report.json
# Gitleaks - 密钥泄露检测
gitleaks detect --source . --report-format json --report-path gitleaks.json
# Trivy - 容器/依赖扫描
trivy fs --format json --output trivy.json .
# 检查SSH配置
grep -E "^(PermitRootLogin|PasswordAuthentication|PubkeyAuthentication)" /etc/ssh/sshd_config
# UFW状态
sudo ufw status verbose
# iptables规则
sudo iptables -L -n -v
# 查找SUID文件
find / -perm -4000 -type f 2>/dev/null
# 检查world-writable文件
find / -perm -002 -type f 2>/dev/null
具体漏洞的修复命令和历史案例(含 React2Shell 完整处置记录)详见 references/remediation_guide.md。
full_scan.py 在 security_report/ 下生成:
security_report/
├── summary.md # 执行摘要 + 覆盖范围声明(工具缺失时列出缩窄项)
└── security_report.json # 结构化发现,按 critical/high/medium/low/info 分级 + skipped_tools
secrets_scan.py 另行生成 secrets_report.{json,md}(命中值已脱敏)。
汇总多来源发现、按严重性分文件时,从 security_report.json 的分级结构派生即可,不必依赖固定的六文件布局。
| 陷阱 | 具体表现 | 应对 |
|------|---------|------|
| 扫描工具缺失时静默跳过 | 环境装不上 bandit/semgrep,直接不扫也不说明 | 降级为 grep 模式匹配,并在报告中明确声明覆盖范围缩窄 |
| 把"扫描通过"当"安全" | 工具零报告就写"系统安全" | 工具只覆盖已知模式;结论必须限定范围并列出未检查项 |
| --break-system-packages 污染环境 | 全局 pip 安装扫描工具破坏系统 Python | 优先用 venv 或 pipx;用户环境受限时先征求同意 |
| 误报未过滤直接进报告 | SAST 把测试夹具、示例代码报为漏洞 | 每条 Critical 人工复核上下文,误报标注原因后移出 critical 列表 |
references/detection_rules.mdreferences/remediation_guide.mdreferences/server_hardening.mdevals/routing-evals.json(改动本 skill 的 description 后应重跑)Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.
This skill should be used when the user asks to "perform cloud penetration testing", "assess Azure or AWS or GCP security", "enumerate cloud resources", "exploit cloud misconfigurations", "test O365 security", "extract secrets from cloud environments", or "audit cloud infrastructure". It provides comprehensive techniques for security assessment across major cloud platforms.
You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.
Comprehensive Flow Nexus platform management - authentication, sandboxes, app deployment, payments, and challenges
This skill should be used when the user asks to "escalate privileges on Linux", "find privesc vectors on Linux systems", "exploit sudo misconfigurations", "abuse SUID binaries", "exploit cron jobs for root access", "enumerate Linux systems for privilege escalation", or "gain root access from low-privilege shell". It provides comprehensive techniques for identifying and exploiting privilege escalation paths on Linux systems.
Expert malware analyst specializing in defensive malware research, threat intelligence, and incident response. Masters sandbox analysis, behavioral analysis, and malware family identification. Handles static/dynamic analysis, unpacking, and IOC extraction. Use PROACTIVELY for malware triage, threat hunting, incident response, or security research.
This skill should be used when the user asks to "use Metasploit for penetration testing", "exploit vulnerabilities with msfconsole", "create payloads with msfvenom", "perform post-exploitation", "use auxiliary modules for scanning", or "develop custom exploits". It provides comprehensive guidance for leveraging the Metasploit Framework in security assessments.
Expert in secure mobile coding practices specializing in input validation, WebView security, and mobile-specific security patterns. Use PROACTIVELY for mobile security implementations or mobile security code reviews.
Take staruhub/security-audit from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip, npm.
Without those the skill loads but fails at the first command.