Sandler73/Windows-Security-Audit-Project

GitHub: Sandler73/Windows-Security-Audit-Project

一个功能全面的Windows安全合规审计与修复工具,覆盖8个主流安全框架,支持自动化检查和修复。

Stars: 7 | Forks: 0

# Windows 安全审计脚本
![Version](https://img.shields.io/badge/version-6.0-blue.svg) ![PowerShell](https://img.shields.io/badge/PowerShell-5.1+-blue.svg) ![License](https://img.shields.io/badge/license-MIT-green.svg) ![Platform](https://img.shields.io/badge/platform-Windows%2010%2F11%20%7C%20Server%202016%2B-lightgrey.svg) **综合型模块化多框架 Windows 安全评估/审计与修复工具** [概述](#-overview) • [主要特性](#-key-features) • [快速开始](#-quick-start) • [文档](#-documentation) • [修复能力](#-remediation-capabilities) • [贡献](#-contributing)
## 📋 概述 **Windows 安全审计脚本** 是一款基于 PowerShell 的高级安全合规性审计工具,可根据多个行业标准的各种安全框架对 Windows 系统进行评估。版本 6.0 引入了**严重性分类**、**跨框架关联**、**缓存感知架构**以及**独立模块执行**,这些功能构建于 v5.3 引入的智能修复、增强报告和 SIEM 集成功能之上。 该工具跨八个合规性模块执行 **1,855 项自动化安全检查**,生成包含可操作修复指南的多种格式综合报告。现在,每项检查都包含严重性评级,并引用其他框架中的等效控制措施,从而能够通过单次审计运行实现多框架合规性评分。无论您是进行合规性审计、加固系统,还是维护安全基线,此工具都能为您提供所需的洞察力和自动化支持。 ## 🎯 主要特性 ### 🔍 **全面的安全评估** - ✅ **1,855 项安全检查**,覆盖 8 个主要安全框架 - ✅ **多框架覆盖** — CIS, NIST, STIG, NSA, CISA, Microsoft, Microsoft Defender ATP, Core Baseline - ✅ **模块化架构** — 运行所有框架或选择特定模块 - ✅ **严重性分类** — 每项检查均评级为 Critical/High/Medium/Low/Informational - ✅ **跨框架关联** — 1,568 个跨引用映射,将检查链接到等效控制措施 - ✅ **独立模块执行** — 可独立运行任何模块以进行针对性测试 - ✅ **结果验证** — 自动化数据完整性检查与标准化 - ✅ **无外部依赖** — 纯 PowerShell 实现,仅使用标准库 ### 📊 **高级报告** _(6.0 版本增强)_ - ✅ **交互式 HTML 报告** 包含: - 🌓 深色/浅色主题切换 - 🔍 按列的高级过滤和排序 - 📤 多格式导出 (CSV, Excel, JSON, XML, TXT) - ☑️ 基于复选框的选择性导出 - 📑 按模块和全局导出选项 - 📊 带有统计信息的执行仪表盘 - ✅ **兼容 SIEM 的 XML** 输出,适用于安全监控平台 - ✅ **多种输出格式** - HTML, JSON, CSV, XML, 控制台 - ✅ **9 字段结果对象** — Module, Category, Status, Severity, Message, Details, Remediation, CrossReferences, Timestamp - ✅ **结构化数据** — 友好于 API 和自动化的格式 ### 🔧 **智能修复** - ✅ **交互式修复** - 逐个审查并应用修复 - ✅ **自动化修复** - 带安全确认的批量修复 - ✅ **选择性修复** - 针对特定状态类型 (Fail, Warning, Info) - ✅ **针对性修复** - 仅修复从 JSON 导出中选中的问题 - ✅ **修复日志** - 所有变更的完整审计追踪 - ✅ **安全机制** - 双重确认和倒计时定时器 - ✅ **回滚支持** - 用于还原变更的详细日志 ### 📈 **质量保证** - ✅ **结果验证** - 确保所有模块的数据完整性 - ✅ **状态标准化** - 一致的分类 (Pass/Fail/Warning/Info/Error) - ✅ **模块统计** - 实时追踪和报告 - ✅ **执行元数据** - 完整的审计追踪保留 - ✅ **错误处理** - 检查失败时的优雅降级 ### 🆕 **6.0 版本新增内容** - ✅ **严重性分类** — 每项检查均按风险影响分类 (Critical/High/Medium/Low/Informational) - ✅ **跨框架映射** — 关联 NIST, CIS, STIG, NSA, CISA 之间的发现 - ✅ **缓存感知架构** — 注册表查询缓存以优化性能 - ✅ **独立执行** — 任何模块均可在无编排器的情况下独立运行 - ✅ **Microsoft Defender ATP 模块** — 85 项新的 EDR/ATP 专项检查 - ✅ **3.4 倍的检查量** — 从 550+ 扩展到 1,855 项总检查 - ✅ **9 字段结果对象** — 在每次检查输出中增加了 Severity 和 CrossReferences ## 🏢 支持的框架 | 模块 | 框架 | 检查项 | 关注领域 | |--------|-----------|--------|------------| | **Core** | 基础 Windows 安全基线 | 176 | 基本系统安全、硬件、TLS、PowerShell | | **CIS** | CIS Microsoft Windows Benchmarks v3.0+ | 222 | 行业最佳实践、凭据保护、MSS 注册表 | | **MS** | Microsoft Security Baselines (SCT) | 313 | Defender, AppLocker, ASR, Exploit Protection, 33 个类别 | | **MS-DefenderATP** | Microsoft Defender for Endpoint | 85 | EDR, Onboarding, TVM, AIR, 篡改保护 | | **NIST** | NIST 800-53 Rev 5, CSF 2.0, 800-171 | 473 | 联邦合规性, 18 个控制族 (AC, AU, IA, SC, SI, CM) | | **STIG** | DISA Security Technical Implementation Guide | 184 | DoD 要求, CAT I/II/III, 凭据/TLS/硬件加固 | | **NSA** | NSA Cybersecurity Information Sheets | 172 | 国家级威胁缓解、证书信任、无线、漏洞缓解 | | **CISA** | CISA Cybersecurity Performance Goals | 230 | 关键基础设施、Zero Trust、供应链、BOD 22-01/23-01 | **总覆盖范围**:1,855 项安全检查,包含严重性分类和跨框架关联,涵盖访问控制、身份验证、审计、网络安全、数据保护、恶意软件防御、系统加固、EDR 和 Zero Trust 架构。 ## 🚀 快速开始 ### 前置条件 - **操作系统**: Windows 10/11 或 Windows Server 2016/2019/2022/2025 - **PowerShell**: 版本 5.1 或更高版本(现代 Windows 已包含) - **权限**: 需要管理员权限以获取完整结果 - **修复权限**: 应用修复必须具有管理员权限 ### 安装 1. **克隆仓库:** ``` git clone https://github.com/Sandler73/Windows-Security-Audit-Project.git cd Windows-Security-Audit-Project ``` 2. **设置执行策略(如有需要):** ``` Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser ``` 3. **验证前置条件:** ``` # Check PowerShell version $PSVersionTable.PSVersion # Check if running as Administrator ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) ``` ### 基本用法 **运行完整审计并生成默认 HTML 报告:** ``` .\Windows-Security-Audit.ps1 ``` **运行特定框架:** ``` .\Windows-Security-Audit.ps1 -Modules Core,NIST,CISA ``` **运行 Defender ATP 评估:** ``` .\Windows-Security-Audit.ps1 -Modules Core,MS,MS-DefenderATP ``` **生成 CSV 输出:** ``` .\Windows-Security-Audit.ps1 -OutputFormat CSV ``` **使用 XML 进行 SIEM 集成:** ``` .\Windows-Security-Audit.ps1 -OutputFormat XML -OutputPath "\\SIEM\imports\audit.xml" ``` **独立运行单个模块(无需编排器):** ``` .\modules\module-cis.ps1 ``` ## 🔧 修复能力 版本 5.3 引入了全面的修复功能,提供多种工作流以适应不同的需求和风险容忍度。 ### 修复模式 #### 1. **交互式修复**(最安全) 逐个审查并批准修复: ``` .\Windows-Security-Audit.ps1 -RemediateIssues ``` - 提示每一次修复 - 完全透明地查看变更 - 跳过选项 (Y/N/S) - 推荐用于生产系统 #### 2. **基于状态的修复** 针对特定严重级别: ``` # 仅修复严重故障 .\Windows-Security-Audit.ps1 -RemediateIssues_Fail # 交互式修复警告 .\Windows-Security-Audit.ps1 -RemediateIssues_Warning # 处理信息性项目 .\Windows-Security-Audit.ps1 -RemediateIssues_Info # 修复所有内容(所有状态类型) .\Windows-Security-Audit.ps1 -RemediateIssues ``` #### 3. **自动化修复**(高级) 带安全确认的批量修复: ``` .\Windows-Security-Audit.ps1 -RemediateIssues_Fail -AutoRemediate ``` **安全特性:** - 执行前显示所有变更 - 需要输入 "YES" 确认 - 带有 10 秒超时的二次确认 - 需要输入 "CONFIRM" 继续 - 全面的修复日志 #### 4. **针对性修复**(精确) 仅修复从 HTML 报告中选定的特定问题: **工作流程:** ``` # 步骤 1:运行审计并审查结果 .\Windows-Security-Audit.ps1 # 步骤 2:在 HTML 报告中,选择特定问题并点击 "Export Selected" # 这将生成一个 JSON 文件(例如,Selected-Report.json) # 步骤 3:运行针对性自动修复 .\Windows-Security-Audit.ps1 -AutoRemediate -RemediationFile "Selected-Report.json" ``` **优势:** - 手术般的精确度 - 仅修复您选择的内容 - 在提交前详细审查 - 非常适合变更控制流程 - 适用于合规性驱动的修复 ### 修复日志 所有修复操作都会记录完整详情: ``` Remediation-Log-YYYYMMDD-HHMMSS.json ``` 日志包括: - 每次操作的时间戳 - 模块和类别 - 问题描述 - 执行的修复命令 - 成功/失败状态 - 错误信息(如果失败) ### 修复输出示例 ``` ======================================================================================================== REMEDIATION MODE ======================================================================================================== [*] Mode: Remediate FAIL issues only [*] Found 42 issue(s) with remediation available [*] Issue: SMBv1 protocol is ENABLED Module: STIG | Status: Fail | Category: STIG - V-220968 (CAT II) Remediation: Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -NoRestart Apply remediation? (Y/N/S=Skip remaining): Y [+] Remediation applied successfully [*] Issue: Guest account is ENABLED Module: Core | Status: Fail | Category: Core - Accounts Remediation: Disable-LocalUser -Name Guest Apply remediation? (Y/N/S=Skip remaining): Y [+] Remediation applied successfully ======================================================================================================== Remediation Summary: Total issues found: 42 Successfully remediated: 38 Failed remediations: 2 Skipped: 2 Success rate: 90.5% ======================================================================================================== [*] Remediation log saved to: Remediation-Log-20250101-120000.json [*] Some settings may require a system restart to take effect. Would you like to restart now? (Y/N): ``` ## 📊 输出格式与报告 ### 1. HTML 报告(交互式) - **默认** **功能:** - 🎨 **主题切换** - 在浅色和深色模式之间切换 - 📊 **执行仪表盘** - 摘要统计信息和合规性概览 - 🔍 **高级过滤** - 按状态、类别或关键字按列过滤 - ↕️ **动态排序** - 点击列标题排序 - 📤 **导出选项**: - **Export All** - 多种格式的完整报告 - **Export Selected** - 通过复选框选择特定问题 - **Per-Module Export** - 导出单个框架结果 - **Format Options** - CSV, Excel, JSON, XML, TXT - 📑 **可折叠模块** - 展开/折叠每个框架部分 - 🔧 **修复指南** - 针对每项发现的详细修复说明 - 📱 **响应式设计** - 适用于桌面和平板电脑显示 **导出工作流程:** 1. 在 HTML 报告中审查发现 2. 使用复选框选择特定问题 3. 点击 "Export Selected" → 选择格式(JSON 用于修复) 4. 将导出的 JSON 与 `-RemediationFile` 参数一起使用 ### 2. XML 报告(SIEM 集成) **用于安全监控平台的标准化格式:** ``` 2025-01-01T12:00:00Z HOSTNAME 1855 456 42 2025-01-01T12:00:00Z STIG Fail V-220968 SMBv1 protocol is ENABLED Disable-WindowsOptionalFeature... ``` **用例:** - Splunk, QRadar, ArcSight 集成 - 自动化合规性监控 - 趋势分析和警报 - 集中式安全仪表盘 ### 3. JSON 报告(自动化) ``` { "ExecutionInfo": { "ComputerName": "HOSTNAME", "OSVersion": "Windows 11 Pro", "ScanDate": "2025-01-01 12:00:00", "Duration": "00:02:34", "TotalChecks": 1855, "PassCount": 456, "FailCount": 42 }, "Results": [ { "Module": "STIG", "Category": "STIG - TLS/SSL", "Status": "Fail", "Severity": "High", "Message": "V-220968: SMBv1 protocol is ENABLED", "Details": "CAT II: Disable SMBv1 immediately — lateral movement vector", "Remediation": "Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -NoRestart", "CrossReferences": { "STIG": "V-220968", "NIST": "SC-8", "CIS": "18.3.3" }, "Timestamp": "2025-03-03 12:00:00" } ] } ``` ### 4. CSV 报告(电子表格分析) Excel 兼容格式,用于: - 数据透视表和仪表盘 - 修复追踪 - 进度监控 - 管理报告 ### 5. 控制台输出(实时) ``` ======================================================================== Windows Security Audit Script v6.0 Comprehensive Multi-Framework Security Assessment ======================================================================== [*] Modules to execute: Core, CIS, MS, MS-DefenderATP, NIST, STIG, NSA, CISA [Core] Starting core security baseline checks... [+] Module Core completed: 176 checks (152 pass, 12 fail, 12 warning) [STIG] Checking DISA STIG compliance... [+] Module STIG completed: 184 checks (148 pass, 22 fail, 14 warning) ======================================================================== AUDIT SUMMARY ======================================================================== Total Checks: 1855 Passed: 1542 (83.1%) Failed: 156 (8.4%) Warnings: 118 (6.4%) Info: 28 (1.5%) Errors: 0 (0.0%) Duration: 00:02:34 ======================================================================== [+] HTML report saved to: Security-Audit-Report-20250101-120000.html [*] Opening report in browser... [+] Audit completed successfully! ``` ## 📖 文档 [项目 Wiki](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki) 中提供了全面的文档: ### 入门 - **[快速入门指南](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Quick-Start-Guide)** - 5 分钟内上手运行 - **[使用指南](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Windows-Security-Audit-Tool-‐-Usage-Guide)** - 详细的命令行选项和工作流程 ### 参考文档 - **[框架参考](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Framework-Reference)** - 详细的框架映射和控制 ID - **[模块文档](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Module-Documentation)** - 单个模块规格 - **[输出参考](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Output-Reference)** - 报告格式规格 ### 高级主题 - **[开发指南](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Development-Guide)** - 贡献和扩展模块 - **[故障排除指南](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Troubleshooting-Guide)** - 常见问题和解决方案 - **[FAQ](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Frequently-Asked-Questions-(FAQ))** - 常见问题解答 ## 🛠️ 命令行参数 ``` .\Windows-Security-Audit.ps1 [-Modules ] # Frameworks to run (default: All — includes MS-DefenderATP) [-OutputFormat ] # Output format: HTML, CSV, JSON, XML, Console [-OutputPath ] # Custom output path [-RemediateIssues] # Interactive remediation (all statuses) [-RemediateIssues_Fail] # Remediate FAIL status only [-RemediateIssues_Warning] # Remediate WARNING status only [-RemediateIssues_Info] # Remediate INFO status only [-AutoRemediate] # Automated remediation with confirmations [-RemediationFile ] # JSON file with selected issues to remediate ``` ### 参数示例 **框架选择:** ``` # 运行所有 frameworks(默认) .\Windows-Security-Audit.ps1 # 运行特定 frameworks .\Windows-Security-Audit.ps1 -Modules Core,NIST,CISA # 运行单个 framework .\Windows-Security-Audit.ps1 -Modules STIG ``` **输出控制:** ``` # 生成 HTML 报告(默认) .\Windows-Security-Audit.ps1 -OutputFormat HTML # 生成 CSV 用于 Excel 分析 .\Windows-Security-Audit.ps1 -OutputFormat CSV # 生成 XML 用于 SIEM .\Windows-Security-Audit.ps1 -OutputFormat XML # 仅控制台输出 .\Windows-Security-Audit.ps1 -OutputFormat Console # 自定义输出位置 .\Windows-Security-Audit.ps1 -OutputPath "C:\SecurityAudits\Report.html" ``` **修复工作流程:** ``` # 交互式修复(逐一审查) .\Windows-Security-Audit.ps1 -RemediateIssues # 仅自动修复严重故障 .\Windows-Security-Audit.ps1 -RemediateIssues_Fail -AutoRemediate # 交互式修复警告 .\Windows-Security-Audit.ps1 -RemediateIssues_Warning # 基于 JSON 的针对性修复 .\Windows-Security-Audit.ps1 -AutoRemediate -RemediationFile "Selected-Report.json" ``` ## 🎯 用例 ### 1. 合规性审计 **场景**:年度 SOC 2, FISMA, 或 CMMC 合规性审计 ``` # 生成综合合规报告 .\Windows-Security-Audit.ps1 -Modules NIST,STIG,CIS -OutputFormat HTML # 将结果导出为 CSV 用于合规跟踪 # 使用 HTML 报告的 "Export All" → CSV 功能 ``` ### 2. 系统加固 **场景**:在生产部署前加固新的 Windows 服务器 ``` # 步骤 1:基线审计 .\Windows-Security-Audit.ps1 -Modules Core,CIS,MS # 步骤 2:审查并自动修复严重问题 .\Windows-Security-Audit.ps1 -RemediateIssues_Fail -AutoRemediate # 步骤 3:验证修复 .\Windows-Security-Audit.ps1 -Modules Core,CIS,MS ``` ### 3. 配置漂移检测 **场景**:每月安全态势检查 ``` # 生成基线 .\Windows-Security-Audit.ps1 -OutputPath "C:\Baselines\2025-01-baseline.html" # 稍后比较 .\Windows-Security-Audit.ps1 -OutputPath "C:\Baselines\2025-02-check.html" # 使用 CSV 导出在 Excel 中跟踪变更 ``` ### 4. 事件响应 **场景**:在怀疑遭到入侵后验证系统安全性 ``` # 快速安全验证(核心检查) .\Windows-Security-Audit.ps1 -Modules Core -OutputFormat JSON # 综合验证(所有 frameworks) .\Windows-Security-Audit.ps1 -OutputFormat HTML ``` 5. SIEM 集成 **场景**:自动化合规性监控流水线 ``` # 计划任务生成 XML 用于 SIEM .\Windows-Security-Audit.ps1 -OutputFormat XML -OutputPath "\\SIEM\drops\%COMPUTERNAME%-audit.xml" ``` ### 6. 变更控制验证 **场景**:变更前/后的安全验证 ``` # 变更前基线 .\Windows-Security-Audit.ps1 -OutputPath "Pre-Change-Audit.json" # 变更后验证 .\Windows-Security-Audit.ps1 -OutputPath "Post-Change-Audit.json" # 编程方式比较 JSON 文件 ``` ## 🗂️ 项目结构 ``` Windows-Security-Audit/ ├── Windows-Security-Audit.ps1 # Main orchestrator (v5.3) │ ├── Result validation & normalization │ ├── Module execution engine │ ├── Multi-format report generation │ └── Intelligent remediation system │ ├── modules/ # Compliance framework modules │ ├── module-core.ps1 # Foundational security (45+ checks) │ ├── module-cis.ps1 # CIS Benchmarks (127+ checks) │ ├── module-ms.ps1 # Microsoft Baselines (80+ checks) │ ├── module-nist.ps1 # NIST 800-53/CSF (60+ checks) │ ├── module-stig.ps1 # DISA STIGs (90+ checks) │ ├── module-nsa.ps1 # NSA Guidance (60+ checks) │ └── module-cisa.ps1 # CISA CPG (80+ checks) │ ├── Reports/ # Generated reports (auto-created) │ ├── Security-Audit-Report-*.html │ ├── Security-Audit-Report-*.json │ ├── Security-Audit-Report-*.csv │ └── Security-Audit-Report-*.xml │ ├── Logs/ # Remediation logs (auto-created) │ └── Remediation-Log-*.json │ ├── README.md # This file ├── CONTRIBUTING.md # Contribution guidelines ├── CHANGELOG.md # Version history ├── SECURITY.md # Security policy ├── LICENSE # MIT License └── .gitignore # Git ignore rules ``` ## 🔍 审计内容? ### 安全领域 | 领域 | 检查项 | 示例 | |--------|--------|----------| | **Access Control** | 200+ | 账户策略、用户权限、权限管理、本地管理员枚举 | | **Authentication** | 160+ | 密码策略、MFA 要求、凭据保护 (WDigest, LSASS) | | **Audit & Accountability** | 140+ | 事件日志 (18+ 子类别)、审计策略、日志保留、PowerShell 日志 | | **System Hardening** | 250+ | UAC, Secure Boot, 服务配置, AutoPlay/AutoRun, 最小权限 | | **Network Security** | 180+ | 防火墙 (所有配置文件), SMB 安全, LLMNR, NetBIOS, 协议加固 | | **Data Protection** | 120+ | BitLocker 加密, EFS 使用, 静态/传输中数据保护 | | **Malware Defense** | 150+ | Windows Defender (实时, 云端, 行为), 签名更新, ASR 规则 | | **Application Control** | 80+ | AppLocker 策略, WDAC, 软件限制, 执行策略 | | **Update Management** | 60+ | Windows Update 状态, 待处理更新, 自动更新配置 | | **Incident Response** | 50+ | 系统还原, 备份配置, VSS, 恢复能力 | ### 检查示例(子集) ✅ **关键安全控制:** - SMBv1 协议已禁用 (WannaCry/NotPetya 攻击向量) - 系统驱动器上已启用 BitLocker 加密 - Windows Defender 实时保护处于活动状态 - PowerShell v2 已禁用 (无日志记录, 降级攻击) - Guest 账户已禁用 - 内置 Administrator 已重命名/禁用 - UAC 已启用并带有安全桌面提示 - 账户锁定策略已配置 (≤5 次尝试) - RDP 需要 Network Level Authentication - LSASS 作为 Protected Process Light 运行 ✅ **合规性要求:** - 最小密码长度 ≥14 个字符 (STIG) - 密码历史记录 ≥24 个密码 (STIG/CIS) - 已为 18+ 个子类别配置审计策略 (NIST) - 安全事件日志 ≥1024 MB (STIG) - 所有配置文件上的防火墙均已启用 (CAT I) - LAN Manager 身份验证级别 ≥5 (STIG) - 需要 SMB 签名 (NIST/CIS) - WDigest 凭据缓存已禁用 (NSA) ✅ **加固措施:** - Credential Guard 已启用 (如支持) - Device Guard/HVCI 已配置 - Attack Surface Reduction 规则处于活动状态 - Controlled Folder Access (勒索软件保护) - Network Protection 已启用 - Exploit Protection 已配置 - Secure Boot 已启用 - 不必要的服务已禁用 有关完整的检查列表,请参阅 [Module Documentation](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Module-Documentation)。 ## ⚠️ 重要注意事项 ### 管理员权限 **审计模式:** - 许多检查需要 Administrator 权限 - 非管理员执行会显示警告但会继续 - 部分检查在未提权情况下将返回 "Unable to verify" **修复模式:** - **必须**拥有 Administrator 权限 - 脚本在修复前会验证管理员权限 - 如在未提权情况下运行则会优雅退出 ### 性能与影响 **执行时间:** - 完整审计 (所有 8 个模块): 2-5 分钟 - 单个模块: 15-60 秒 - 影响因素: 系统速度、已启用功能、模块选择 **系统影响:** - 审计期间为 **只读操作** (无变更) - 最小的 CPU/内存占用 - 无网络流量 (Windows Update 检查除外) - 可安全地在生产系统上运行 **修复影响:** - 会进行 **持久性配置更改** - 可能影响系统功能 - 部分更改需要重启 - 首先在非生产环境中测试 ### 安全与隐私 ✅ **脚本执行的操作:** - 读取系统配置 (注册表, 服务, 策略) - 查询 Windows 安全中心 - 检查文件/文件夹权限 - 生成本地报告 ❌ **脚本不会执行的操作:** - 向外部传输数据 - 安装软件 - 创建网络连接 (localhost 除外) - 访问用户数据或文件 - 在审计期间修改系统 (仅在使用修复标志时) **报告安全:** - 报告可能包含敏感系统信息 - 请妥善存储报告并设置适当的访问控制 - 在外部共享前需对报告进行脱敏处理 - 考虑为了合规性对报告进行加密 ### 测试与验证 **生产使用前:** 1. 首先在非生产系统上测试 2. 在自动应用之前审查所有修复命令 3. 在修复前创建系统还原点 4. 准备好可用的备份 5. 为需要重启的更改规划维护窗口 **验证:** - 运行基线审计,修复,然后重新审计 - 比较前/后结果 - 验证修复后的系统功能 - 检查应用程序兼容性 ### 限制 - **仅限本地评估** - 不审计远程系统或域 - **时间点快照** - 结果代表执行时的配置 - **特定平台** - 仅限 Windows 10/11 和 Server 2016+ - **功能检测** - 部分检查可能不适用于所有 Windows 版本 - **无主动扫描** - 不测试可利用的漏洞 ### 免责声明 此工具仅用于 **安全评估和合规性审计目的**。结果应由合格的安全专业人员审查,并在您的环境背景下进行验证。该工具可识别潜在的安全问题,但无法保证全面的安全覆盖。请务必在非生产环境中进行测试,然后再将修复应用于生产系统。 ## 🤝 贡献 我们欢迎各种贡献!详情请参阅 [CONTRIBUTING.md](https://github.com/Sandler73/Windows-Security-Audit-Project/blob/main/CONTRIBUTING.md)。 ### 贡献方式 - 🐛 **报告 Bug** - 发现问题?提交 GitHub issue - 💡 **建议功能** - 有想法?发起 Discussion - 📝 **改进文档** - 增强 Wiki 页面和示例 - 🔧 **提交修复** - 修复问题并提交 PR - ✨ **添加检查** - 贡献新的安全检查或模块 - 🧪 **测试** - 在不同的 Windows 版本上验证 - 🌐 **翻译** - 帮助进行国际化 ### 开发工作流 1. Fork 本仓库 2. 创建功能分支 (`git checkout -b feature/NewSecurityCheck`) 3. 遵循编码规范 (见 [Development Guide](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki/Development-Guide)) 4. 在多个 Windows 版本上彻底测试 5. 更新文档 6. 提交更改 (`git commit -m 'Add: New SMB3 encryption check'`) 7. 推送到分支 (`git push origin feature/NewSecurityCheck`) 8. 打开包含详细描述的 Pull Request ### 编码规范 - **PowerShell 风格** - 遵循 PowerShell 最佳实践 - **错误处理** - 适当地使用 try/catch 块 - **注释** - 记录复杂的逻辑 - **函数命名** - 使用 Verb-Noun 格式 - **结果格式** - 遵循标准化输出结构 - **测试** - 在 Windows 10, 11, Server 2019, 2022 上验证 ## 📜 许可证 本项目采用 **MIT 许可证** 授权 - 详情请参阅 [LICENSE](https://github.com/Sandler73/Windows-Security-Audit-Project/blob/main/LICENSE)。 ### 这意味着什么 ✅ **您可以:** - 商业使用 - 修改和分发 - 私人使用 - 再许可 ❌ **您不得:** - 追究作者责任 - 使用商标 📋 **您必须:** - 包含许可证和版权声明 - 说明所做的更改 ## 🙏 致谢 本项目基于各个安全组织的工作和指导: ### 安全框架 - **[DISA](https://public.cyber.mil/stigs/)** - Defense Information Systems Agency STIGs - **[NIST](https://csrc.nist.gov/)** - National Institute of Standards and Technology - **[CIS](https://www.cisecurity.org/)** - Center for Internet Security Benchmarks - **[NSA](https://www.nsa.gov/Cybersecurity/)** - National Security Agency Cybersecurity Guidance - **[CISA](https://www.cisa.gov/cybersecurity)** - Cybersecurity and Infrastructure Security Agency - **[Microsoft](https://www.microsoft.com/en-us/download/details.aspx?id=55319)** - Security Compliance Toolkit ### 社区 - 提交 PR 并报告问题的贡献者 - 提供反馈的安全专业人员 - 在生产环境中进行测试的 Windows 管理员 ### 工具与库 - PowerShell 团队提供的优秀脚本平台 - Windows 安全社区提供的研究和文档 ## 📞 支持与资源 ### 获取帮助 - **📖 文档** - [Project Wiki](https://github.com/Sandler73/Windows-Security-Audit-Project/wiki) - **❓ 提问** - [GitHub Discussions](https://github.com/Sandler73/Windows-Security-Audit-Project/discussions) - **🐛 Bug 报告** - [GitHub Issues](https://github.com/Sandler73/Windows-Security-Audit-Project/issues) - **💬 社区** - [Security Community Forums] ### 保持更新 - ⭐ **Star 本仓库** - 获取新版本通知 - 👀 **Watch** - 关注开发活动 - 🔔 **订阅 releases** - 获取新版本通知 ### 安全问题 - 查看 [SECURITY.md](https://github.com/Sandler73/Windows-Security-Audit-Project/blob/main/SECURITY.md) 以了解漏洞报告 - 通过 GitHub Security Advisories 私下报告安全问题 - 预期响应时间:48-72 小时 ## 📊 项目统计 | 指标 | 值 | |--------|-------| | **当前版本** | 6.0 | | **总安全检查项** | 1,855 | | **覆盖框架** | 8 | | **代码库** | ~21,200 行 PowerShell (modules: 19,593 + orchestrator: ~1,600) | | **模块** | 8 个专项合规模块 | | **输出格式** | 5 (HTML, JSON, CSV, XML, Console) | | **测试的 Windows 版本** | 10, 11, Server 2016/2019/2022 | | **PowerShell 版本** | 5.1+ | | **结果字段** | 9 (含 Severity 和 CrossReferences) | | **跨引用映射** | 1,568 | | **活跃开发** | ✅ 是 | ## 📄 版本历史 ### 版本 6.0 (当前) - 2026 年 3 月 - ✨ **新增**: 每项检查的严重性分类 (Critical/High/Medium/Low/Informational) - ✨ **新增**: 包含 1,568 个映射的跨框架关联 - ✨ **新增**: Microsoft Defender for Endpoint 模块 (85 项检查) - ✨ **新增**: 独立模块执行支持 - ✨ **新增**: 缓存感知的注册表辅助函数 - ✨ **新增**: 9 字段结果对象 (增加了 Severity 和 CrossReferences) - 🔧 **扩展**: 1,855 项总检查 (从 550+ 提升) - 🔧 **扩展**: 8 个模块 (增加了 MS-DefenderATP) - 🐛 **修复**: STIG $anonSid 未使用变量, NIST $Priority/$Severity 不匹配, MS $profile 保留变量 ### 版本 5.3 - 2026 年 2 月 - ✨ **新增**: 交互式和自动化修复系统 - ✨ **新增**: 从 HTML 报告选择中进行针对性修复 - ✨ **新增**: 兼容 SIEM 的 XML 输出格式 - ✨ **新增**: 带有主题切换的增强型 HTML 报告 - ✨ **新增**: 从 HTML 进行多格式导出 (CSV, Excel, JSON, XML, TXT) - ✨ **新增**: 结果验证和标准化系统 - ✨ **新增**: 全面的修复日志 - 🔧 **改进**: 自动化修复的安全机制 - 🔧 **改进**: 模块统计和执行追踪 - 🐛 **修复**: 跨模块的状态值一致性 - 🐛 **修复**: 结果对象验证和修复 ### 版本 5.0 - 2025 年 12 月 - 采用模块化架构完全重写 - 跨 7 个框架的 550+ 项安全检查 - 多种输出格式 (HTML, JSON, CSV) - 改进的错误处理和日志记录 - 全面的文档 有关完整的版本历史,请参阅 [CHANGELOG.md](https://github.com/Sandler73/Windows-Security-Audit-Project/blob/main/CHANGELOG.md)。
**⭐ 如果此项目帮助您保护了 Windows 系统,请考虑给它一个 star! ⭐** **[ 返回顶部](#windows-security-audit-script)** 为网络安全社区用 ❤️ 打造
标签:AI合规, Anthropic, CISA, CIS基准, Cloudflare, Conpot, DevSecOps, DISA STIG, EVTX日志, GPT, Homebrew安装, HTML报告, ISO 27001, JSON数据, Libemu, Libemu, Libemu, MITRE ATT&CK, Mr. Robot, NIST, NSA, PowerShell脚本, SIEM集成, Web报告查看器, Windows Server, Windows安全, 上游代理, 交互式修复, 企业安全, 反取证, 后渗透, 基线加固, 多模态安全, 安全合规, 安全基线, 安全评估, 教学环境, 数据包嗅探, 无线安全, 流量嗅探, 渗透测试辅助, 漏洞管理, 系统加固, 网络代理, 网络取, 网络资产管理, 自动化运维, 靶机