A Model Context Protocol (MCP) server that provides AI assistants with tools to interact with Certipy - the premier Active Directory Certificate Services (AD CS) enumeration and abuse tool.
This MCP server enables AI assistants to perform AD CS security assessments by executing Certipy commands on a remote Kali Linux machine via SSH. It supports the full range of AD CS attack vectors documented in the Certified Pre-Owned research.
- Enumeration - Discover Certificate Authorities, templates, and ESC1-ESC16 vulnerabilities
- Certificate Requests - Request certificates using vulnerable templates
- Authentication - Perform PKINIT authentication to obtain TGTs and NTLM hashes
- Golden Certificates - Forge certificates using compromised CA private keys
- Shadow Credentials - Account takeover via Key Credential Links
- NTLM Relay - Relay attacks against AD CS HTTP/RPC endpoints
- Template/CA Management - Modify templates and manage CA configurations
-
Kali Linux machine with Certipy installed:
sudo apt install certipy-ad # or pip install certipy-ad -
SSH access configured to the Kali machine (passwordless recommended):
# Example ~/.ssh/config entry Host kali HostName 192.168.1.100 User root IdentityFile ~/.ssh/id_rsa
-
Node.js 18+ on the machine running the MCP server
# Clone the repository
git clone https://github.com/schwarztim/sec-certipy-mcp.git
cd sec-certipy-mcp
# Install dependencies
npm install
# Build
npm run buildAdd to your claude_desktop_config.json:
{
"mcpServers": {
"certipy": {
"command": "node",
"args": ["/path/to/sec-certipy-mcp/dist/index.js"],
"env": {
"CERTIPY_KALI_HOST": "kali",
"CERTIPY_SSH_OPTIONS": "-o StrictHostKeyChecking=no -o ConnectTimeout=10"
}
}
}
}| Environment Variable | Default | Description |
|---|---|---|
CERTIPY_KALI_HOST |
kali |
SSH host alias or IP for Kali machine |
CERTIPY_SSH_OPTIONS |
-o StrictHostKeyChecking=no -o ConnectTimeout=10 |
SSH connection options |
Enumerate AD CS configuration and identify vulnerabilities (ESC1-ESC16). This is typically the first step in any AD CS assessment.
{
"username": "user",
"password": "password",
"domain": "corp.local",
"dc_ip": "192.168.1.1",
"vulnerable": true
}Request certificates from AD CS. Supports multiple enrollment protocols (RPC, DCOM, HTTP).
{
"username": "user",
"password": "password",
"domain": "corp.local",
"dc_ip": "192.168.1.1",
"ca": "corp-DC-CA",
"template": "VulnerableTemplate",
"upn": "administrator@corp.local"
}Authenticate using a certificate (PKINIT) to obtain Kerberos TGT and NTLM hash.
{
"pfx": "/path/to/administrator.pfx",
"dc_ip": "192.168.1.1"
}Forge certificates using a compromised CA private key (Golden Certificate attack).
{
"ca_pfx": "/path/to/ca.pfx",
"upn": "administrator@corp.local",
"subject": "CN=Administrator,CN=Users,DC=corp,DC=local"
}Abuse Shadow Credentials (Key Credential Link) for account takeover.
{
"username": "attacker",
"password": "password",
"domain": "corp.local",
"dc_ip": "192.168.1.1",
"account": "target_user",
"action": "auto"
}NTLM relay attack targeting AD CS HTTP/RPC endpoints (ESC8/ESC11).
{
"target": "http://ca.corp.local/certsrv/certfnsh.asp",
"ca": "corp-DC-CA",
"template": "DomainController"
}View and modify certificate template configurations (ESC4).
{
"username": "user",
"password": "password",
"domain": "corp.local",
"dc_ip": "192.168.1.1",
"template": "VulnerableTemplate",
"save_config": "template_backup.json"
}Manage Certificate Authority - list/enable/disable templates, issue/deny requests (ESC7).
{
"username": "user",
"password": "password",
"domain": "corp.local",
"dc_ip": "192.168.1.1",
"ca": "corp-DC-CA",
"list_templates": true
}Manage local certificates - import, export, convert between formats.
{
"pfx": "certificate.pfx",
"export": true,
"out": "certificate"
}Manage AD user and computer accounts for attack setup.
{
"username": "user",
"password": "password",
"domain": "corp.local",
"dc_ip": "192.168.1.1",
"user": "newcomputer$",
"create": true
}Get help for Certipy commands.
{
"command": "find"
}| ESC | Vulnerability | Certipy Tool | Description |
|---|---|---|---|
| ESC1 | Misconfigured certificate templates | certipy_req with -upn |
Templates allowing requesters to specify SAN |
| ESC2 | Any Purpose or SubCA templates | certipy_req |
Overly permissive EKU configurations |
| ESC3 | Enrollment agent templates | certipy_req with -on-behalf-of |
Request certs on behalf of other users |
| ESC4 | Vulnerable template ACLs | certipy_template |
Write access to template objects |
| ESC5 | Vulnerable PKI AD object ACLs | certipy_ca |
Write access to CA configuration |
| ESC6 | EDITF_ATTRIBUTESUBJECTALTNAME2 | certipy_req |
CA allows SAN specification |
| ESC7 | Vulnerable CA ACLs | certipy_ca |
ManageCA or ManageCertificates rights |
| ESC8 | HTTP enrollment (NTLM relay) | certipy_relay |
Web enrollment vulnerable to relay |
| ESC9-16 | Various misconfigurations | certipy_find |
Additional template/CA issues |
This tool is intended for authorized security testing and research purposes only. Unauthorized access to computer systems is illegal. Always ensure you have proper authorization before conducting security assessments.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.