
Containerised differential lab and wire-level proof of concept for CVE-2026-119958, a Windows LDAP out-of-bounds write enabling unauthenticated remote code execution.
| CVE | CVE-2026-119958 |
| Component | Windows LDAP — Lightweight Directory Access Protocol (MSRC component tag Windows LDAP - Lightweight Directory Access Protocol) |
| Affected | Windows 10 1607 → Windows 11 26H2, Windows Server 2016 → 2025 (28 SKUs; see §6) |
| Fixed in | November 2026 security update — KB5131291, KB5131085, KB5131096, KB5131090, KB5131087, KB5132061, KB5132043, KB5131080, KB5131077, KB5132059 |
| CWE | CWE-787 Out-of-bounds Write |
| Impact | Remote code execution in the context of the LDAP service |
| Vector | Network, unauthenticated, no user interaction — crafted LDAP calls to a listening LDAP service |
| Trigger | The length octets of a length-prefixed field in an LDAP message |
Microsoft published the advisory on 2026-11-10 with the November 2026 security update. The flaw is an out-of-bounds write in the Windows LDAP component: an unauthenticated network attacker sends crafted LDAP calls to a listening LDAP service, and the service writes past the end of a fixed-capacity buffer. The advisory states that successful exploitation "could gain code execution through a specially crafted set of LDAP calls to execute arbitrary code within the context of the LDAP service". ZDI notes that the consequence is amplified by where the code lands — "it runs code in the LDAP service context, it could be quite destructive, especially on Domain Controllers."
Every domain controller exposes LDAP on TCP/389 (and TCP/636 for LDAPS) by design, and the service cannot be disabled without breaking domain operations. An attacker that reaches the LDAP port of a domain controller therefore lands in the trust boundary that every other domain resource relies on.
This repository contains a containerised laboratory that reproduces the defect end to end, a differential proof of concept, and the results of a sweep on the patched model.
The Windows LDAP component is closed-source Microsoft code. None of its code or binaries are redistributed here, and the advisory discloses no root cause, no function name, no buffer size and no payload. What is reproducible here is therefore:
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H),
the exploitation state Exploitation Less Likely, and the affected/fixed
version matrix — all taken verbatim from the MSRC advisory and the MSRC
CVRF feed for release 2026-Nov.Everything the laboratory asserts about the vendor product is sourced from the advisory. Everything it asserts about the model is labelled as such. The model is the only thing that runs in the lab, and it is deliberately built so that the vulnerable and the patched behaviour differ in the target component alone.
The model lives in lab/src/ and is selected with an environment variable:
| build | the target component | binaries |
|---|---|---|
LDAP_BUILD=vuln | copies the peer-supplied length without checking it against the capacity of the destination | ldapd-vuln, ldapc-vuln, harness-vuln |
LDAP_BUILD=fixed | validates the length and refuses the value | ldapd-fixed, ldapc-fixed, harness-fixed |
Each build exists twice, once with the sanitizers and once without
(LDAP_SANITIZER=1 selects the AddressSanitizer + UndefinedBehaviorSanitizer
build).
The difference between the two sides is one hunk in one function, and it is
reproduced verbatim in evidence/versions.txt:
--- a/ldapmodel.c
+++ b/ldapmodel.c
@@ -43,12 +43,19 @@
const uint8_t *src, size_t len)
{
/*
- * The copy size is the length the peer asked for. Nothing checks it
- * against the capacity of the destination buffer.
+ * The patched implementation validates the peer-supplied length
+ * against the capacity of the destination before copying.
*/
+ if (len > cap) {
+ if (!g_quiet)
+ fprintf(stderr,
+ "ldap_copy_octets: refusing %zu bytes for a %zu byte buffer\n",
+ len, cap);
+ return LDAP_PROTOCOL_ERROR;
+ }
+
memcpy(dst, src, len);
(void)c;
- (void)cap;
return LDAP_SUCCESS;
}
The patch itself is lab/fixes/ldap-fix-bounds-check.patch; the image build
applies it to produce the patched tree.
The target component is the routine that copies a decoded, length-prefixed
field into a fixed-capacity buffer. In the model that is
ldap_copy_octets() in lab/src/ldapmodel.c:
int ldap_copy_octets(struct ldap_conn *c, uint8_t *dst, size_t cap,
const uint8_t *src, size_t len)
{
/*
* The copy size is the length the peer asked for. Nothing checks it
* against the capacity of the destination buffer.
*/
memcpy(dst, src, len);
(void)c;
(void)cap;
return LDAP_SUCCESS;
}
The length is taken from the wire — it is the BER length octets of the
element that the peer sent — and it is used directly as the copy size. The
capacity of the destination is known to the caller (cap) and is not consulted.
A peer that announces a length larger than the capacity therefore writes past
the end of the destination.
The destination of the primary copy site is the value buffer of a decode slot,
and the dispatch pointer of the slot follows it in memory
(lab/src/ldapmodel.h):
struct op_slot {
uint8_t val[LDAP_CAP];
void (*fn)(struct op *op);
};
LDAP_CAP is 1024, the capacity of the modelled buffer. It is larger than
any length AD DS documents for the fields the model decodes — the AD DS
maximum-limits documentation caps the distinguished name of a simple bind at
255 characters — so a value of that size is one no peer has any business
sending. A value of 1032 bytes therefore does not stay inside val[]: it
overwrites fn, the pointer the service calls to dispatch the request it has
just decoded. The write is a write of attacker-chosen bytes at an
attacker-chosen offset, over a pointer the service then calls — the
out-of-bounds write and the code execution are the same event.
The other copy sites — the distinguished name of a search base, the name of a bind, a control value, an extended request value, the attribute values of a response — copy into dedicated fixed-capacity allocations and are the sites the sanitizer reports on directly.
evidence/check-vulnerable-asan-report.txt, from the vulnerable build:
==3==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x619000000488 ...
WRITE of size 2048 at 0x619000000488 thread T0
#0 ... in __interceptor_memcpy
#1 ... in ldap_copy_octets /build/src/ldapmodel.c:49
#2 ... in copy_filter_value /build/src/ldapmodel.c:204
#3 ... in parse_filter /build/src/ldapmodel.c:271
#4 ... in ldap_parse_search_request /build/src/ldapmodel.c:374
#5 ... in handle_connection /build/src/ldapd.c:216
The write is 2048 bytes into a 1024-byte value buffer: "0 bytes to the right of 1032-byte region" — the region is the decode slot, whose value buffer is followed by the dispatch pointer.
The LDAP service listens on TCP/389. The defect is in the decoding of the
requests, so it is reached before any authorization decision: the crafted
calls need no credentials and no user interaction, which is what the CVSS
vector (PR:N/UI:N) and the advisory's "unauthenticated attacker" state.