# Hunt Ad Adcs

> ADCS exploitation expert of the AD split: certificate-based privilege

- Skill: `encod3d-sec/hunt-ad-adcs` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx get-skill add encod3d-sec/hunt-ad-adcs`
- Raw SKILL.md: https://api.skillmd.com/api/skills/encod3d-sec/hunt-ad-adcs/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: Encod3d-Sec (https://skillmd.com/u/encod3d-sec)
- Updated: 2026-11-16
- Page: https://skillmd.com/skills/encod3d-sec/hunt-ad-adcs

---


# Hunt: AD - ADCS expert (microskill)

ADCS exploitation expert of the AD split: certificate-based privilege
escalation end-to-end. The mapper (hunt-ad) owns enumeration waves,
user lists, and dispatch; this skill owns everything certificate.

Wiki mass: 16 ESC pages + golden-certificate under
wiki/techniques/active-directory/ - this skill is the execution shell
over that mass.

Shared bypass arsenal (blocked implies research, but walk this first): `skills/exploit/hunt/hunt-ad-adcs/references/bypass-arsenal.md` - NEW 2025-2026 ESC15/ESC16 classes + the trust-chain bypasses for a hardened CA (Entra External IdP chain, Golden SAML).

## Wiki

Hub: [[active-directory-moc]] - Primary page: [[adcs]] - per-ESC
pages: active-directory-certificate-esc1 .. esc16 (each page carries
its own conditions + exact certipy invocation)
Anchors: [[active-directory-golden-certificate]], [[kerberos-attacks]]
**REFS:** [[adcs]], ESC1-16 pages

qmd on hint only: "ADCS ESC certificate template misconfiguration
certipy" - per-ESC pages first.

## Paths (binding - shared with the mapper run)

    # seat side (wsl):
    ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
    RUN=$ENG_DIR/hunt/ad/<domain>          # SHARED with hunt-ad
    # VM side:
    ENG_DIR=/mnt/VMshare/<eng>/<eng>
    RUN=$ENG_DIR/hunt/ad/<domain>

Experts write probes/ad-adcs*.jsonl into the mapper's $RUN tree
(shared-run precedent). Cert/key material (.pem/.pfx/.ccache) lives
ONLY under $RUN/probes/raw/ (leak hygiene; never candidates files).

## Transport

Every VM-native command block ships through ONE documented transport:

    cd /mnt/c/Users/Lenovo/Documents/ObisidianVaults/ZTorch/ZTorch && bash scripts/vm-ssh.sh '<command>'

- vm-ssh lands as user tz (NOT root); one argument per call; quotes
  ship as base64 (`echo <b64> | base64 -d | bash`).
- Non-login shells do NOT source profile.d: HTTP fetches via
  /opt/scope-shim/bin/{curl,httpx}; certipy speaks LDAP/HTTPS to the
  CA directly.
- Out-of-scope dies rc 126 (never work around); UNKNOWN gets an
  ADVISORY - not approval; self-deny per scope.md.
- certipy req can hang on NETBIOS resolution: ALWAYS pass -dc-ip AND
  -target-ip <dc>. Long sweeps run detached (vm-bg.sh).

## Entry gate

All four must pass; each is falsifiable:

1. Active engagement exists; domain/DC on targets/<eng>/scope.md.
   Scope-guard is the deny.
2. hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
3. Mapper verified: $RUN/raw/domain-map.md exists AND a usable
   principal exists (users.md row or loot.md cred) - ADCS needs SOME
   authenticated or anon bind - AND the AD-HUNT-DONE pointer
   ($ENG_DIR/hunt-ad-<domain>.md) names adcs in next=. Missing =
   dispatch hunt-ad first.
4. Toolchain preflight (fails LOUD):

       for t in /usr/bin/jq /usr/bin/python3; do
         [ -x "$t" ] || { echo "MISSING TOOL: $t"; exit 1; }
       done
       command -v certipy >/dev/null || pip3 install --user --break-system-packages -q certipy-ad \
         || echo "N/A: certipy absent on VM (install failed)"  # manual LDAP template reads remain

## Checklist (mandatory)

Copy checklist.md (this skill's dir) to
`$ENG_DIR/hunt/ad/<domain>/ad-adcs-checklist.md` at run start.
Unchecked at stop = UNCHECKED lane, re-run from the first unchecked
step. SKILL.md and the checklist header agree byte-for-byte on the
copy target.

## Nudge

Review-skill re-injection text (pinned; NOTE: completion-gate emits
its own generic nudge - both mean: resume at the first unchecked box):

    Your work was just reviewed by the review skill and it was found
    that you either missed a step of analysis, or didn't generate an
    artifact of sufficient proof. Look at the markdown based checklist
    and the output for each step, find what you missed, and complete
    that step.

## Confirmation gate

**NOT confirmation:** certipy find listing a vulnerable template you
never enrolled against; a "vulnerable" flag whose ESC page conditions
do not hold on this CA; a cert issued but never used to authenticate.

**IS confirmation:** a certificate obtained via the ESC exploited AND
used to authenticate as the target (certipy auth returns the target's
NT hash / a usable TGT; or LDAPS/Kerberos session as the target
exercised) - reproduced from your written steps.

## Methodology

The 16 ESC pages each carry exact conditions and invocations - this
shell sequences them. Rank: ESC1 (misconfigured SAN - the classic),
ESC4 (template ACL), ESC8 (web enroll + relay) are the modern
high-yield trio; ESC9-16 are certificate-mapping variants gated on
UPN/SAN/altSecurityIdentities conditions - CHECK THE PAGE before
firing.

### Step 1 - Vulnerable-template sweep

    certipy find -u <user>@<domain> -p <pass> -dc-ip <dc> \
      -vulnerable -stdout [-ldap-scheme ldap]

Runs with ANY cred (the mapper's low-priv principal is enough; ADCS
misconfigs leak via default read). Through SOCKS pivots add
-ldap-scheme ldap. Every hit -> templates.jsonl row.

### Step 2 - CA inventory

CA name(s), web-enrollment presence (/certsrv reachable), enrollment
agents, officer rights, target accounts (Administrator, NTLM-hardened
ones). @ $RUN/raw/ca-inventory.md.

### Steps 3-11 - Per-ESC exploitation

One probes/<esc>.jsonl file per class; cert + key archived under
probes/raw/; per-ESC wiki page consulted BEFORE firing (conditions
first - ESC9-16 especially are mapping-condition-gated):

- ESC1: `certipy req -u <user>@<domain> -p <pass> -ca <ca>
  -template <vuln> -upn administrator@<domain>` -> cert auth as
  target.
- ESC2/3: Any Purpose / enrollment-agent chains (ESC2 any-purpose
  cert used where EKU-pinning is expected; ESC3 enrollment-agent
  requests ON BEHALF of the victim).
- ESC4: writable template ACL -> `certipy template -write` to an
  ESC1 shape, then ESC1.
- ESC6/7: SAN inscription on CA / CA-level ACL abuse; ESC7 with
  backup rights = CA cert + key -> golden certificate (Step 10).
- ESC8: NTLM relay to web enrollment - pair a coercion trigger
  (printerbug/petitpotam; the wiki network-service-attacks page owns
  the primitive) with ntlmrelayx to /certsrv, enroll as the relayed
  victim.
- ESC9-16: certificate-mapping variants - verify the mapping
  conditions on the CA (how UPN<->SAN<->altSecurityIdentities is
  resolved) per each ESC page, then the page's exact req/auth pair.
- Shadow credentials: GenericWrite on ANY object ->
  `certipy shadow auto -account <target>` -> LDAPS auth as target.
  (Feed from the ACL expert's GenericWrite findings.)
- Golden certificate: CA cert + private key (ESC7/backup) -> forge
  for ANY user. RoE-gated: forge for a TEST account, prove auth,
  stop.
- PKINIT dual-yield: a cert for a NTLM-hardened account yields BOTH
  an NT hash and a TGT - when PtH returns STATUS_ACCOUNT_RESTRICTION,
  switch to the ccache path (`export KRB5CCNAME=...; impacket-* -k
  -no-pass`). See [[adcs]].

### Step 12 - Exit

Append ADCS rows to $RUN/candidates.jsonl ({class: ad-adcs, ...});
update the ADCS section of candidates.md (per-ESC verdicts); append
`AD-ADCS-DONE templates=<n> exploited=<n> certs=<n>` to
$ENG_DIR/hunt-ad-<domain>.md; _requests.md rows (lane = hunt-ad-adcs);
Deadends per clean ESC class naming WHICH conditions failed.

## Chaining

- Cert -> TGT -> Kerberos moves: hunt-ad-kerberos.
- GenericWrite feeds (from ACL findings): shadow credentials live
  here.
- Cert-as-DA -> DCSync close-out: back to the mapper's step 7 region.

## Validation

- Proof = the cert AUTHENTICATING as the target (certipy auth hash
  output / exercised LDAPS or Kerberos session), never the cert file
  alone.
- Negative control: enrollment against a NON-vulnerable template for
  the same principal fails.

## False Positives

- "Vulnerable" flag with ESC page conditions unmet (checked the page
  first - this is why).
- Template writable by you but EKU/publisher constraints block the
  useful cert shape.
- ESC8 relay fired but web enrollment disabled on the CA.
- Cert issued for a user whose SID mapping does not resolve to a
  privileged context.

## Severity

CRITICAL = ESC exploited to a DA-equivalent cert / golden
certificate / NTLM-hardened admin via PKINIT. HIGH = cert for
privileged non-DA / shadow creds on sensitive object. MEDIUM =
misconfig proven, target cert constrained.

## N/A escapes

- "N/A: certipy absent on VM (install failed)"
- "N/A: no CA in the domain" (mapper confirmed - whole-run skip)
An N/A tick is a claim with a reason, never a silent pass. Identical
strings in SKILL.md and checklist.md.

## Bitter-pill variant

Freehand run: skip checklist + numbered steps, one freehand pass over
the CA, output ONLY $RUN/analysis/bitter-pill.md (tried/found/
dismissed, every claim carries evidence). The cert-authenticated gate
survives freehand. Declare with a _requests.md row (lane =
hunt-ad-adcs-bitterpill).

### Depth walk (mandatory)

Walk EVERY applicable row of the payload arsenal page cited above.
Record each row in `$RUN/coverage-depth.md` as a table
`| row | state | evidence |` where state is `probed`, `blocked`, or
`N/A`, and evidence is a probe-pair path or a Deadends.md line. A bare
`probed` with no evidence reference fails the completion gate
(NEEDS-REVIEW). N/A rows cite why (surface shape forbids it).

Blocked implies research: before any Deadend is claimable on a blocked
row, (a) walk the arsenal page's bypass-ladder rows for that control
class, and (b) run one wiki query AND one `mcp__wigolo__search` for the
specific tech-plus-control bypass. Results, or a genuine null, land in
`coverage-depth.md`. "No research tried" is not a claimable state.

## Exit artifact + handoff

Appends into the shared mapper $RUN: probes/ad-adcs*.{jsonl,md},
raw/ca-inventory.md, candidates.jsonl/md (ADCS rows), pointer line
AD-ADCS-DONE. Cert material ONLY under probes/raw/. Consumer: triage.
Findings leave ONLY through G1. Distill: `python3 scripts/wiki-stage.py
--kind technique --slug <slug> --target-page
techniques/active-directory/adcs.md`.

## Stop conditions

All ESC steps terminal; forged certs only for TEST accounts (auth
proven, no persistence); nothing written into skill dirs; no
unchecked boxes above REVIEW; hunt-core stop conditions fire
unchanged.

## Attack surface

**APPROACH:** Fire the unauth-enum wave at once (null/guest shares + RID-brute, anon LDAP users + description fields, AS-REP roast, person-object SPN Kerberoast, lockout policy, `certipy find -vulnerable`), then walk enum -> roast -> ACL/ADCS ESC1-16 -> delegation -> DCSync -> lateral, reusing captured creds inside the lockout gate.
**AVOID:** A captured-but-uncracked hash, a dumped ticket, a theoretical BloodHound/ESC edge never executed, or an unvalidated spray hit is NOT confirmation - creds must authenticate to the DC (`[+]`/`Pwn3d!`) or the ticket/ACL abuse must be exercised end to end.

## Cross-routing

- Load hunt-windows when you land on a member host for local privesc before DA.
- Load hunt-m365 when the tenant is Entra/hybrid (AD Connect bridge both ways).
- Load hunt-auth for AD FS / cert-based web auth flows.
- Not this skill: plain local privesc with no domain in play (hunt-windows).

