implementing-continuous-security-validation-with-bas
部署违规和攻击模拟(BAS)工具,通过安全模拟整个杀伤链中的真实攻击技术,持续验证安全控制有效性。
Best use case
implementing-continuous-security-validation-with-bas is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
部署违规和攻击模拟(BAS)工具,通过安全模拟整个杀伤链中的真实攻击技术,持续验证安全控制有效性。
Teams using implementing-continuous-security-validation-with-bas should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/implementing-continuous-security-validation-with-bas/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How implementing-continuous-security-validation-with-bas Compares
| Feature / Agent | implementing-continuous-security-validation-with-bas | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
部署违规和攻击模拟(BAS)工具,通过安全模拟整个杀伤链中的真实攻击技术,持续验证安全控制有效性。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 使用 BAS 实施持续安全验证(Implementing Continuous Security Validation with BAS)
## 概述
违规和攻击模拟(Breach and Attack Simulation,BAS)是一种自动化、持续的方法,通过在生产安全基础设施上安全执行真实世界的攻击技术来验证安全控制有效性。与传统渗透测试(时间点评估)不同,BAS 平台持续模拟映射到 MITRE ATT&CK 的威胁,测试端点防护、网络安全、邮件网关、SIEM 检测和事件响应能力。主要平台包括 SafeBreach、AttackIQ、Picus Security(2024 年 Gartner 用户选择奖)、Cymulate、Pentera 和 SCYTHE。BAS 2.0 解决方案无需在每个端点预部署 Agent,即可跨整个 IT 环境安全模拟真实攻击者行为。
## 前置条件
- BAS 平台授权(SafeBreach、AttackIQ、Picus、Cymulate 或 Pentera)
- 待验证的已部署安全控制(EDR、NGFW、邮件网关、SIEM、WAF)
- 熟悉 MITRE ATT&CK 框架
- BAS Agent/模拟器可访问的网络段
- 能对验证结果采取行动的安全运营团队
- 在生产环境运行模拟的变更管理审批
## 核心概念
### BAS 与传统安全测试对比
| 维度 | BAS | 渗透测试 | 红队 |
|------|-----|---------|------|
| 频率 | 持续/定时 | 每年/每季度 | 每年 |
| 自动化 | 全自动 | 工具辅助手动 | 手动 |
| 范围 | 完整杀伤链 | 特定目标 | 目标导向 |
| 安全性 | 安全模拟,无实际利用 | 受控利用 | 真实利用 |
| 覆盖率 | 数千种技术 | 数百项测试 | 聚焦场景 |
| 输出 | 控制差距分析 | 漏洞报告 | 叙述性报告 |
| 成本模式 | 订阅制 | 按项目收费 | 按项目收费 |
### MITRE ATT&CK 覆盖率映射
| 战术 | BAS 模拟示例 | 测试控制 |
|------|------------|---------|
| 初始访问 | 钓鱼载荷投递、利用公开应用 | 邮件网关、WAF、IPS |
| 执行 | PowerShell、WMI、恶意宏 | EDR、应用控制 |
| 持久化 | 注册表运行键、计划任务、服务 | EDR、SIEM 检测规则 |
| 权限提升 | Token 操控、UAC 绕过 | EDR、PAM、SIEM |
| 防御规避 | 进程注入、混淆、时间戳篡改 | EDR、行为分析 |
| 凭据访问 | Mimikatz、Kerberoasting、LSASS 转储 | EDR、Credential Guard |
| 发现 | AD 枚举、网络扫描 | SIEM、NDR |
| 横向移动 | PsExec、WMI、RDP、SMB | NDR、微分段 |
| 收集 | 屏幕截图、键盘记录、邮件采集 | DLP、UEBA |
| 外泄 | HTTP/DNS 外泄、云存储上传 | DLP、CASB、代理 |
| 命令与控制 | C2 信标、DNS 隧道、加密通道 | NGFW、代理、NDR |
### 安全控制验证评分
```
控制有效性 = (阻断攻击数 + 检测攻击数)/ 总模拟攻击数 * 100
示例:
总模拟次数: 500
阻断(已拦截): 350
检测(已告警): 100
遗漏(无响应): 50
阻断率:350/500 = 70%
检测率:100/500 = 20%
总体评分:450/500 = 90%
差距率:50/500 = 10%
```
## 实施步骤
### 步骤 1:部署 BAS 平台组件
```
架构:
管理控制台(云 SaaS):
- 中央编排和报告
- 攻击场景库管理
- MITRE ATT&CK 映射仪表板
模拟 Agent:
- 攻击者 Agent:模拟威胁行为者行为
- 目标 Agent:接受模拟攻击
- 网络 Agent:测试网络层控制
跨区域部署 Agent:
- 企业网络(工作站)
- DMZ(Web 服务器)
- 数据中心(关键服务器)
- 云环境(AWS/Azure/GCP)
- 远程/VPN 网段
```
### 步骤 2:配置攻击场景
```yaml
# BAS 场景配置示例
scenario:
name: "APT29(Cozy Bear)完整杀伤链"
threat_group: APT29
mitre_attack_techniques:
- T1566.001 # 鱼叉式网络钓鱼附件
- T1059.001 # PowerShell 执行
- T1547.001 # 注册表运行键持久化
- T1003.001 # LSASS 内存凭据转储
- T1021.002 # SMB/Windows 管理共享
- T1071.001 # Web 协议 C2
- T1048.003 # DNS 外泄
phases:
- name: "初始访问"
actions:
- deliver_phishing_payload:
type: office_macro
target: email_gateway
variants: [docm, xlsm, ppam]
- name: "执行与持久化"
actions:
- execute_powershell:
encoded: true
amsi_bypass: true
- create_scheduled_task:
technique: T1053.005
- name: "凭据访问"
actions:
- dump_lsass:
method: [procdump, comsvcs, nanodump]
- name: "横向移动"
actions:
- psexec_lateral:
target: internal_server
- wmi_lateral:
target: file_server
- name: "外泄"
actions:
- dns_exfiltration:
data_size: 10MB
encoding: base64
```
### 步骤 3:将结果映射到安全控制
```python
def map_bas_results_to_controls(simulation_results):
"""将 BAS 结果映射到安全控制有效性。"""
control_scores = {}
control_mapping = {
"email_gateway": ["T1566.001", "T1566.002", "T1566.003"],
"edr": ["T1059.001", "T1003.001", "T1055", "T1547.001"],
"ngfw": ["T1071.001", "T1071.004", "T1048"],
"siem": ["T1053.005", "T1021.002", "T1087"],
"dlp": ["T1048.003", "T1567", "T1041"],
"ndr": ["T1071", "T1021", "T1040"],
}
for control, techniques in control_mapping.items():
relevant = [r for r in simulation_results
if r["technique_id"] in techniques]
if not relevant:
continue
prevented = sum(1 for r in relevant if r["result"] == "prevented")
detected = sum(1 for r in relevant if r["result"] == "detected")
missed = sum(1 for r in relevant if r["result"] == "missed")
total = len(relevant)
control_scores[control] = {
"total_tests": total,
"prevented": prevented,
"detected": detected,
"missed": missed,
"prevention_rate": round(prevented / total * 100, 1),
"detection_rate": round(detected / total * 100, 1),
"effectiveness": round((prevented + detected) / total * 100, 1),
}
return control_scores
```
### 步骤 4:安排持续验证
```
验证计划:
每日:
- 恶意软件投递模拟(邮件网关测试)
- C2 通信模拟(防火墙/代理测试)
- 已知勒索软件行为模拟(EDR 测试)
每周:
- 完整杀伤链模拟(APT 场景)
- 横向移动模拟(网络分段测试)
- 数据外泄模拟(DLP 测试)
每月:
- 完整 MITRE ATT&CK 覆盖率评估
- 新威胁组织 TTP 模拟
- 安全控制变更后的回归测试
按需:
- 防火墙规则变更后
- EDR 策略更新后
- 新威胁情报(零日响应)后
```
## 最佳实践
1. 从与行业相关的已知威胁组织模拟开始
2. 在启用完整模拟之前,始终先在安全模式下运行
3. 与 SOC 团队协调,使其能够区分 BAS 流量和真实攻击
4. 使用 BAS 结果优先排序 SIEM 检测规则的开发工作
5. 跟踪控制有效性评分的趋势,以证明安全态势改善
6. 将 BAS 与工单系统集成,自动为差距生成修复工单
7. 每次安全控制变更后运行验证,捕获回归问题
8. 将所有模拟映射到 MITRE ATT&CK,实现标准化报告
## 常见误区
- 在未通知 SOC 的情况下运行 BAS,导致不必要的事件响应
- 只测试阻断能力,忽略检测/响应验证
- 不对 BAS 发现采取行动,导致安全差距长期存在
- 只在一个网络区域部署 BAS Agent,遗漏跨区域差距
- 只关注通用威胁,而非与 APT 相关的场景
- 将 BAS 视为渗透测试的替代品而非补充
## 相关技能
- implementing-attack-path-analysis-with-xm-cyber
- performing-purple-team-exercise
- implementing-siem-use-cases-for-detection
- implementing-threat-modeling-with-mitre-attackRelated Skills
triaging-security-incident
使用 NIST SP 800-61r3 和 SANS PICERL 框架对安全事件进行初始分类,确定严重性、范围和所需响应行动。 按类型对事件分类,根据业务影响分配优先级,并路由到相应的响应团队。适用于事件分类、 安全告警分类、严重性评估、事件优先级排序或初始事件分析等请求场景。
triaging-security-incident-with-ir-playbook
使用结构化 IR Playbook 对安全事件进行分类和优先排序,确定严重性、分配响应团队并启动适当的响应程序。
triaging-security-alerts-in-splunk
在 Splunk Enterprise Security 中对安全告警进行分类,通过 SPL 查询和事件审查(Incident Review) 仪表板对重要事件进行严重性分类、调查、关联相关遥测并做出升级或关闭决策。 适用于 SOC 分析师需要处理关联搜索产生的告警队列、确定调查优先级, 或需要为交接给二/三级分析师记录分类决策时。
testing-websocket-api-security
测试 WebSocket API 实现中的安全漏洞,包括 WebSocket 升级时缺少身份认证、跨站 WebSocket 劫持(Cross-Site WebSocket Hijacking,CSWSH)、通过 WebSocket 消息进行的注入攻击、输入校验不足、通过消息泛洪实施拒绝服务,以及通过 WebSocket 帧造成的信息泄露。测试人员使用 Burp Suite 拦截 WebSocket 握手和消息,构造恶意 payload,并测试 WebSocket 通道上的授权绕过。适用于 WebSocket 安全测试、WS 渗透测试、CSWSH 攻击或实时 API 安全评估相关请求。
testing-jwt-token-security
在安全测试活动中,评估 JSON Web Token(JWT)实现中的密码学弱点、算法混淆攻击和授权绕过漏洞。
testing-api-security-with-owasp-top-10
使用自动化和手工测试技术,针对 OWASP API 安全 Top 10 风险对 REST 和 GraphQL API 端点进行系统性评估。
performing-wireless-security-assessment-with-kismet
使用 Kismet 通过被动射频监控进行无线网络安全评估,检测流氓接入点(Rogue AP)、隐藏 SSID、弱加密和未授权客户端。
performing-ssl-tls-security-assessment
使用 sslyze Python 库评估 SSL/TLS 服务器配置,评估加密套件、证书链、协议版本、HSTS 头部,以及 Heartbleed 和 ROBOT 等已知漏洞。
performing-soap-web-service-security-testing
通过分析 WSDL 定义,测试 XML 注入(XML Injection)、XXE、WS-Security 绕过和 SOAPAction 欺骗,对 SOAP Web 服务执行安全测试。
performing-serverless-function-security-review
对 AWS Lambda、Azure Functions 和 GCP Cloud Functions 中的无服务器函数(Serverless Function)执行安全审查,识别过度宽松的执行角色(Execution Role)、不安全的环境变量、注入漏洞和缺失的运行时保护措施。
performing-scada-hmi-security-assessment
对 SCADA 人机界面(HMI, Human-Machine Interface)系统进行安全评估,识别基于 Web 的 HMI、瘦客户端配置、认证机制以及 HMI 与 PLC 之间通信信道中的漏洞,符合 IEC 62443 和 NIST SP 800-82 指南要求。
performing-s7comm-protocol-security-analysis
对西门子SIMATIC S7 PLC使用的S7comm和S7CommPlus协议进行安全分析,识别漏洞,包括重放攻击、完整性绕过、未授权的CPU停止命令以及针对S7-300、S7-400、S7-1200和S7-1500控制器弱点的程序下载操控。