This repository demonstrates a tool that exploits two Windows AD CS defects to bypass the KB5014754 strong certificate binding patch and forge a certificate that allows a low-privileged user to obtain Domain Admin via PKINIT.

Stars

9

7-day growth

No data

Forks

1

Open issues

0

License

No data

Last updated

2026-07-27

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It shows a concrete, working bypass of a documented security patch (KB5014754) using chained vulnerabilities in certsrv.exe and certpdef.dll, which can compromise a fully patched Active Directory environment.

Who it is for

  • Active Directory security researchers
  • Red teamers and penetration testers
  • Enterprise security administrators
  • Microsoft patch validation engineers

Use cases

  • Demonstrating the impact of leftover ESC1 certificate templates in AD CS
  • Testing the effectiveness of KB5014754 and associated mitigations
  • Simulating a full-chain attack from low-privileged user to domain compromise
  • Validating the security posture of AD CS deployments

Strengths

  • Exploits real, reverse-engineered bugs in Windows binaries (certsrv.exe, certpdef.dll)
  • Includes independent verification script to confirm no tampering with the output
  • Fully automated (auto-signer, SID injection) with clear usage examples
  • Supported by detailed reverse-engineering notes and a recorded full-chain transcript

Considerations

  • Requires an ESC1-shaped template to exist (no default templates have the required shape)
  • Requires MS-ICPR (port 135) access to the CA
  • For authorized testing only; misuse is illegal and unethical

README quick start

cmc-addext

I use the CMC id-cmc-addExtensions control to inject arbitrary X.509 extensions into an AD CS certificate request. On an ESC1-shaped template, that lets a low-privileged domain user forge a certificate whose Subject Alternative Name and whose szOID_NTDS_CA_SECURITY_EXT SID both point at Administrator - and PKINIT to Domain Admin on a fully patched CA and DC with StrongCertificateBindingEnforcement = 2.

Full writeup, with the disassembly and the reasoning: https://0xmaz.me/posts/certsrv-id-cmc-addExtensions-KB5014754-bypass/

Reverse-engineering notes (functions, offsets, both binaries): REVERSING.md.

How it works

Two defects, chained.

certsrv.exe routes request extensions through a dispatcher that masks the caller flag with & 0xf0000 and recognises only two allowlists (0x50000 and 0x90000). The id-cmc-addExtensions handler calls it with 0x80002, and 0x80002 & 0xf0000 = 0x80000 - neither value - so no allowlist runs. Every extension I put in the CMC control reaches SetCertificateExtension, including the SAN and szOID_NTDS_CA_SECURITY_EXT. The signer only needs a certificate the CA itself issued (CryptMsgGetAndVerifySigner with CMSG_SIGNER_ONLY_FLAG checks the signature, not the chain), so --auto-signer enrolls a throwaway to sign with.

certpdef.dll is supposed to stamp the requester's real SID into that extension - the KB5014754 defence. On the enrollee-supplies-subject path it doesn't generate anything; it copies the SID out of the request. Since the first defect lets me put any SID in the request, I supply the Administrator's SID next to the Administrator UPN, and the KDC's strong binding check passes.

Requirements on the target

  • An ESC1-shaped template: ENROLLEE_SUPPLIES_SUBJECT, a clientAuth EKU, enroll rights for the low-privileged user, and no SUBJECT_ALT_REQUIRE_UPN. No default-published template has this shape - the built-ins carry REQUIRE_UPN/REQUIRE_DNS, which rebind the SAN and SID to the caller. The point is that KB5014754 was documented as making a leftover ESC1 template survivable; on this path it doesn't.
  • MS-ICPR (RPC, port 135) to the CA. CES is optional.
  • Any low-privileged domain account (to auto-enroll the throwaway signer).

Install

python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
# certipy-ad and impack

Description

A low-priv domain user forges an Administrator certificate through the CMC `id-cmc-addExtensions` control and PKINITs to Domain Admin

Related repositories

Similar projects matched by category, topics, and programming language.

lopopolo
Featured
lopopolo GitHub avatar

harness-engineering

Harness Engineering is a methodology for improving coding agent outputs by carefully crafting the environment around them—providing curated context, tools, and executable constraints that encode an organization’s nonfunctional requirements and cumulative lessons.

AI & Machine LearningAI Agents
2,390
slvDev
Featured
slvDev GitHub avatar

esp32-ai

A 28.9 million parameter language model runs on an $8 ESP32-S3 microcontroller entirely on-device, generating simple stories at about 9.5 tokens per second.

AI & Machine LearningLarge Language Models
1,960
littledivy
Featured
littledivy GitHub avatar

mimic

mimic captures traffic from any iOS or web app and automatically generates a Python client library that lets you call the app's API like a regular library.

AI & Machine Learning
1,482