CyberArk 安全审计
一个基于 PowerShell 的综合安全评估工具,用于 CyberArk 特权访问管理(PAM)平台。专为进攻型安全专业人员、红队和渗透测试人员设计。
该工具旨在通过网络远程对 CyberArk 服务器运行。它不需要在 CyberArk 服务器本身上执行。所有检查均通过网络使用 PVWA API、端口扫描和 Web 测试远程执行。
此工具执行的安全检查包括:CIS 基准合规性、供应商最佳实践、黑盒测试、网络安全分析、特定 CVE 漏洞检查(包括 2025 年 CVE)、机器身份安全、机密管理、零常设权限(ZSP)评估、身份治理以及增强的安全检查。
| 特性 | 描述 |
|---|---|
| 远程审计 | 所有检查均通过网络远程执行——无需安装在 CyberArk 服务器上 |
| OPSEC 模式 | 隐身扫描,具有可配置的延迟、抖动和更低的检测特征 |
| 代理支持 | 将所有流量通过 Burp Suite、ZAP 或其他拦截代理路由 |
| 计时攻击 | 通过响应时间分析检测用户枚举和盲注入 |
| JWT 安全 | 测试 none 算法绕过、密钥混淆、弱签名算法 |
| WebSocket 测试 | 发现实时端点并测试跨站点 WebSocket 劫持 |
| WAF 绕过 | 测试编码绕过、HTTP 参数污染、请求走私 |
| User-Agent 轮换 | 随机化或自定义 User-Agent 字符串以规避指纹识别 |
| 并行执行 | 可选的并行执行以加快扫描速度 |
| 静默模式 | 减少控制台输出,适用于自动化和脚本编写 |
| 凭证安全 | 安全处理,使用后清理内存 |
| 全面报告 | HTML 面板、7 个 CSV 文件和结构化 JSON,适用于程序化使用 |
| PoC 证据 | HTML 报告中包含请求/响应概念验证,适用于渗透测试 |
| 选择性执行 | 仅运行特定的检查类别(portscan、CVE、blackbox、authenticated、network) |
| 误报减少 | 基线指纹识别以消除 SPA catch-all 误报 |
| 身份认证测试 | StartAuthentication/ForgotUsername 信息泄露和枚举检查 |
| 要求 |
|---|
| 审计阶段 | 所需的访问权限 |
|---|---|
| 阶段 1(未认证) | 对 PVWA 的网络访问(HTTPS/443) |
| 阶段 2(已认证) | 具有 Vault Admin 或 Auditor 角色的 CyberArk API 凭证 |
此脚本完全自包含,仅使用原生 PowerShell 和 .NET Framework 功能。无需安装其他工具或模块。
脚本利用:
System.Net.Sockets.TcpClient、System.Net.Security.SslStream 用于网络和 TLS 分析Invoke-WebRequest、Invoke-RestMethod 用于 HTTP/API 测试System.Security.Cryptography.X509Certificates 用于证书分析打开 PowerShell 并运行:```powershell $PSVersionTable.PSVersion
确保主版本为 **7 或更高版本**。如果不是,请[下载 PowerShell 7.x](https://github.com/PowerShell/PowerShell/releases)。
> **注意:** 此脚本需要 PowerShell 7.0 或更高版本。不支持 Windows PowerShell 5.1。
### 步骤 2:下载脚本
**选项 A:克隆仓库(推荐)**```powershell
git clone https://github.com/Logisek/HuntCyberArk.git
cd HuntCyberArk
选项 B:直接下载```powershell
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Logisek/HuntCyberArk/main/CyberArk-Security-Audit.ps1" -OutFile "CyberArk-Security-Audit.ps1"
### 步骤3:设置执行策略(如果需要)
如果您遇到脚本执行错误,请临时允许执行脚本:```powershell
# Check current policy
Get-ExecutionPolicy
# Set for current session only (recommended)
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
# Or unblock the downloaded script
Unblock-File -Path .\CyberArk-Security-Audit.ps1
为了正确进行TLS测试,请确保你的PowerShell会话支持TLS 1.2+:```powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
### 第5步:测试连接
确认你可以访问PVWA服务器:```powershell
# Test basic connectivity
Test-NetConnection -ComputerName pvwa.domain.com -Port 443
# Test HTTPS endpoint
Invoke-WebRequest -Uri "https://pvwa.domain.com/PasswordVault/" -UseBasicParsing -TimeoutSec 10
PowerShell 7 提供了更好的性能和更佳的 TLS 支持:```powershell
winget install Microsoft.PowerShell
## 审计阶段与身份验证要求
审计分两个阶段进行,每个阶段有不同的身份验证要求:
### 第一阶段:未经验证的检查(无需凭据)
无需任何凭据即可运行的外部/黑盒测试:
- 网络安全(端口扫描,保险库端口暴露)
- TLS/SSL 配置与证书分析
- 黑盒 Web 安全(暴露的端点、信息泄露)
- PVWA 安全标头与 Cookie 安全
- CVE 特定漏洞测试(包括 2025 年 CVE)
- API 安全测试(未经身份验证的端点)
- 组件版本检测
- 时序攻击检测
- JWT/OAuth2 安全测试
- WebSocket 端点发现
- WAF 绕过测试
- CyberArk Identity/Privilege Cloud 身份验证端点测试(StartAuthentication、ForgotUsername)
**使用场景**:渗透测试、外部安全评估、快速侦察
### 第二阶段:经过身份验证的检查(需要 CyberArk API 凭据)
需要 CyberArk REST API 访问权限的深度配置审计:
- Safe 配置与权限
- 账户与凭据管理设置
- 平台配置
- 用户账户与保险库权限
- 身份验证方法设置
- 组件健康状态
- Master Policy、PSM、CPM、PTA 配置
- 机器身份安全(服务账户、AppID)
- 秘密管理(CP/CCP 配置)
- 零常设特权(JIT 访问评估)
- 身份治理(孤立身份、权限漂移)
- 云安全(AWS/Azure/GCP 集成)
- 灾难恢复(DR 保险库、HA 集群健康)
- 合规映射(NIST、SOC 2、PCI-DSS)
- Secrets Hub 集成(云原生秘密同步)
- 远程访问 / Alero 安全
- Kubernetes 秘密安全
- DevSecOps 流水线安全
- Privilege Cloud / SaaS 特定检查
- CyberArk Identity / Idaptive 集成
- 自定义插件安全
- 备份安全
- HSM 集成
- PTA 高级检测
- 第三方集成(SIEM、ITSM、SOAR)
- 运维卫生指标
- 攻击路径模拟
- 供应链完整性
- 网络分段
**所需权限**:建议使用 Vault Admin 或 Auditor 角色
## 功能特性
### 安全检查类别
| 类别 | 控制前缀 | 描述 |
|----------|---------------|-------------|
| CIS 基准 | 1.x - 8.x | CIS CyberArk PAM 基准 v1.0 合规 |
| 供应商最佳实践 | V1.x - V8.x | CyberArk 安全加固建议 |
| 黑盒测试 | BB1 - BB11 | 无需身份验证的外部安全测试 |
| 网络安全 | NET1 - NET7 | 端口扫描与网络暴露分析 |
| TLS 安全 | TLS1 - TLS4 | SSL/TLS 配置与密码套件分析 |
| CVE 检查 | CVE1 - CVE23 | 已知 CyberArk 漏洞检测(2018-2025) |
| 安全公告 | CA25-x | CyberArk 安全公告检查 |
| API 安全 | API1 - API5 | REST API 安全测试 |
| 身份验证安全 | AUTH1 - AUTH2 | CyberArk Identity/Privilege Cloud 身份验证端点测试 |
| **高级安全** | | |
| 机器身份 | MID1 - MID9 | 服务账户、AppID 和 AIM Provider 安全 |
| 秘密管理 | SEC1 - SEC14 | 凭据提供者/CCP 和 Conjur 安全 |
| 零常设特权 | ZSP1 - ZSP5 | JIT 访问和权限评估 |
| 身份治理 | IGA1 - IGA8 | 生命周期和权限管理 |
| EPM 集成 | EPM1 - EPM6 | 端点特权管理器检查 |
| 云安全 | CLD1 - CLD6 | 安全云访问检查 |
| 灾难恢复 | DR1 - DR5 | HA 和 DR 配置 |
| 合规映射 | COMP1 - COMP4 | NIST、SOC2、PCI-DSS 对齐 |
| 审计日志 | AUD1 - AUD4 | SIEM 和日志记录验证 |
| **安全态势扩展** | | |
| Secrets Hub | SH1 - SH6 | 云秘密同步健康、延迟、版本漂移 |
| 远程访问 / Alero | RA1 - RA6 | 供应商邀请、MFA、会话限制、设备绑定 |
| Kubernetes 秘密 | K8S1 - K8S8 | Secrets Provider、RBAC、Pod 安全、Conjur 追随者 |
| DevSecOps 流水线 | DSO1 - DSO6 | CI/CD 秘密检索、扩散检测、短生命周期令牌 |
| Privilege Cloud | PC1 - PC5 | 连接器健康、租户隔离、ISP 集成 |
| CyberArk Identity | IDN1 - IDN6 | SSO 集成、自适应 MFA、会话风险评分 |
| 自定义插件 | PLG1 - PLG5 | PSM/CPM 插件安全、数字签名、ACL |
| 备份安全 | BKP1 - BKP5 | 加密、文件权限、恢复测试 |
| HSM 集成 | HSM1 - HSM4 | HSM 健康、密钥包装、分区隔离 |
| PTA 深度分析 | PTAD1 - PTAD6 | 自定义规则、ML 质量、UEBA、告警疲劳 |
| 第三方集成 | TPI1 - TPI5 | SIEM/ITSM/SOAR 连接性、凭据健康 |
| 运维卫生 | OPS1 - OPS8 | 上线队列、CPM 失败、PSM 指标、许可 |
| 攻击路径模拟 | APS1 - APS6 | PtH、NTLM 中继、Kerberoasting、权限提升 |
| 供应链完整性 | SCI1 - SCI5 | 文件哈希、补丁时效、代码签名 |
| 网络分段 | NSG1 - NSG5 | 保险库隔离、组件 ACL、东西向监控 |
### 详细检查覆盖范围
#### CIS 基准合规(1.x - 8.x)
- 专用 Vault 服务器配置
- 防火墙规则和服务加固
- Master Policy 密码设置
- 密码复杂度和过期策略
- Safe 访问和权限
- 自动密码管理
- MFA 和 LDAP 安全
- PSM 会话录制
- 审计日志和 SIEM 集成
- TLS 配置
#### 供应商最佳实践(V1.x - V8.x)
- Master Policy 设置(有效期限、一次性密码、独占访问)
- PSM 录制、按键记录、剪贴板限制
- 账户发现和上线规则
- PTA 异常检测
- 连接组件安全
- 关联账户(登录/协调)
- PVWA HTTP 安全标头
- CPM 服务配置
#### 黑盒安全测试(BB1 - BB11)
- 暴露的敏感端点(Swagger、API 文档、管理页面)
- 信息泄露(版本、堆栈跟踪)
- 默认凭据测试
- 危险 HTTP 方法(PUT、DELETE、TRACE)
- Cookie 安全属性(Secure、HttpOnly、SameSite)
- CORS 配置错误
- 备份/配置文件暴露
- 目录列表
- SSL/TLS 证书问题
- 速率限制检测
- 已知漏洞模式
#### CyberArk Identity / Privilege Cloud 身份验证安全(AUTH1 - AUTH2)
- **StartAuthentication 信息泄露**:检测敏感数据暴露,包括:
- 预认证响应中的 Session ID 暴露
- 通过身份验证挑战进行用户枚举(有效用户与无效用户)
- MFA 机制泄露(UP、SMS、EMAIL、OATH、QR 等)
- 身份验证响应中的电子邮件/PII 泄露
- Tenant ID 暴露
- 身份验证配置详情
- **ForgotUsername 端点枚举**:通过密码恢复测试用户名枚举:
- 功能可用性检测
- 有效用户与无效用户的差异响应分析
#### 网络安全(NET1 - NET7)
- **端口扫描**:全面扫描 CyberArk 特定端口
- PVWA(443、80)
- Vault(1858、1859)
- 管理(RDP、SSH、WinRM)
- 数据库(MSSQL、MySQL、PostgreSQL、Oracle)
- 协议(SMB、NetBIOS、LDAP、SNMP)
- Vault 端口(1858)安全分析
- DNS 安全配置
#### TLS/SSL 安全(TLS1 - TLS4)
- 弱协议检测(SSLv2、SSLv3、TLS 1.0、TLS 1.1)
- 密码套件强度分析
- 弱密码检测(RC4、DES、3DES、MD5、NULL、EXPORT)
- 证书验证
- 密钥大小验证
- 签名算法检查
#### CVE 特定漏洞检查(CVE1 - CVE23)
- **CVE-2018-9842**:通过端口 1858 导致 Vault 内存泄露
- **CVE-2018-9843**:PVWA 反序列化 RCE(预认证)
- **CVE-2019-7442**:SAML 身份验证中的 XXE
- **CVE-2021-31796**:远程凭据文件利用(探测暴露的 .cred 文件,分析 VerificationsFlag 以判断密码是否可解密)
- **CVE-2021-37151**:通过 MFA 响应长度进行的 CyberArk Identity 用户名枚举(中危)——通过 StartAuthentication 信息泄露检查检测
- **CVE-2022-22700**:通过 X-CFY-TX-TM 时序标头进行的 CyberArk Identity 用户名枚举(中危)——通过 StartAuthentication 信息泄露检查检测
- **CWE-200**:StartAuthentication 端点信息泄露(Session ID、MFA 机制、Tenant ID、认证配置)
- **CWE-203**:通过可观察差异进行的 ForgotUsername 端点用户名枚举
- **CVE-2024-42340**:CWE-602 客户端执行绕过
- **CVE-2024-42339**:IDOR / 敏感信息泄露
- **CVE-2024-54840**:PVWA Host Header 注入(中危)
- **CVE-2024-57967**:PVWA LDAP 映射权限提升(中危)
- **CVE-2025-22270**:EPM 角色管理中的 HTML 注入
- **CVE-2025-22271**:EPM X-Forwarded-For 欺骗
- **CVE-2025-22272**:EPM 通过 modalDlgMsgInternal 实现 XSS
- **CVE-2025-22273**:EPM 密码更改暴力破解
- **CVE-2025-22274**:EPM 应用程序定义注入
- **CVE-2025-49827**:Secrets Manager IAM 认证器绕过(严重)
- **CVE-2025-49828**:Secrets Manager 远程代码执行(高危)
- **CVE-2025-49829**:Secrets Manager 缺少验证(中危)
- **CVE-2025-49830**:Secrets Manager 路径遍历与文件泄露(高危)
- **CVE-2025-49831**:Secrets Manager 网络绕过(严重)
- 安全公告:CA25-25、CA25-29、CA25-32、CA25-34、CA25-35
- 其他检查:路径遍历、Log4Shell 指标、遗留 API 版本
- 第三方:ag-grid 原型污染(CVE-2024-38996)、Log4Shell(CVE-2021-44228)
#### API 安全测试(API1 - API5)
- **BOLA/IDOR**:对象级授权漏洞
- **注入测试**:SQL 注入、LDAP 注入
- **批量赋值**:特权属性注入
- **API 版本控制**:遗留 API 端点检测
#### 高级安全检查
- 组件版本检测与 CVE 映射
- 会话安全(固定会话、并发会话)
- 标头注入(Host 标头、CRLF)
- 对 SOAP 端点的 XXE 漏洞测试
#### 机器身份安全(MID1 - MID9)
- 服务账户枚举与权限分析
- 机器身份密码轮换验证
- 过度授权的服务账户检测
- 基于证书的身份验证配置
- AppID 安全验证(允许的机器、OS 用户限制)
- 失效机器身份检测
- AIM Provider 部署验证
- AIM Provider 配置安全
- AIM Provider 与 Vault 的连接性
#### 秘密管理(SEC1 - SEC14)
- 凭据提供者(CP/CCP)部署验证
- AppID 身份验证方法强度分析
- 允许的机器配置验证
- 缓存 TTL 和刷新间隔设置
- CCP TLS/mTLS 配置
- 秘密轮换策略实施
- 孤立/未管理的秘密检测
- 凭据扩散分析
- Conjur 集成健康
- MAML 策略验证
- 认证器配置(LDAP、OIDC、IAM、K8s)
- Conjur 数据库加密
- API 密钥轮换策略
- Conjur 审计日志
#### 零常设特权(ZSP1 - ZSP5)
- 永久特权访问检测
- 双人控制工作流验证
- 并发会话限制检查
- 签入/签出执行
- 常设特权减少建议
- JIT 就绪评分
#### 身份治理(IGA1 - IGA8)
- 孤立身份检测
- 权限漂移分析
- 非活跃用户账户检测
- 过度 Safe 成员关系分析
- 访问认证状态
- 角色/组成员关系扩散
- 待处理账户队列年龄
- 账户所有权缺口检测
#### EPM 集成(EPM1 - EPM6)
*需要 EPM URL 和可选的身份验证*
- EPM 集成状态验证
- 默认策略安全评估
- 应用程序控制模式验证
- 凭据窃取保护状态
- 提权请求理由要求
- EPM 审计日志配置
#### 云安全(CLD1 - CLD6)
- 云提供商集成状态(AWS、Azure、GCP)
- 联合身份配置
- 云秘密同步策略验证
- CIEM 集成评估
- 云 IAM 角色绑定分析
- 多云策略一致性
#### 灾难恢复(DR1 - DR5)
- DR Vault 复制状态
- HA 集群健康验证
- 组件冗余评估
- 备份配置验证
- 紧急账户可用性
#### 合规映射(COMP1 - COMP4)
- NIST 网络安全框架映射
- SOC 2 Type II 对齐指标
- PCI-DSS 相关控制
- CyberArk Blueprint 成熟度评分
#### 审计日志(AUD1 - AUD4)
- SIEM 集成健康
- 审计日志保留配置
- 关键事件告警验证
- 审计数据完整性验证
#### Active Directory 安全(AD1 - AD7)——基于 zBang 思路
*需要域连接和 `-IncludeADChecks` 参数*
- **影子管理员发现**:检测对特权对象具有直接 ACL 权限的账户
- **万能钥匙检测**:检查域控制器上 Skeleton Key 恶意软件迹象
- **SID 历史分析**:识别具有特权 SID 历史属性的账户
- **风险 SPN 配置**:查找具有 SPN 的用户账户(Kerberoasting 目标)
- **无约束委托**:发现具有无约束 Kerberos 委托的账户
- **带协议转换的约束委托**:检测 S4U2Self 滥用可能性
- **委托权限审计**:全面委托配置摘要
#### Secrets Hub(SH1 - SH6)
*需要 `-IncludeSecretsHubChecks` 和可选的 `-SecretsHubUrl`*
- Secrets Hub 同步健康监控
- 同步延迟测量
- 源与目标之间的版本漂移检测
- 同步失败率分析
- 目标配置验证
- Secrets Hub 审计日志
#### 远程访问 / Alero(RA1 - RA6)
*需要 `-IncludeRemoteAccessChecks` 和可选的 `-AleroUrl`*
- 供应商邀请工作流安全
- 会话时间限制配置
- 生物识别/设备绑定要求
- 远程访问审计日志完整性
- 定期访问审查实施
- 远程访问的 MFA 强制
#### Kubernetes 秘密(K8S1 - K8S8)
*需要 `-IncludeK8sChecks` 和可选的 `-K8sNamespace`、`-ConjurApplianceUrl`*
- Secrets Provider 部署模式验证
- Pod 安全上下文验证
- Service Account JWT 身份验证
- Kubernetes 秘密轮换
- 秘密相关的 RBAC 配置
- 挂载的秘密权限
- Conjur 追随者健康
- Kubernetes 审计日志
#### DevSecOps 流水线(DSO1 - DSO6)
*需要 `-IncludeDevSecOpsChecks`*
- CI/CD 秘密检索模式
- 流水线秘密扩散检测
- 短生命周期令牌使用验证
- 流水线审计日志
- 构建工件中的秘密检测
- 流水线身份绑定
#### Privilege Cloud(PC1 - PC5)
*需要 `-IncludePrivilegeCloudChecks` 或 `-PrivilegeCloudTenant` 或 `-IsPrivilegeCloud`*
- Privilege Cloud 连接器健康
- 身份安全平台集成
- Privilege Cloud API 安全
- 租户隔离验证
- 云连接器冗余
#### CyberArk Identity(IDN1 - IDN6)
*需要 `-IncludeIdentityChecks` 或 `-IdentityTenantUrl`*
- 与 PVWA 的 SSO 集成
- 自适应 MFA 策略配置
- 身份生命周期同步
- 会话风险评分
- 身份审计集成
- 特权应用目录策略
#### 自定义插件(PLG1 - PLG5)
*需要 `-IncludePluginChecks`*
- 自定义 PSM 连接器安全
- 自定义 CPM 插件注入风险
- 未经授权/过时组件检测
- 插件数字签名验证
- 自定义脚本文件权限
#### 备份安全(BKP1 - BKP5)
*需要 `-IncludeBackupSecurityChecks` 和可选的 `-BackupPath`*
- Vault 备份加密
- 备份文件权限
- 传输中备份加密
- 备份恢复测试
- 备份保留策略
#### HSM 集成(HSM1 - HSM4)
*需要 `-IncludeHSMChecks` 和可选的 `-HSMProvider`*
- HSM 连接性与健康
- HSM 密钥包装配置
- HSM 分区隔离
- HSM 固件时效性
#### PTA 深度分析(PTAD1 - PTAD6)
*需要 `-IncludePTADeepDive`*
- PTA 自定义检测规则
- PTA ML 模型质量
- PTA 告警疲劳(误报分析)
- PTA 检测规则覆盖范围
- PTA UEBA 集成
- PTA 自动响应操作
#### 第三方集成(TPI1 - TPI5)
*需要 `-IncludeThirdPartyChecks` 和可选的 `-ServiceNowUrl`、`-SIEMUrl`*
- ITSM(ServiceNow)集成
- SOAR 自动响应剧本
- SIEM PAM 事件关联
- SIEM 日志转发器健康
- 集成凭据健康
#### 运维卫生(OPS1 - OPS8)
*需要 `-IncludeOperationalChecks`*
- 账户上线队列指标
- CPM 密码更改失败率
- PSM 会话成功/失败比率
- CPM 协调积压
- 平台连接错误
- Vault 利用率和容量
- 许可合规
- 组件正常运行时间
#### 攻击路径模拟(APS1 - APS6)
*需要 `-IncludeAttackPathChecks`*
- 工作站到 PAM 的升级路径
- 传递哈希攻击面
- NTLM 中继风险
- 缓存凭据提取弹性
- Kerberoasting 暴露
- 权限升级路径
#### 供应链完整性(SCI1 - SCI5)
*需要 `-IncludeSupplyChainChecks`*
- 组件文件哈希验证
- 补丁时效验证
- 第三方库漏洞
- 数字签名验证
- 组件来源验证
#### 网络分段(NSG1 - NSG5)
*需要 `-IncludeNetworkSegmentationChecks`*
- Vault 网络隔离
- PSM 到 Vault 的通信限制
- PVWA 到后端的分段
- 东西向流量监控
- 组件特定网络 ACL
## 要求
### 软件要求
| 组件 | 版本 | 备注 |
|-----------|---------|-------|
| PowerShell | 7.0+ | 需要 PowerShell 7.x(不支持 Windows PowerShell 5.1) |
| .NET Framework | 4.5+ | 用于 TLS/SSL 和网络操作 |
| CyberArk PVWA | v12+ | REST API v12 或更高版本以实现完全兼容 |
### 各阶段的访问要求
| 阶段 | 要求 | 目的 |
|-------|-------------|---------|
| 第一阶段 | 对 PVWA 的网络访问 | 黑盒测试、端口扫描、TLS 分析 |
| 第二阶段 | CyberArk API 凭据 | 配置审计、策略检查 |
### 经过身份验证的检查所需的凭据
对于第二阶段(经过身份验证的检查),您需要具有以下角色之一的 CyberArk 凭据:
- **Vault Admin**:完全访问所有配置和安全设置
- **Auditor**:只读访问审计配置(建议用于安全评估)
- **Safe Owners**:仅限于他们拥有的 Safe(部分审计覆盖)
### 使用的 Windows 功能
脚本使用以下 Windows/PowerShell 功能(无需安装):
| 功能 | 用途 |
|---------|----------|
| `System.Net.Sockets.TcpClient` | 端口扫描、Vault 端口安全 |
| `System.Net.Security.SslStream` | TLS/SSL 协议和密码枚举 |
| `Invoke-WebRequest` / `Invoke-RestMethod` | HTTP 测试、API 调用 |
## 快速入门```powershell
# 1. Verify PowerShell version (need 7.0+)
$PSVersionTable.PSVersion
# 2. Enable TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# 3. Run unauthenticated scan (no credentials needed)
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -UnauthenticatedOnly
# 4. Run full scan with authentication
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP
无需任何凭据即可运行外部安全检查:```powershell
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -UnauthenticatedOnly
### 带认证的完整审计```powershell
# Full audit with LDAP authentication
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP
# Full audit with pre-supplied credentials
$cred = Get-Credential
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -Credential $cred
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -SkipPortScan
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -SkipAuthenticatedChecks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -SkipCVEChecks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -SkipSecretsChecks
-SkipMachineIdentity -SkipIGAChecks
-SkipCloudChecks
### 仅运行特定的检查类别
使用 `-Only*` 参数来专门运行特定的检查类别:```powershell
# Run ONLY port scanning
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -OnlyPortScan
# Run ONLY CVE vulnerability checks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -OnlyCVEChecks
# Run ONLY network security checks (ports, TLS, DNS)
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -OnlyNetworkChecks
# Run ONLY unauthenticated blackbox checks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -OnlyBlackboxChecks
# Run ONLY authenticated API checks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -OnlyAuthenticatedChecks -Credential $cred
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com"
-AuthType LDAP -OutputPath "C:\Reports"
-Credential $cred -SkipPortScan
-SkipCVEChecks -SkipAPITests
-PortScanTimeout 2000 `
-VerboseOutput
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com"
-AuthType LDAP -OutputPath "C:\Reports"
-ComplianceMapping -IncludeEPMChecks
-EPMUrl "https://epm.domain.com"
### 常见场景```powershell
# External penetration test (no access, no credentials)
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -UnauthenticatedOnly
# Internal security audit (with CyberArk credentials)
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP
# Quick check (skip intensive scans)
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -SkipPortScan -SkipCVEChecks
# Fast parallel port scanning (4.5x faster on PowerShell 7+)
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -ParallelExecution -MaxThreads 10
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -OPSECMode -UnauthenticatedOnly
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -Proxy "http://127.0.0.1:8080" -IgnoreCertificateErrors
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -IncludeTimingAttacks -UnauthenticatedOnly
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -IncludeJWTTests
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -IncludeWebSocketTests
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -IncludeWAFEvasion
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -RequestDelay 3 -Jitter 30 -RandomizeUserAgent
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -QuietMode -NoLogo -UnauthenticatedOnly
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com"
-OPSECMode -Proxy "http://127.0.0.1:8080"
-IncludeTimingAttacks -IncludeJWTTests
-IncludeWebSocketTests -IncludeWAFEvasion
-UnauthenticatedOnly
### CyberArk 工具集成场景```powershell
# AD Security Audit (zBang-inspired) - detect shadow admins, Kerberos issues
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP -IncludeADChecks
# AD Security with specific Domain Controller
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -IncludeADChecks -DomainController "dc01.domain.com"
# Conjur/Secrets Manager integration check
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -IncludeConjurChecks -ConjurUrl "https://conjur.domain.com"
# Comprehensive audit with CyberArk tools integration
.\CyberArk-Security-Audit.ps1 `
-PVWA "https://pvwa.domain.com" `
-AuthType LDAP `
-IncludeADChecks `
-IncludeConjurChecks `
-ConjurUrl "https://conjur.domain.com" `
-ComplianceMapping
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -OutputPath "C:\SecurityReports\CyberArk"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -UnauthenticatedOnly -QuietMode -NoLogo
-OutputPath "C:\Reports"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -ComplianceMapping -OutputPath "C:\ComplianceReports"
$auditResults = .\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP
$auditResults.ReportMetadata.RiskScore $auditResults.Findings | Where-Object { $_.Severity -eq "Critical" } $auditResults.Reports.HTML # Path to HTML report $auditResults.Reports.CSV # Array of CSV file paths $auditResults.Reports.JSON # Path to JSON report
**生成的输出文件:**
运行审计后,你会在输出目录中找到以下文件:```
C:\SecurityReports\CyberArk\
├── CyberArk_Security_Audit_20260116_143022.html # Interactive HTML dashboard
├── CyberArk_Security_Audit_20260116_143022.json # Comprehensive JSON data
├── CyberArk_Security_Audit_20260116_143022_Executive_Summary.csv
├── CyberArk_Security_Audit_20260116_143022_Full_Findings.csv
├── CyberArk_Security_Audit_20260116_143022_Failed_Findings.csv
├── CyberArk_Security_Audit_20260116_143022_Remediation_Tracker.csv
├── CyberArk_Security_Audit_20260116_143022_Skipped_Checks.csv
├── CyberArk_Security_Audit_20260116_143022_CIS_Compliance_Matrix.csv
└── CyberArk_Security_Audit_20260116_143022_Component_Summary.csv
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeSecretsHubChecks -SecretsHubUrl "https://secretshub.cyberark.cloud"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeRemoteAccessChecks -AleroUrl "https://alero.cyberark.cloud"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeK8sChecks -K8sNamespace "cyberark" -ConjurApplianceUrl "https://conjur.domain.com"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeDevSecOpsChecks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IsPrivilegeCloud -PrivilegeCloudTenant "my-tenant"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeIdentityChecks -IdentityTenantUrl "https://aab1234.id.cyberark.cloud"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeBackupSecurityChecks -BackupPath "D:\VaultBackups"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeHSMChecks -HSMProvider "Thales"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludePTADeepDive
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeThirdPartyChecks -ServiceNowUrl "https://company.servicenow.com" -SIEMUrl "https://splunk.domain.com"
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeOperationalChecks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeAttackPathChecks -IncludeADChecks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeSupplyChainChecks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -AuthType LDAP ` -IncludeNetworkSegmentationChecks
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com"
-AuthType LDAP -IncludeSecretsHubChecks
-IncludeRemoteAccessChecks -IncludeK8sChecks
-IncludeDevSecOpsChecks -IncludeIdentityChecks
-IncludePluginChecks -IncludeBackupSecurityChecks
-IncludeHSMChecks -IncludePTADeepDive
-IncludeThirdPartyChecks -IncludeOperationalChecks
-IncludeAttackPathChecks -IncludeSupplyChainChecks
-IncludeNetworkSegmentationChecks `
-ComplianceMapping
## 参数
| 参数 | 必需 | 默认值 | 描述 |
|-----------|----------|---------|-------------|
| PVWA | 是 | - | PVWA 服务器 URL(例如 https://pvwa.domain.com) |
| AuthType | 否 | CyberArk | 认证方法:CyberArk、LDAP、RADIUS、SAML |
| OutputPath | 否 | 当前目录 | 报告输出目录 |
| Credential | 否 | 提示 | 用于认证的 PSCredential |
| **跳過参数** | | | |
| SkipPortScan | 否 | False | 跳過网络端口扫描 |
| SkipCVEChecks | 否 | False | 跳過特定 CVE 漏洞测试 |
| SkipAPITests | 否 | False | 跳過 API 安全测试 |
| SkipAuthenticatedChecks | 否 | False | 跳過所有第二阶段认证检查 |
| SkipSecretsChecks | 否 | False | 跳過秘密管理检查(SEC1-SEC14) |
| SkipMachineIdentity | 否 | False | 跳過机器身份检查(MID1-MID9) |
| SkipIGAChecks | 否 | False | 跳過身份治理检查(IGA1-IGA8) |
| SkipCloudChecks | 否 | False | 跳過云安全检查(CLD1-CLD6) |
| SkipDRChecks | 否 | False | 跳過灾难恢复检查(DR1-DR5) |
| SkipDefaultCredentialTests | 否 | False | 跳過默认/弱凭据测试(BB3) |
| SkipSecretsHubChecks | 否 | False | 跳過 Secrets Hub 检查(SH1-SH6) |
| SkipRemoteAccessChecks | 否 | False | 跳過远程访问/Alero 检查(RA1-RA6) |
| SkipK8sChecks | 否 | False | 跳過 Kubernetes 检查(K8S1-K8S8) |
| SkipDevSecOpsChecks | 否 | False | 跳過 DevSecOps 检查(DSO1-DSO6) |
| SkipPrivilegeCloudChecks | 否 | False | 跳過 Privilege Cloud 检查(PC1-PC5) |
| SkipIdentityChecks | 否 | False | 跳過 CyberArk Identity 检查(IDN1-IDN6) |
| SkipPluginChecks | 否 | False | 跳過自定义插件检查(PLG1-PLG5) |
| SkipBackupSecurityChecks | 否 | False | 跳過备份安全检查(BKP1-BKP5) |
| SkipHSMChecks | 否 | False | 跳過 HSM 集成检查(HSM1-HSM4) |
| SkipPTADeepDive | 否 | False | 跳過 PTA 深度检查(PTAD1-PTAD6) |
| SkipThirdPartyChecks | 否 | False | 跳過第三方集成检查(TPI1-TPI5) |
| SkipOperationalChecks | 否 | False | 跳過运维卫生检查(OPS1-OPS8) |
| SkipAttackPathChecks | 否 | False | 跳過攻击路径模拟检查(APS1-APS6) |
| SkipSupplyChainChecks | 否 | False | 跳過供应链完整性检查(SCI1-SCI5) |
| SkipNetworkSegmentationChecks | 否 | False | 跳過网络分段检查(NSG1-NSG5) |
| **模式参数** | | | |
| UnauthenticatedOnly | 否 | False | 仅运行第一阶段(无需凭据) |
| IncludeEPMChecks | 否 | False | 包含 EPM 集成检查 |
| ComplianceMapping | 否 | False | 生成合规框架映射 |
| **选择性执行** | | | |
| OnlyPortScan | 否 | False | 仅运行端口扫描检查 |
| OnlyCVEChecks | 否 | False | 仅运行 CVE 漏洞检查 |
| OnlyAuthenticatedChecks | 否 | False | 仅运行已认证的 API 检查 |
| OnlyNetworkChecks | 否 | False | 仅运行网络安全检查(TLS、端口、DNS) |
| OnlyBlackboxChecks | 否 | False | 仅运行未经认证的黑盒检查 |
| **CyberArk 工具参数** | | | |
| IncludeADChecks | 否 | False | 启用 Active Directory 安全检查(受 zBang 启发) |
| IncludeConjurChecks | 否 | False | 启用 Conjur/Secrets Manager 集成检查 |
| ConjurUrl | 否 | - | 用于集成检查的 Conjur 服务器 URL |
| DomainController | 否 | - | 用于 AD 安全查询的域控制器 |
| **红队参数** | | | |
| OPSECMode / Stealth | 否 | False | 启用 OPSEC/隐密模式,包含延迟和降低噪音 |
| Proxy | 否 | - | 用于流量路由的代理 URL(例如 http://127.0.0.1:8080) |
| ProxyCredential | 否 | - | 经过认证的代理凭据 |
| IgnoreCertificateErrors | 否 | False | 跳過 SSL/TLS 证书验证 |
| RequestDelay | 否 | 0 | 请求之间的延迟(秒,0-60) |
| Jitter | 否 | 0 | 用于时间变化的随机抖动百分比(0-100) |
| UserAgent | 否 | - | 自定义 User-Agent 字符串 |
| RandomizeUserAgent | 否 | False | 轮换常见 User-Agent 字符串 |
| IncludeTimingAttacks | 否 | False | 启用基于时间的漏洞检测 |
| IncludeJWTTests | 否 | False | 启用 JWT/OAuth2 安全测试 |
| IncludeWebSocketTests | 否 | False | 启用 WebSocket 端点发现 |
| IncludeWAFEvasion | 否 | False | 启用 WAF/IDS 绕过测试 |
| NoLogo | 否 | False | 禁止显示横幅 |
| QuietMode | 否 | False | 减少控制台输出(抑制信息消息) |
| EnablePasswordSpraying | 否 | False | 启用密码喷洒(需要明确确认) |
| **性能参数** | | | |
| ParallelExecution | 否 | False | 启用并行执行以加快扫描 |
| MaxThreads | 否 | 5 | 最大并发线程数(1-20) |
| **EPM 参数** | | | |
| EPMUrl | 否 | - | 用于 EPM 集成检查的 EPM 服务器 URL |
| **安全态势参数** | | | |
| IncludeSecretsHubChecks | 否 | False | 启用 Secrets Hub 云同步检查 |
| SecretsHubUrl | 否 | - | 用于集成检查的 Secrets Hub URL |
| IncludeRemoteAccessChecks | 否 | False | 启用远程访问/Alero 检查 |
| AleroUrl | 否 | - | 用于供应商访问检查的 Alero URL |
| IncludeK8sChecks | 否 | False | 启用 Kubernetes/容器秘密检查 |
| K8sNamespace | 否 | default | 用于秘密检查的 Kubernetes 命名空间 |
| ConjurApplianceUrl | 否 | - | 用于 K8s 集成的 Conjur 设备 URL |
| IncludeDevSecOpsChecks | 否 | False | 启用 DevSecOps 流水线安全检查 |
| IncludePrivilegeCloudChecks | 否 | False | 启用 Privilege Cloud/SaaS 特有检查 |
| IsPrivilegeCloud | 否 | False | 指示目标是 Privilege Cloud SaaS |
| PrivilegeCloudTenant | 否 | - | Privilege Cloud 租户标识符 |
| IncludeIdentityChecks | 否 | False | 启用 CyberArk Identity/Idaptive 检查 |
| IdentityTenantUrl | 否 | - | CyberArk Identity 租户 URL |
| IncludePluginChecks | 否 | False | 启用自定义插件安全检查 |
| IncludeBackupSecurityChecks | 否 | False | 启用备份安全检查 |
| BackupPath | 否 | - | 要分析的 Vault 备份文件路径 |
| IncludeHSMChecks | 否 | False | 启用 HSM 集成检查 |
| HSMProvider | 否 | - | HSM 提供商类型(Thales、nCipher、SafeNet、AWSCloudHSM、AzureHSM、其他) |
| IncludePTADeepDive | 否 | False | 启用高级 PTA 检测检查 |
| IncludeThirdPartyChecks | 否 | False | 启用 SIEM/ITSM/SOAR 集成检查 |
| ServiceNowUrl | 否 | - | 用于 ITSM 检查的 ServiceNow URL |
| SIEMUrl | 否 | - | 用于事件关联检查的 SIEM URL |
| IncludeOperationalChecks | 否 | False | 启用运维卫生指标 |
| IncludeAttackPathChecks | 否 | False | 启用攻击路径模拟检查 |
| IncludeSupplyChainChecks | 否 | False | 启用供应链完整性检查 |
| IncludeNetworkSegmentationChecks | 否 | False | 启用网络分段检查 |
| **其他参数** | | | |
| PortScanTimeout | 否 | 1000 | 端口扫描连接超时(毫秒) |
| VerboseOutput | 否 | False | 启用详细日志 |
## 输出
该脚本生成三种格式的全面报告,旨在支持编写详细的安全评估报告:
### 报告格式
#### 1. HTML 报告(交互式仪表板)
一份现代、交互式的 HTML 报告,包含:
- **目录**:快速导航到所有报告部分
- **执行摘要**:总体风险评级、合规百分比、关键指标
- **关键风险部分**:前 10 个严重/高风险发现及业务影响
- **CIS 基准合规矩阵**:逐项控制合规状态
- **详细发现表**:可展开的行,包含完整证据和修复步骤
- 点击任何发现可显示:证据、技术细节、风险描述、业务影响、CVSS 评分、修复步骤和参考
- **概念验证 (PoC)**:渗透测试报告的请求/响应证据(如有)
- **修复路线图**:按优先级排列的时间线(24小时/1周/30天/90天)
- **组件分析**:按 CyberArk 组件(Vault、CPM、PSM、PVWA、PTA)分组的发现
- **跳過的检查**:手动验证要求及后续指导
- **打印友好**:打印时自动展开所有发现
#### 2. CSV 报告(7 个独立文件)
生成多个 CSV 文件,面向不同的受众:
| 文件 | 用途 | 受众 |
|------|---------|----------|
| `Executive_Summary.csv` | 高级指标和风险概览 | 领导层、管理层 |
| `Full_Findings.csv` | 完整的发现,包含所有 20+ 个字段 | 安全分析师 |
| `Failed_Findings.csv` | 仅失败的检查,按严重性排序 | 修复团队 |
| `Remediation_Tracker.csv` | 可操作的跟踪器,包含分配对象、状态、到期日期 | IT 运维 |
| `Skipped_Checks.csv` | 需要手动验证的检查 | 审计员 |
| `CIS_Compliance_Matrix.csv` | 逐项控制合规状态 | 合规官员 |
| `Component_Summary.csv` | 按组件分组的发现 | 组件负责人 |
#### 3. JSON 报告(结构化数据)
全面的结构化数据,用于程序化分析:```json
{
"reportInfo": { "title", "generatedAt", "version" },
"auditMetadata": { "target", "auditDate", "auditorInfo" },
"executiveSummary": {
"overallRiskRating": "Fair",
"riskScore": 45,
"keyMetrics": { "totalChecks", "passed", "failed", "compliance%" },
"findingsBySeverity": { "critical", "high", "medium", "low" },
"keyRisks": [ /* top 10 findings */ ],
"immediatePriorities": [ /* critical recommendations */ ]
},
"complianceAnalysis": {
"overallCompliance": 78.5,
"cisControlsCompliance": { /* per-control matrix */ }
},
"componentAnalysis": { /* findings by component */ },
"categoryAnalysis": { /* findings by category */ },
"remediationRoadmap": {
"immediate": { "timeframe": "24-48 hours", "findings": [] },
"urgent": { "timeframe": "1 week", "findings": [] },
"standard": { "timeframe": "30 days", "findings": [] },
"routine": { "timeframe": "90 days", "findings": [] }
},
"detailedFindings": { "failed", "passed", "all" },
"skippedChecks": { "summary", "requiresFollowUp", "all" },
"appendix": { "glossary", "severityDefinitions", "riskScoreExplanation" }
}
每个发现现在都包含用于编写报告的全面信息:
发现按严重程度评分:
风险评级:
输出旨在帮助您撰写专业的安全评估报告:
⚠️ 警告:此工具执行主动安全测试,可能会:
-EnablePasswordSpraying 标志明确确认在运行此脚本之前,务必获得适当授权。
在红队操作中使用 -OPSECMode 以减少检测足迹。
错误:File cannot be loaded because running scripts is disabled on this system
解决方法:```powershell
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
Unblock-File -Path .\CyberArk-Security-Audit.ps1
#### PowerShell 版本错误
**错误**:`此脚本需要 PowerShell 7 或更高版本。`
**解决方案**:```powershell
# Check current version
$PSVersionTable.PSVersion
# Install PowerShell 7
winget install Microsoft.PowerShell
# Or download from: https://github.com/PowerShell/PowerShell/releases
错误: The request was aborted: Could not create SSL/TLS secure channel
解决方案:```powershell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13
#### 证书验证错误
**错误**:`The underlying connection was closed: Could not establish trust relationship`
**解决方案**:这通常表明 PVWA 存在证书问题(如自签名证书)。脚本会自动将此捕获为安全发现,并继续执行评估以提供完整的覆盖范围。脚本包含证书验证绕过以实现操作连续性:```powershell
# The script automatically bypasses certificate validation for assessment continuity
# while capturing certificate issues as findings
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
错误: Authentication failed: The remote server returned an error: (401) Unauthorized
解决方案:
-AuthType LDAP、-AuthType CyberArk等)$cred = Get-Credential $body = @{ username = $cred.UserName; password = $cred.GetNetworkCredential().Password } | ConvertTo-Json Invoke-RestMethod -Uri "https://pvwa.domain.com/PasswordVault/api/Auth/LDAP/Logon" -Method POST -Body $body -ContentType "application/json"
#### 端口扫描超时
**错误**:端口扫描耗时过长或超时
**解决方案**:```powershell
# Increase timeout (default is 1000ms)
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -PortScanTimeout 3000
# Or skip port scanning entirely
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -SkipPortScan
错误:无法写入报告文件
解决方案:```powershell
.\CyberArk-Security-Audit.ps1 -PVWA "https://pvwa.domain.com" -OutputPath "C:\Reports"
New-Item -ItemType Directory -Path "C:\Reports" -Force
### 获取帮助
如果遇到以上未涵盖的问题:
1. 使用详细输出运行:`-VerboseOutput`
2. 查看生成的 JSON 报告以获取详细的错误信息
3. 检查 Windows 事件日志以获取相关错误
4. 在 GitHub 上提交 issue,附上错误详情和运行环境信息
## 参考
### CyberArk 文档
- [CyberArk 安全加固指南](https://docs.cyberark.com/)
- [CyberArk REST API 文档](https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/Latest/en/Content/WebServices/Implementing%20Privileged%20Account%20Security%20Web%20Services%20.htm)
### CyberArk 开源安全工具
- [zBang](https://github.com/cyberark/zBang) - 特权账户威胁风险评估工具(影子管理员、Kerberos、SPN)
- [Conjur](https://github.com/cyberark/conjur) - 密钥管理平台
- [ACLight](https://github.com/cyberark/ACLight) - 影子管理员发现工具(zBang 的一部分)
- [Ansible 安全自动化集合](https://github.com/cyberark/ansible-security-automation-collection) - CyberArk Ansible 集成
## 许可。
本工具按“原样”提供,仅供安全评估用途。请负责任且合乎道德地使用。
| 最低 |
|---|
| 推荐 |
|---|
| PowerShell | 7.0 | 7.x(最新版) |
| .NET Framework | 4.5 | 4.8+ |
| 操作系统 | Windows 10/Server 2016 | Windows 11/Server 2022 |
| 内存 | 2 GB 可用 | 4 GB 可用 |
| 字段 | 描述 |
|---|
FindingID | 唯一标识符(例如 CA-20260116-A1B2C3D4) |
Category | 安全类别(例如安全配置、身份验证) |
CISControl | CIS 基准控制参考 |
AffectedComponent | CyberArk 组件(Vault、CPM、PSM、PVWA、PTA) |
Evidence | 支持发现的技术证据 |
TechnicalDetails | 详细技术描述 |
RiskDescription | 解释为何这是安全风险 |
BusinessImpact | 业务层面的影响解释 |
CVSSScore | 估算的 CVSS 分数范围 |
RemediationSteps | 逐步修复指导 |
ComplianceRefs | 合规框架参考 |
References | 文档链接 |
PoCRequest | HTTP 请求概念验证(可用时) |
PoCResponse | HTTP 响应概念验证(可用时) |