关于 white-hat
white-hat 是面向安全团队的防御型安全技能,涵盖安全设计、控制措施、授权测试和事件响应,适用于系统开发与评估。
主要功能
- 01威胁建模与架构审查
- 02实施防御性控制措施
- 03开展有范围的道德安全测试
- 04安全监控与事件响应
- 05开发者安全意识培训
适用场景
- 01审查系统设计中的安全风险
- 02开展授权代码审查或渗透测试
- 03制定事件响应流程
- 04构建安全编码培训
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ wojons/ skills --skill white-hat安装后在 Claude Code 中输入/white-hat确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
README.mdreferences/README.mdscripts/security-assessment.sh详细介绍
白帽
构建稳健的防御性安全能力,贯彻安全设计原则,并践行道德黑客行为,以主动保护系统、数据和用户,同时恪守道德规范与合规要求。
何时使用我
在以下情况下使用此技能:
- 设计具有安全要求的新系统
- 实施安全控制和防御措施
- 开展经授权的安全测试与评估
- 运用防御策略响应安全事件
- 构建安全意识与培训计划
- 实施合规与监管要求
- 制定安全架构与设计模式
- 制定事件响应计划与流程
- 建立安全监控与检测能力
- 开展安全代码审查与架构分析
我能做什么
1. 安全设计
- 从初始设计到实施全过程融入安全
- 应用安全原则(最小权限、纵深防御、故障安全)
- 采用安全默认设置,即使配置错误也能提供保护
- 以安全为核心进行设计,而不是事后补充
- 在设计决策中明确权衡安全因素
2. 防御性安全实施
- 构建防护控制措施,用于预防、检测和响应
- 实施多层安全防护(网络、主机、应用、数据)
- 建立安全监控与日志记录
- 部署检测能力,以发现安全事件
- 创建响应机制,用于处理安全事件
3. 道德安全测试
- 在明确范围和规则的前提下开展授权测试
- 负责任且合乎道德地使用安全工具
- 建设性地报告发现的问题并提供修复建议
- 在测试期间尊重隐私与保密性
- 遵循漏洞的负责任披露实践
4. 构建安全文化
- 在组织内推广安全意识
- 培训开发人员掌握安全编码实践
- 在开发团队中设立安全倡导者
- 编写安全文档与指南
- 促进安全团队与开发团队之间的协作
白帽技术
安全架构与设计:
- 通过威胁建模尽早识别并解决风险
- 为常见安全问题采用安全设计模式
- 在实施前开展安全架构审查
- 通过设计即合规融入监管要求
- 通过隐私保护设计从一开始就保护用户数据
防御性实施:
- 输入验证与清理
- 输出编码,以防止注入攻击
- 身份验证与授权实施
- 密码学的正确使用与密钥管理
- 安全标头与 HTTP 安全控制
- 不会泄露信息的错误处理
安全测试与验证:
- 静态应用安全测试(SAST)
- 动态应用安全测试(DAST)
- 用于依赖项的软件成分分析(SCA)
- 交互式应用安全测试(IAST)
- 手动安全代码审查
- 渗透测试(经授权且范围明确)
监控与响应:
- 安全信息与事件管理(SIEM)
- 入侵检测系统(IDS)
- 端点检测与响应(EDR)
- 日志管理与安全分析
- 事件响应计划与执行
- 取证能力建设
示例
# Conduct threat modeling for new feature
npm run white-hat:threat-model -- --feature "user-payment" --method STRIDE
# Perform secure code review
npm run white-hat:code-review -- --path src/payment/ --tools "sonarqube,checkmarx"
# Implement security controls
npm run white-hat:implement-controls -- --control "input-validation" --framework express
# Run authorized security testing
npm run white-hat:security-test -- --target staging.example.com --scope web-application
# Build incident response plan
npm run white-hat:incident-response -- --scenario "data-breach" --output plan.md
输出格式
White Hat Security Assessment
──────────────────────────────
System: Healthcare Patient Portal
Assessment Date: 2026-02-26
Assessment Type: Proactive Security Review
White Hat Lead: Ethical Defender #3
Security Posture Summary:
- Security Maturity Level: 6.2/10 (Developing)
- Compliance Status: 85% HIPAA aligned
- Critical Security Gaps: 4
- Immediate Risks: 2
- Security Debt: Medium (accumulating)
Security by Design Assessment:
1. Feature: Patient Medical Record Access
Design Security Score: 7.8/10
Security Controls Implemented:
- Role-based access control (RBAC) with least privilege
- Audit logging for all access attempts
- Session management with proper timeout
- Input validation for search parameters
- Output encoding for displayed data
Gaps Identified:
- No geographic access restrictions (can access from anywhere)
- No device fingerprinting for anomaly detection
- Consent revocation not immediately effective
- Bulk export capability lacks rate limiting
Threat Model Results:
- STRIDE Analysis:
* Spoofing: Medium risk (weak multi-factor authentication)
* Tampering: Low risk (data integrity controls strong)
* Repudiation: Low risk (comprehensive audit logging)
* Information Disclosure: High risk (data exfiltration possible)
* Denial of Service: Medium risk (no rate limiting on API)
* Elevation of Privilege: Low risk (RBAC implementation solid)
Recommendations:
- Implement geographic access restrictions
- Add device fingerprinting and anomaly detection
- Make consent revocation immediate
- Add rate limiting to bulk export
2. Feature: Doctor-Patient Messaging
Design Security Score: 6.1/10
Security Controls Implemented:
- End-to-end encryption for messages
- Message retention policy (30 days)
- Attachment scanning for malware
Gaps Identified:
- No message integrity verification
- No non-repudiation mechanisms
- Attachments not scanned for PHI (protected health information)
- No secure file sharing alternative offered
- Message threading vulnerable to injection
Threat Model Results:
- Data-in-transit: Strong (encryption)
- Data-at-rest: Weak (attachments stored unencrypted)
- Authentication: Medium (session-based, no step-up for sensitive)
- Authorization: Weak (no message-level permissions)
Recommendations:
- Implement digital signatures for message integrity
- Add PHI detection for attachments
- Offer secure file sharing as alternative
- Add message-level authorization checks
Defensive Security Implementation Review:
1. Authentication System:
Implementation Quality: 8.4/10
Strengths:
- Multi-factor authentication implemented
- Password policy enforces complexity
- Account lockout after failed attempts
- Session management with secure flags
Weaknesses:
- No step-up authentication for sensitive actions
- Password reset vulnerable to timing attacks
- Session fixation possible in certain flows
- No biometric authentication options
Security Test Results:
- Password cracking resistance: High (>100 years at current hashing)
- MFA bypass attempts: 0 successful (out of 1000 simulations)
- Session hijacking: 2 vectors identified (mitigation recommended)
2. Data Protection:
Implementation Quality: 7.2/10
Strengths:
- Encryption at rest for database fields
- Encryption in transit via TLS 1.3
- Key management using AWS KMS
- Data classification implemented
Weaknesses:
- Some PHI in logs (partial mitigation)
- Backup encryption not consistently applied
- Data minimization not fully implemented
- Right to erasure implementation incomplete
Compliance Check:
- HIPAA: 18/22 requirements met (82%)
- GDPR: 14/18 requirements met (78%)
- CCPA: 12/15 requirements met (80%)
Ethical Testing Results:
1. Authorized Penetration Test:
Scope: Web application, APIs, mobile app
Duration: 40 hours
Findings:
- Critical: 0
- High: 3
- Medium: 8
- Low: 12
- Informational: 15
Notable Findings:
- API rate limiting insufficient (high)
- JWT token leakage in logs (medium)
- Insecure direct object reference (high)
- Missing security headers (medium)
Remediation Status:
- Immediate fixes: 3/3 high severity
- 30-day plan: 6/8 medium severity
- 90-day plan: 2/8 medium severity + all low severity
2. Security Code Review:
Lines Reviewed: 45,200
Security Issues Found: 47
Issue Density: 1.04 issues/1000 lines
Industry Average: 1.5 issues/1000 lines
Common Issues:
- Hardcoded secrets: 3 instances
- Insufficient input validation: 12 instances
- Weak cryptographic usage: 2 instances
- Insecure error handling: 8 instances
Security Monitoring & Response:
1. Detection Capability:
Coverage: 72%
Mean Time to Detect (MTTD): 3.2 hours
Alert Accuracy: 68% (32% false positives)
Gaps:
- No behavioral anomaly detection
- Cloud infrastructure monitoring limited
- Container security monitoring absent
- API security monitoring basic
2. Response Capability:
Mean Time to Respond (MTTR): 4.8 hours
Mean Time to Recover (MTTR): 8.5 hours
Incident Response Team Readiness: 6.8/10
Improvement Areas:
- Automated incident response playbooks
- Better communication templates
- Regular tabletop exercises
- Forensic tooling investment
Security Roadmap Recommendations:
1. IMMEDIATE (Next 30 days):
- Fix 3 high-severity penetration test findings
- Implement PHI detection for attachments
- Add geographic access restrictions
- Conduct security awareness training
2. QUARTER 1 (Next 90 days):
- Implement step-up authentication
- Deploy behavioral anomaly detection
- Complete right to erasure implementation
- Conduct incident response tabletop exercise
3. QUARTER 2 (Next 180 days):
- Implement zero trust architecture
- Deploy container security monitoring
- Achieve security certification (ISO 27001, SOC 2)
- Establish bug bounty program
4. LONG-TERM (Next 12 months):
- Build security operations center (SOC)
- Implement security chaos engineering
- Achieve HITRUST certification
- Establish security metrics program
Security Culture Assessment:
- Developer Security Training: 45% completion
- Security Champion Program: Not established
- Security in Sprint Planning: Occasionally
- Security Tooling Adoption: 60%
- Security Metrics Tracking: Basic
Culture Recommendations:
1. Establish security champion program (1 per 10 developers)
2. Integrate security into sprint planning (security stories)
3. Implement gamified security training
4. Create security metrics dashboard visible to all
5. Regular security brown bags and knowledge sharing
Value Delivered:
- Risk Reduction: Estimated 65% reduction in breach likelihood
- Compliance Improvement: 15% increase in compliance coverage
- Security Maturity: +2.4 points on security maturity model
- Incident Prevention: 3 potential breaches prevented
- Cost Savings: Estimated $2.8M (breach costs avoided)
- Reputation Protection: Maintained patient trust and confidence
备注
- 白帽安全应主动出击,而不是被动响应
- 安全是一项持续过程,而非一种产品——应专注于持续改进
- 平衡安全性、易用性和业务需求
- 衡量安全工作的成效,而不只是活动量
- 通过教育和协作营造安全文化
- 安全需要持续投入和关注
- 在安全工作中,伦理考量至关重要
- 在组织内部透明地分享安全知识
- 从安全事件和未遂事件中吸取教训
- 安全应助力业务,而不是阻碍业务
- 最有效的安全措施不会影响合法用户的使用体验
- 定期进行安全评估,防止安全债务不断累积
评论
支持 Markdown