AI-powered Kerberos security audit tool for Active Directory environments.
Outil d'audit de sécurité Kerberos piloté par IA pour les environnements Active Directory.
Author / Auteur: Ayi NEDJIMI HuggingFace: AYI-NEDJIMI
EN: This tool is designed for authorized security auditing only. Only use this tool on systems you own or have explicit written authorization to test. Unauthorized access to computer systems is illegal.
FR: Cet outil est conçu pour un audit de sécurité autorisé uniquement. Utilisez cet outil uniquement sur des systèmes que vous possédez ou pour lesquels vous disposez d'une autorisation écrite explicite. L'accès non autorisé à des systèmes informatiques est illégal.
KerberosAudit-AI performs comprehensive Kerberos security auditing of Active Directory environments. It detects Kerberoasting, AS-REP roasting, Golden Ticket indicators, delegation misconfigurations, SPN anomalies, and policy compliance issues, providing actionable remediation guidance with optional AI-powered analysis.
Key Features:
- Kerberoasting Detection: Identifies service accounts with SPNs vulnerable to offline brute-force attacks, with risk scoring based on admin status, encryption type, and password age
- AS-REP Roasting Detection: Finds accounts with Kerberos pre-authentication disabled (DONT_REQ_PREAUTH)
- Golden Ticket Indicators: Analyzes krbtgt password age and Kerberos ticket files (.kirbi, .ccache) for signs of forged tickets
- Delegation Audit: Discovers unconstrained, constrained, protocol transition, and resource-based constrained delegation (RBCD)
- SPN Analysis: Validates SPN syntax, detects duplicates, orphaned SPNs, and identifies high-value service targets
- Ticket File Analysis: Parses .kirbi (KRB_CRED ASN.1) and .ccache (MIT format) ticket files for anomaly detection
- Policy Compliance: Evaluates 13 Kerberos-related security policy checks against industry best practices
- Security Scoring: Generates a 0-100 security score with letter grade (A+ to F) and prioritized recommendations
- MITRE ATT&CK Mapping: Maps findings to MITRE techniques (T1558.003, T1558.004, T1558.001, T1550.003, etc.)
- AI-Powered Analysis: Optional OpenAI integration for detailed narrative analysis with template fallback
- Multi-Format Reports: HTML (dark theme), JSON, and Markdown report generation
KerberosAudit-AI effectue un audit de sécurité Kerberos complet des environnements Active Directory. Il détecte le Kerberoasting, l'AS-REP roasting, les indicateurs de Golden Ticket, les mauvaises configurations de délégation, les anomalies SPN et les problèmes de conformité des politiques, en fournissant des recommandations de remédiation exploitables avec une analyse optionnelle alimentée par l'IA.
Fonctionnalités principales :
- Détection Kerberoasting : Identifie les comptes de service avec SPN vulnérables aux attaques de force brute hors ligne, avec score de risque basé sur le statut admin, le type de chiffrement et l'âge du mot de passe
- Détection AS-REP Roasting : Trouve les comptes avec pré-authentification Kerberos désactivée (DONT_REQ_PREAUTH)
- Indicateurs Golden Ticket : Analyse l'âge du mot de passe krbtgt et les fichiers de tickets Kerberos (.kirbi, .ccache) pour détecter des tickets forgés
- Audit de Délégation : Découvre les délégations non contrainte, contrainte, transition de protocole et RBCD
- Analyse SPN : Valide la syntaxe SPN, détecte les doublons, les SPN orphelins et identifie les services à haute valeur
- Analyse de Fichiers Tickets : Parse les fichiers tickets .kirbi (KRB_CRED ASN.1) et .ccache (format MIT) pour la détection d'anomalies
- Conformité Politique : Évalue 13 contrôles de politique de sécurité Kerberos selon les meilleures pratiques de l'industrie
- Score de Sécurité : Génère un score de sécurité 0-100 avec note alphabétique (A+ à F) et recommandations priorisées
- Mapping MITRE ATT&CK : Mappe les résultats aux techniques MITRE (T1558.003, T1558.004, T1558.001, T1550.003, etc.)
- Analyse IA : Intégration optionnelle OpenAI pour une analyse narrative détaillée avec fallback modèle
- Rapports Multi-Format : Génération de rapports HTML (thème sombre), JSON et Markdown
# Clone the repository / Cloner le dépôt
git clone https://github.com/ayinedjimi/KerberosAudit-AI.git
cd KerberosAudit-AI
# Install dependencies / Installer les dépendances
pip install -r requirements.txt
# Install in development mode / Installer en mode développement
pip install -e .
# Or install directly / Ou installer directement
pip install -e ".[dev]"# Basic audit / Audit basique
kerberosaudit audit -s dc01.corp.example.com -d corp.example.com -u auditor -p 'P@ssw0rd'
# Audit with AI analysis / Audit avec analyse IA
kerberosaudit audit -s dc01.corp.example.com -d corp.example.com \
-u auditor -p 'P@ssw0rd' --openai-key sk-xxx
# Audit with all output formats / Audit avec tous les formats
kerberosaudit audit -s dc01.corp.example.com -d corp.example.com \
-u auditor -p 'P@ssw0rd' -o report --format all
# Non-SSL connection / Connexion non-SSL
kerberosaudit audit -s dc01.corp.example.com -d corp.example.com \
-u auditor -p 'P@ssw0rd' --no-ssl# Analyze a single .kirbi file / Analyser un fichier .kirbi
kerberosaudit tickets -f /path/to/ticket.kirbi
# Analyze a single .ccache file / Analyser un fichier .ccache
kerberosaudit tickets -f /tmp/krb5cc_1000
# Analyze all tickets in a directory / Analyser tous les tickets d'un répertoire
kerberosaudit tickets -D /path/to/tickets/
# Analyze with custom policy thresholds / Analyser avec seuils personnalisés
kerberosaudit tickets -D /path/to/tickets/ --max-age 8 --max-renew 5# Evaluate Kerberos policies / Évaluer les politiques Kerberos
kerberosaudit policy -s dc01.corp.example.com -d corp.example.com \
-u auditor -p 'P@ssw0rd'# Audit all SPNs / Auditer tous les SPN
kerberosaudit spns -s dc01.corp.example.com -d corp.example.com \
-u auditor -p 'P@ssw0rd'# Discover all delegations / Découvrir toutes les délégations
kerberosaudit delegation -s dc01.corp.example.com -d corp.example.com \
-u auditor -p 'P@ssw0rd'# Generate HTML report from JSON audit results / Générer un rapport HTML
kerberosaudit report -i audit_results.json -o report --format html
# Generate all formats / Générer tous les formats
kerberosaudit report -i audit_results.json -o report --format allKerberosAudit-AI/
├── src/
│ └── kerberosaudit_ai/
│ ├── __init__.py # Package initialization
│ ├── models.py # Pydantic data models (UAC, encryption, findings)
│ ├── auditor.py # Core LDAP-based Kerberos auditor engine
│ ├── ticket_analyzer.py # .kirbi/.ccache ticket parser & anomaly detector
│ ├── policy_checker.py # 13-check policy compliance & scoring engine
│ ├── reporter.py # HTML/JSON/Markdown report generator
│ └── cli.py # Rich CLI with subcommands
├── tests/
│ ├── conftest.py # Shared test fixtures
│ ├── test_auditor.py # Auditor engine tests
│ ├── test_ticket_analyzer.py # Ticket analysis tests
│ └── test_policy_checker.py # Policy checker & scoring tests
├── setup.py
├── requirements.txt
├── LICENSE
└── README.md
| Check / Contrôle | Description (EN) | Description (FR) | MITRE |
|---|---|---|---|
| Kerberoasting | SPN accounts with weak encryption | Comptes SPN avec chiffrement faible | T1558.003 |
| AS-REP Roasting | Pre-auth disabled accounts | Comptes sans pré-authentification | T1558.004 |
| Golden Ticket | krbtgt age & ticket anomalies | Âge krbtgt & anomalies tickets | T1558.001 |
| Silver Ticket | Forged service ticket indicators | Indicateurs de tickets forgés | T1558.002 |
| Unconstrained Delegation | Full TGT forwarding enabled | Transfert TGT complet activé | T1550.003 |
| Constrained Delegation | Service-to-service delegation | Délégation service à service | T1550.003 |
| RBCD | Resource-based constrained delegation | Délégation contrainte basée ressource | T1550.003 |
| DES Encryption | Legacy DES still enabled | DES hérité encore activé | T1557 |
| RC4 Encryption | RC4-HMAC without AES | RC4-HMAC sans AES | T1557 |
| Pre-Authentication | Missing Kerberos pre-auth | Pré-auth Kerberos manquante | T1558.004 |
| Protected Users | Privileged accounts not protected | Comptes privilégiés non protégés | T1078 |
| Clock Skew | Excessive clock skew tolerance | Tolérance de décalage d'horloge excessive | T1550 |
| SPN Anomalies | Duplicate/orphaned/malformed SPNs | SPN dupliqués/orphelins/malformés | T1558.003 |
The security score is computed from weighted policy checks and finding severity:
| Grade | Score | Level / Niveau |
|---|---|---|
| A+ | 97-100 | Excellent |
| A | 90-96 | Very Good / Très bon |
| A- | 87-89 | Good / Bon |
| B+ | 83-86 | Above Average / Au-dessus de la moyenne |
| B | 75-82 | Average / Moyen |
| B- | 70-74 | Below Average / En dessous de la moyenne |
| C+ | 67-69 | Fair / Passable |
| C | 60-66 | Poor / Faible |
| C- | 55-59 | Very Poor / Très faible |
| D+ | 50-54 | Bad / Mauvais |
| D | 40-49 | Very Bad / Très mauvais |
| D- | 35-39 | Critical / Critique |
| F | 0-34 | Failing / Échec |
This tool is part of a comprehensive Active Directory security audit suite:
- LDAPRecon-AI - LDAP reconnaissance & enumeration with AI-powered risk scoring
- ACLAudit-AI - ACL/DACL permission audit with escalation path detection
- KerberosAudit-AI (this tool) - Kerberos security audit with ticket analysis
All tools by Ayi NEDJIMI | HuggingFace
# Run all tests / Lancer tous les tests
pytest tests/ -v
# Run with coverage / Lancer avec couverture
pytest tests/ -v --cov=kerberosaudit_ai --cov-report=html
# Run specific test module / Lancer un module de test spécifique
pytest tests/test_auditor.py -v
pytest tests/test_ticket_analyzer.py -v
pytest tests/test_policy_checker.py -vContributions are welcome! Please open an issue or submit a pull request.
Les contributions sont les bienvenues ! Ouvrez un ticket ou soumettez une pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
Ce projet est sous licence MIT - voir le fichier LICENSE pour les détails.
Ayi NEDJIMI
- Website / Site web: ayinedjimi-consultants.fr
- GitHub: ayinedjimi
- HuggingFace: AYI-NEDJIMI