CVE-2026-40377 — Microsoft Cryptographic Services Elevation of Privilege Vulnerability
Executive Summary
Heap-based buffer overflow in Windows Cryptographic Services allows an authorized attacker to elevate privileges locally.
Overview
CVSS Vector
CVSS:3.1/AV:L/AC:L/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 Version 1607 for 32-bit Systems | 5087537 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1607 for x64-based Systems | 5087537 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1809 for 32-bit Systems | 5087538 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 1809 for x64-based Systems | 5087538 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for 32-bit Systems | 5087544 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for ARM64-based Systems | 5087544 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 21H2 for x64-based Systems | 5087544 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for 32-bit Systems | 5094127 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for ARM64-based Systems | 5094127 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 10 Version 22H2 for x64-based Systems | 5094127 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 23H2 for ARM64-based Systems | 5087420 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 23H2 for x64-based Systems | 5093998 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 Version 24H2 for ARM64-based Systems 5089549 (Security Update) 5089466 (Security Hotpatch Update) Important Elevation of Privilege 5082063 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.26100.8457 10.0.26100.8390 Yes None Windows 11 Version 24H2 for x64-based Systems 5089549 (Security Update) 5089466 (Security Hotpatch Update) Important Elevation of Privilege 5082063 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.26100.8457 10.0.26100.8390 Yes None Windows 11 Version 25H2 for ARM64-based Systems 5089549 (Security Update) 5089466 (Security Hotpatch Update) Important Elevation of Privilege 5083769 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.26200.8457 10.0.26200.8390 Yes None Windows 11 Version 25H2 for x64-based Systems 5089549 (Security Update) 5089466 (Security Hotpatch Update) Important Elevation of Privilege 5083769 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.26200.8457 10.0.26200.8390 Yes None Windows 11 Version 26H1 for ARM64-based Systems | 5089548 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows 11 version 26H1 for x64-based Systems | 5089548 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2012 | 5087470 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2012 (Server Core installation) | 5087470 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2012 R2 | 5087471 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2012 R2 (Server Core installation) | 5087471 (Monthly Rollup) |
Important | Elevation of Privilege | Yes |
| Windows Server 2016 | 5087537 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2016 (Server Core installation) | 5087537 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2019 | 5087538 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2019 (Server Core installation) | 5087538 (Security Update) |
Important | Elevation of Privilege | Yes |
| Windows Server 2022 5087545 (Security Update) 5087424 (Security Hotpatch Update) Important Elevation of Privilege 5082142 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.20348.5139 10.0.20348.5074 Yes None Windows Server 2022 (Server Core installation) 5087545 (Security Update) 5087424 (Security Hotpatch Update) Important Elevation of Privilege 5082142 Base: 7.8 Temporal: 6.8 Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C 10.0.20348.5139 10.0.20348.5074 Yes None Windows Server 2022, 23H2 Edition (Server Core installation) | 5087541 (Security Update) |
Important | Elevation of Privilege | Yes |
Patches
| Article | Type | Restart |
|---|---|---|
5087537 |
Security Update | Yes |
5087538 |
Security Update | Yes |
5087544 |
Security Update | Yes |
5094127 |
Security Update | Yes |
5087420 |
Security Update | Yes |
5093998 |
Security Update | Yes |
5089548 |
Security Update | Yes |
5087470 |
Monthly Rollup | Yes |
5087471 |
Monthly Rollup | Yes |
5087541 |
Security Update | Yes |
Patch Diff
Heap buffer overflow (CWE-122) via an alignment size-budget mismatch in cryptxml.dll I_XmlUnmarshallKeyInfo, local EoP. The function converts a <KeyInfo> element to a CryptoAPI structure with a two-pass method (pass 1 computes total size + single AiAlloc/HeapAlloc; pass 2 copies). For the ECDSA KeyValue path (subtype 5, uncompressed EC point 0x04||X||Y, coordinate length Size=(point_len-1)/2), pass 1 budgeted only 2*Size for the two coordinates, but pass 2 advanced the write pointer by ALIGN8(Size)=(Size+7)&~7 per coordinate, consuming 2*ALIGN8(Size). When Size%8!=0 the allocation is smaller than actual use by 2*(8-(Size%8)) bytes: P-256(32)/P-384(48) are 8-aligned and safe, but P-521(Size=66) overflows by 12 bytes. A second bug cached the last ECDSA entry's Size/pointer, so multiple ECDSA entries of differing sizes were copied with wrong values. Reachable via CryptXmlOpenToDecode on externally supplied XML signatures. Diff of cryptxml.dll 10.0.26100.8115 -> .8457 (May 12 2026, KB5089549) confirms the fix: gated behind CFR flag Feature_1881917752, pass 1's dwBytes size budget now applies ((v+7)&0xfffffffffffffff8) ALIGN8 to the ECDSA coordinates (and each field), matching pass 2; pass 2 re-reads each entry's size/pointer from the source; subtype->type mapping factored into _GetKeyValueType and cleanup loop restructured. Applies to both the macro-prefix loop and the global-list loop. Note: our diff shows Feature_1881917752 (build/arch); the ALIGN8 budget fix is as described.
| Function | Address | Change | Note |
|---|---|---|---|
I_XmlUnmarshallKeyInfo |
code change |
code (ALIGN8 size budget + per-entry re-read, CFR-gated) | Pre: pass-1 size budget counted 2*Size for ECDSA X||Y while pass-2 copy advanced by 2*ALIGN8(Size) -> under-allocation, P-521(66) overflows 12 bytes; last-entry Size/ptr cached and reused for all entries. Post (Feature_1881917752): dwBytes accumulates ((val+7)&~7) ALIGN8 per field incl. ((coord+1)*2+7)&~7 for the coordinate pair; pass 2 re-reads per-entry size/pointer; _GetKeyValueType helper; restructured cleanup. |
Feature_1881917752 |
gate |
added (CFR gate) | CFR flag gating the aligned size budget and per-entry re-read; original under-counting path still ships when disabled. |
Root Cause Analysis
CVE-2026-40377 — Microsoft Cryptographic Services cryptxml.dll ECDSA Size-Budget Mismatch in I_XmlUnmarshallKeyInfo → Heap Overflow
Summary
| Product | Windows — cryptxml.dll (Microsoft Cryptographic Services; XML-DSig KeyInfo unmarshal) |
| CVE ID | CVE-2026-40377 |
| Impact | Elevation of Privilege |
| MSRC severity | Important |
| CVSS | 7.8 / 6.8 — CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H/E:U/RL:O/RC:C |
| CWE | CWE-122: Heap-based Buffer Overflow (alignment/size-budget mismatch) |
| Delivery | Local — a crafted XML signature document processed via CryptXmlOpenToDecode |
| KB / Fixed build | KB5089549 — cryptxml.dll 10.0.26100.8457 (Win11 24H2 x64) |
| Patch Date | May 12, 2026 (2026-May) |
| Pre-patch binary | cryptxml.dll 10.0.26100.8115 — SHA256 3ab1410c0a9f419821978db0a2fc5626e9d3d794f4fe7cb82c24709e3334806f |
| Post-patch binary | cryptxml.dll 10.0.26100.8457 — SHA256 0cb1f25a5ab9a542a182654340895b65c00777c11e5c29e6d12526e13b7d9617 |
| Feature flag | Feature_1881917752 — the fix is CFR-gated |
| Exploitability | Exploitation Less Likely; not publicly disclosed; not exploited (per MSRC) |
Product Description
cryptxml.dll implements Microsoft’s XML digital-signature (XML-DSig) support.
I_XmlUnmarshallKeyInfo converts the <KeyInfo> element from the WS internal
structure into a CryptoAPI structure using a two-pass approach: pass 1 walks
all key entries to compute the total buffer size and does a single HeapAlloc /
AiAlloc; pass 2 walks the entries again and copies the data into that buffer.
It is reachable via CryptXmlOpenToDecode, which processes externally supplied
XML signature documents.
Vulnerability Summary
The flaw is in the ECDSA KeyValue path (subtype 5). For the uncompressed EC
point 0x04 || X || Y, each coordinate length is Size = (point_length - 1) / 2.
- Pass 1 (size budget): counted only
2 * Sizefor the two coordinates. - Pass 2 (copy): after copying each coordinate it advanced the write pointer by
ALIGN8(Size) = (Size + 7) & ~7, i.e. it actually consumes2 * ALIGN8(Size).
So pass 1 under-counts whenever Size is not a multiple of 8: actual usage exceeds
the budget by 2 * (8 - (Size % 8)) bytes. P-256 (Size=32) and P-384 (Size=48)
are 8-aligned and unaffected, but P-521 (Size=66, 66 mod 8 = 2) consumes
12 bytes more than allocated → a 12-byte heap overflow per entry.
A second bug: the pass-1-cached Size and data pointer were overwritten by the
last ECDSA entry, so with multiple ECDSA KeyValue entries of different
coordinate sizes, pass 2 copied earlier entries using the last entry’s values —
additional corruption. The same defect exists in two loops: the macro-prefix
array loop and the global linked-list (::P) loop.
Prerequisites and Constraints
- Local, low-privileged (
PR:L,AV:L,AC:L): supply a crafted XML signature document to a component that callsCryptXmlOpenToDecode. - Trigger: an ECDSA
KeyValuewith a non-8-aligned coordinate size — notably P-521 — and/or multiple ECDSA entries of differing sizes. - Result: heap/pool overflow of the under-sized
AiAllocbuffer with attacker-controlled key bytes.
Vulnerability Details
Root Cause
Pass 1’s size budget did not apply the 8-byte alignment that pass 2’s copy uses,
so the allocation was smaller than the bytes actually written; and per-entry
Size/pointer state was clobbered by the last entry, mis-sizing/mis-copying
earlier entries.
The patch (confirmed — diff, .8115 → .8457)
Gated behind Feature_1881917752, pass 1’s size computation now applies
ALIGN8 to the ECDSA coordinates, matching pass 2. Our diff shows the size
accumulator (dwBytes) built from ((value + 7) & 0xfffffffffffffff8) terms per
field (and ((coord_len + 1) * 2 + 7) & ~7 for the coordinate pair):
// I_XmlUnmarshallKeyInfo (10.0.26100.8457) — PATCHED, feature-enabled branch (from our diff)
dwBytes = dwBytes
+ (((coord_len + 1) * 2 + 7) & 0xfffffffffffffff8) // *** 2*ALIGN8 for X||Y ***
+ ((*(uint*)(entry+0x70) + 7) & ~7) + ((*(uint*)(entry+0x60) + 7) & ~7)
+ ... ; // each field ALIGN8'd
v23 = AiAlloc(dwBytes, ...); // now sized to actual consumption
Additionally, pass 2 was changed to re-read each ECDSA entry’s size and data
pointer from the source structure (instead of the stale pass-1 cache), fixing
the multi-entry corruption; the subtype→type mapping was factored into a
_GetKeyValueType helper and the cleanup loop restructured for safer error
handling. Both the macro-prefix loop and the global-list loop are covered.
Patch Completeness Assessment
CFR-gated behind Feature_1881917752. The aligned size budget and per-entry
re-read run only when the flag is enabled; the original under-counting path still
ships when disabled. Verify Feature_1881917752 is enabled to confirm the fix is
live.
Detection Guidance
Behavioural. Processing of XML signature documents with ECDSA KeyValue
elements using P-521 (or other non-8-aligned coordinate sizes), or multiple ECDSA
KeyValue entries; heap-corruption crashes in cryptxml!I_XmlUnmarshallKeyInfo
after CryptXmlOpenToDecode on unpatched/flag-disabled builds.
Config. The fix is CFR-gated — confirm Feature_1881917752 is enabled.
References
- MSRC advisory — CVE-2026-40377 (Microsoft Cryptographic Services Elevation of Privilege), released 2026-05-12, KB5089549.
- Full binary diff:
/data/patch_diffs/cryptxml_dll-cve-2026-40377-ghidriff.md
Attack Path
A crafted ECDSA P-521 KeyValue makes the size budget under-count vs the aligned copy, overflowing the heap allocation
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.