CVE-2023-28229 — Windows CNG Key Isolation Service Elevation of Privilege Vulnerability
Executive Summary
None
Overview
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C
EPSS Score
Affected Products
| Product | KB Article | Severity | Impact | Restart Required |
|---|---|---|---|---|
| Windows 10 for 32-bit Systems | 5025234 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 for x64-based Systems | 5025234 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1607 for 32-bit Systems | 5025228 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1607 for x64-based Systems | 5025228 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1809 for 32-bit Systems | 5025229 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1809 for ARM64-based Systems | 5025229 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1809 for x64-based Systems | 5025229 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 20H2 for 32-bit Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 20H2 for ARM64-based Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for 32-bit Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for ARM64-based Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for x64-based Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for 32-bit Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for ARM64-based Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for x64-based Systems | 5025221 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 version 21H2 for ARM64-based Systems | 5025224 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 version 21H2 for x64-based Systems | 5025224 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 22H2 for ARM64-based Systems | 5025239 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 22H2 for x64-based Systems | 5025239 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2008 for 32-bit Systems Service Pack 2 5025271 (Monthly Rollup) 5025273 (Security Only) Important Elevation of Privilege 5023755 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.0.6003.22015 Yes 5025271 5025273 Windows Server 2008 for 32-bit Systems Service Pack 2 (Server Core installation) 5025271 (Monthly Rollup) 5025273 (Security Only) Important Elevation of Privilege 5023755 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.0.6003.22015 Yes 5025271 5025273 Windows Server 2008 for x64-based Systems Service Pack 2 5025271 (Monthly Rollup) 5025273 (Security Only) Important Elevation of Privilege 5023755 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.0.6003.22015 Yes 5025271 5025273 Windows Server 2008 for x64-based Systems Service Pack 2 (Server Core installation) 5025271 (Monthly Rollup) 5025273 (Security Only) Important Elevation of Privilege 5023755 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.0.6003.22015 Yes 5025271 5025273 Windows Server 2008 R2 for x64-based Systems Service Pack 1 5025279 (Monthly Rollup) 5025277 (Security Only) Important Elevation of Privilege 5023769 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.1.7601.26466 Yes 5025279 5025277 Windows Server 2008 R2 for x64-based Systems Service Pack 1 (Server Core installation) 5025279 (Monthly Rollup) 5025277 (Security Only) Important Elevation of Privilege 5023769 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.1.7601.26466 Yes 5025279 5025277 Windows Server 2012 5025287 (Monthly Rollup) 5025272 (Security Only) Important Elevation of Privilege 5023769 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.2.9200.24216 Yes None Windows Server 2012 (Server Core installation) 5025287 (Monthly Rollup) 5025272 (Security Only) Important Elevation of Privilege 5023769 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.2.9200.24216 Yes None Windows Server 2012 R2 5025285 (Monthly Rollup) 5025288 (Security Only) Important Elevation of Privilege 5023765 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.3.9600.20919 Yes None Windows Server 2012 R2 (Server Core installation) 5025285 (Monthly Rollup) 5025288 (Security Only) Important Elevation of Privilege 5023765 Base: 7.0 Temporal: 6.1 Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 6.3.9600.20919 Yes None Windows Server 2016 | 5025228 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2016 (Server Core installation) | 5025228 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2019 | 5025229 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2019 (Server Core installation) | 5025229 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2022 | 5025230 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2022 (Server Core installation) | 5025230 (Security Update) |
Important | Elevation of Privilege | Yes |
Patches
| Article | Type | Restart |
|---|---|---|
5025234 |
Security Update | Yes |
5025228 |
Security Update | Yes |
5025229 |
Security Update | Yes |
5025221 |
Security Update | Yes |
5025224 |
Security Update | Yes |
5025239 |
Security Update | Yes |
5025230 |
Security Update | Yes |
Patch Diff
Patch diff 10.0.22621.819 -> 10.0.22621.1555
| Function | Address | Change | Note |
|---|---|---|---|
__GSHandlerCheck |
1800050c8 -> 180004ed8 |
refcount, address | similarity 1.0 |
SrvAddKeyToList |
18000cdd4 -> 180001a0c |
code, length, sig, address | similarity 0.34 |
_guard_xfg_dispatch_icall_nop |
1800051a0 -> 180004fb0 |
refcount, address, calling | similarity 0.89 |
SrvRundownProviderList |
18000d910 -> 18000ce20 |
length, address, called | similarity 0.75 |
SrvCryptImportKey |
180002200 -> 180002630 |
code, refcount, length, sig, address, called | similarity 0.06 |
SrvDereferenceProvider |
18000d044 -> 18000c618 |
length, address | similarity 0.62 |
SrvCryptCreatePersistedKey |
180008000 -> 180007870 |
code, length, address, called | similarity 0.41 |
SrvCryptRundownContext |
180002d30 -> 180003370 |
length, address, called | similarity 0.82 |
SrvCryptSecretAgreement |
1800098f0 -> 180009130 |
code, length, sig, address, called | similarity 0.22 |
SrvRemoveKeyFromList |
18000d51c -> 180001aac |
code, length, sig, address | similarity 0.44 |
SrvDereferenceKey |
18000cff8 -> 18000c5c8 |
length, address | similarity 0.67 |
NormalizeNteStatus |
18000e7b4 -> 18000dc74 |
refcount, address | similarity 1.0 |
SrvCryptGetKeyProperty |
1800035f0 -> 180003d60 |
length, address, called | similarity 0.48 |
SrvRundownKeyList |
18000d6c8 -> 18000cbd4 |
length, address, called | similarity 0.75 |
SrvCryptExportKey |
180001df0 -> 180002090 |
length, address, called | similarity 0.97 |
SrvLookupAndReferenceProvider |
18000d168 -> 18000c744 |
length, address | similarity 0.97 |
SrvCryptOpenStorageProvider |
180001900 -> 180001ba0 |
code, length, address | similarity 0.59 |
SrvFreeKey |
18000a314 -> 1800018f0 |
code, length, address, calling, called | similarity 0.68 |
SrvLookupAndReferenceKey |
18000d0b8 -> 18000c694 |
length, address | similarity 0.97 |
SrvFreeProvider |
18000a3cc -> 18000197c |
code, length, address, called | similarity 0.79 |
SrvRundownSecretList |
18000daec -> 18000d000 |
length, address, called | similarity 0.86 |
__security_check_cookie |
180003fa0 -> 180004710 |
refcount, address, calling | similarity 1.0 |
SrvRemoveProviderFromList |
18000d588 -> 180001b20 |
code, length, sig, address | similarity 0.44 |
API-MS-WIN-CORE-LIBRARYLOADER-L1-2-0.DLL::GetProcAddress |
EXTERNAL:0000003d -> EXTERNAL:0000003e |
refcount, address, calling | similarity 1.0 |
SrvCryptFreeProvider |
180001fd0 -> 180002280 |
code, refcount, length, sig, address, called | similarity 0.1 |
s_SrvRpcCryptEncrypt |
18000ba50 -> 18000b0b0 |
code, length, sig, address, called | similarity 0.48 |
SrvAddMemoryBufferToList |
18000ce64 -> 18000c414 |
length, sig, address | similarity 0.43 |
NTDLL.DLL::RtlFreeHeap |
EXTERNAL:00000012 |
refcount, calling | similarity 1.0 |
SrvDereferenceSecret |
18000d06c -> 18000c644 |
length, address | similarity 0.67 |
s_SrvRpcCryptDecrypt |
18000b630 -> 18000acb0 |
code, length, sig, address, called | similarity 0.48 |
SrvLookupAndReferenceSecret |
18000d218 -> 18000c7f4 |
length, address | similarity 0.97 |
SrvCryptOpenKey |
180002f70 -> 1800035b0 |
code, refcount, length, address, called | similarity 0.24 |
SrvFreeSecret |
18000a488 -> 180009b34 |
code, length, address, called | similarity 0.68 |
SrvAddSecretToList |
18000cf64 -> 18000c524 |
code, length, sig, address | similarity 0.34 |
SrvRemoveSecretFromList |
18000d658 -> 18000cb60 |
code, length, sig, address | similarity 0.44 |
SrvCryptEnumKeys |
180008b60 -> 1800083b0 |
code, length, sig, address, called | similarity 0.33 |
SrvCryptLocalFree |
180001010 |
refcount, length, calling, called | similarity 0.5 |
SrvCryptFreeKey |
180002470 -> 1800029e0 |
code, refcount, length, sig, address, called | similarity 0.21 |
SrvCreateContext |
180002b40 -> 180003180 |
length, address, called | similarity 1.0 |
WPP_SF_qi |
18000dbac -> 180004d04 |
code, name, fullname, length, sig, address | similarity 0.78 |
Root Cause Analysis
RCA — CVE-2023-28229 (keyiso.dll CNG Key Isolation UAF race)
- Binary:
keyiso.dll(CNG Key Isolation service, hosted in lsass) - Patch: KB5025239 (April 2023),
10.0.22621.819→10.0.22621.1555(Win11 22H2) - Class: CWE-416 use-after-free (race; 6 objects, same root cause) | Impact: EoP / sandbox escape | ITW: no (MS: Exploitation Less Likely — but a full exploit was written)
- Diff:
ghidriff/CVE-2023-28229/output/keyiso-10.0.22621.819.dll-keyiso-10.0.22621.1555.dll.ghidriff.md
Component
CNG Key Isolation is an RPC server inside lsass that brokers private-key
operations. Critically, it is reachable from AppContainer IL (browser
renderer sandboxes). Objects: Context (global SrvCryptContextList) →
Provider / Key / Secret / MemoryBuffer. Provider/Key/Secret share a
layout: magic at +0x0 (0x44444446/47/49), refcount at +0x8, predictable index
(“handle”) at +0x30 (per-context counter at +0xA0, increments per allocation).
Root cause
Refcount lifetime race between allocation and free — shown for the Key object; the other five object families share the pattern:
// SrvCryptCreatePersistedKey:
keyobject->refcount = 1; // [a] set to 1 (NO LOCK held)
SrvAddKeyToList(ctx, keyobject); // [b] bumps refcount
// SrvCryptFreeKey:
if (InterlockedExchangeAdd(&obj->refcount, -1) == 1) { // [c]
SrvFreeKey(obj); // [d] frees
}
if (InterlockedExchangeAdd(&obj->refcount, -1) == 1) { // [e] use after free
obj->vtable->fn(obj->vtable->arg, obj->field); // [f] call thru +0x20 vftable (+0x80 fn, +0x118 arg)
}
Between [a] and [b] there is no lock: a racing free drops the count to 1, the
object is freed at [d], yet execution continues and at [f] calls through a
pointer stored at offset 0x20 of the freed buffer. Reclaiming the buffer
(Use Context property object is ideal: attacker-controlled size + content)
yields a controlled indirect call. Handles are predictable (sequential
index), so the attacker can call the free interface with the exact handle of
the just-allocated object.
Patch
The free path is wrapped in the context critical section and refcounting moved
to 64-bit interlocked ops, closing the [a]→[b] window. Confirmed in the
ghidriff diff: SrvCryptFreeKey only 46% match (heavy rewrite),
SrvFreeKey 87%.
Exploitation notes (for detection content)
- Chained with CVE-2023-36906 (“Use Context” provider-property OOB read) to leak a provider object address from an adjacent memory-buffer allocation.
- lsass has XFG → no ROP; the controlled call is pointed at
LoadLibraryWwith a controlled DLL path → code execution in lsass → AppContainer escape. - Trigger: three racing threads — allocate key / free key / spray property.
Reaching the bug
Key isolation RPC interfaces (s_SrvRpcCryptCreatePersistedKey,
s_SrvRpcCryptFreeKey, property set/get) from an AppContainer or Medium IL
process — no IOCTL, no admin; RPC over the ncrypt isolation endpoint in lsass.
Detection notes (blue team)
- Any non-lsass-typical process making high-frequency paired create/free key-isolation RPC calls from AppContainer IL.
- Suspicious DLL loads by lsass.exe (the LoadLibraryW endgame) — high-value Sigma/Sysmon signal (ImageLoad from non-system path).
- PoC:
static/data/patch_diffs/poc/poc_cve_2023_28229.c - Sibling entry:
kb/CVE-2023-36906.md(info-leak half of the chain; its fix location on 22H2 is still open — see that file).
Attack Path
Refcount lifetime race in CNG Key Isolation - the object is published before its reference is stable, and freed twice through the same decrement path
Derived from the patch delta: the checks added by the vendor identify which fields crossed a trust boundary unvalidated. Reachability and privilege are taken from the call chain in the RCA report.
Exploits & PoC
2 public PoCsUnverified third-party code
Public proof-of-concept repositories aggregated from PoC-in-GitHub. They are not reviewed and may be incomplete, non-functional, or malicious — inspect the code before running anything.
| Repository | Stars | Published | Description |
|---|---|---|---|
| Y3A/CVE-2023-28229 | 135 | 2023-09-04 | |
| byt3n33dl3/CrackKeyIso | 5 | 2024-03-27 | it's a CVE-2023-28229 (Patched), but feel free to use it for check any outdated software or reseach |
Detection Rules
Acknowledgments
k0shl of Kunlun Lab