一个用于 Windows 本地权限提升检查的信标对象文件(BOF)集合。

PrivKit 是一款开源工具,可帮助红队成员和渗透测试人员使用 Cobalt Strike 信标对象文件(BOF)快速识别常见的 Windows 本地权限提升向量。
有关命令行用法和示例,请参阅 使用 部分。
如果您发现任何错误,欢迎随时报告它们。您的反馈对改进本项目质量至关重要!
本项目的作者和贡献者不对任何非法使用该工具的行为负责。该工具仅用于教育和授权的安全测试目的。用户有责任确保合法使用。
特别感谢我的朋友 @nickvourd 的所有贡献。
特别感谢 TrustedSec 团队出色的 CS-Situational-Awareness-BOF 项目,它为本工具提供了灵感。
衷心感谢 Cobalt Strike 团队提供的全面 BOF 文档和示例。
PrivKit 由 @merterpreter 倾心制作 ❤️。
PrivKit 提供了一套全面的权限提升检查,包括:
PrivKit 使用 C 语言编写,编译为信标对象文件,兼容 Windows 目标上的 Cobalt Strike 4.x。
⚠️ 请确保您的系统已安装 MinGW-w64。
ℹ️ 对于 Linux 平台(Ubuntu/Debian),安装以下软件包:
sudo apt update && sudo apt install mingw-w64 -y
ℹ️ 对于 macOS 平台,安装以下软件包:
brew install mingw-w64
git clone https://github.com/mertdas/PrivKit.git
cd PrivKit
make_all.sh 脚本编译所有 BOF(x64 和 x86 架构):./make_all.sh
Cobalt Strike -> Script Manager -> Load -> PrivCheck.cna
beacon> help
一次性执行所有权限提升检查:
beacon> PrivCheck
根据需要运行特定检查:
beacon> AlwaysInstallElevatedCheck
beacon> AutologonCheck
beacon> CredentialManagerCheck
beacon> HijackablePathCheck
beacon> ModifiableAutorunCheck
beacon> ModifiableSVCCheck
beacon> TokenPrivilegesCheck
beacon> UnquotedSVCPathCheck
beacon> PowerShellHistoryCheck
beacon> UACStatusCheck
beacon> AlwaysInstallElevatedCheck
[*] BOF by @merterpreter && @nickvourd
[*] Checking AlwaysInstallElevated privilege escalation vulnerability...
=== AlwaysInstallElevated Check ===
[*] HKCU\...\Installer\AlwaysInstallElevated = 1
[*] HKLM\...\Installer\AlwaysInstallElevated = 1
[+] VULNERABLE: AlwaysInstallElevated is set in both HKCU and HKLM
beacon> UACStatusCheck
[*] BOF by @merterpreter && @nickvourd
[*] Checking UAC status, integrity level, and admin membership...
=== UAC Status Check ===
[11/27 15:08:08] [+] received output:
[*] UAC Enabled (EnableLUA): Yes
[11/27 15:08:08] [+] received output:
[*] ConsentPromptBehaviorAdmin: 5
[11/27 15:08:08] [+] received output:
(Prompt for consent for non-Windows binaries)
[11/27 15:08:08] [+] received output:
[*] PromptOnSecureDesktop: Yes
[11/27 15:08:08] [+] received output:
[11/27 15:08:08] [+] received output:
[*] Integrity Level:
[11/27 15:08:08] [+] received output:
Medium
[11/27 15:08:08] [+] received output:
[*] Local Admin Group Member: Yes
[11/27 15:08:08] [+] received output:
[*] Summary:
[11/27 15:08:08] [+] received output:
[+] User is local admin but NOT elevated (UAC filtered token)
[11/27 15:08:08] [+] received output:
[+] UAC bypass may be possible
| 检查项 | 描述 |
|---|
| AlwaysInstallElevatedCheck | 检查 HKCU 和 HKLM 中 AlwaysInstallElevated 配置错误 |
| AutologonCheck | 枚举 Winlogon 注册表中存储的自动登录凭据 |
| CredentialManagerCheck | 从 Windows 凭据管理器中转储凭据 |
| HijackablePathCheck | 识别系统 PATH 中的可写目录 |
| ModifiableAutorunCheck | 查找 Run/RunOnce 键中可写的自动运行可执行文件 |
| ModifiableSVCCheck | 查找具有可修改权限(DACL)的服务 |
| TokenPrivilegesCheck | 枚举当前进程令牌的特权 |
| UnquotedSVCPathCheck | 检测包含空格且未加引号的服务路径 |
| PowerShellHistoryCheck | 检查 PowerShell PSReadLine 历史记录文件 |
| UACStatusCheck | 检查 UAC 状态、完整性级别和本地管理员组成员身份 |