88tcp/udp - Pentesting Kerberos

Reading time: 6 minutes

tip

Impara e pratica il hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Impara e pratica il hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Supporta HackTricks

Basic Information

Kerberos si basa sul principio di autenticare gli utenti senza gestire direttamente il loro accesso alle risorse. Questa è una distinzione importante perché sottolinea il ruolo del protocollo nei framework di sicurezza.

In ambienti come Active Directory, Kerberos è fondamentale per stabilire l'identità degli utenti validando le loro password segrete. Questo processo garantisce che l'identità di ogni utente sia confermata prima che interagisca con le risorse di rete. Tuttavia, Kerberos non estende la sua funzionalità alla valutazione o all'applicazione delle autorizzazioni che un utente possiede su risorse o servizi specifici. Fornisce invece un metodo sicuro per autenticare gli utenti, che rappresenta un primo passo critico nel processo di sicurezza.

Dopo l'autenticazione effettuata da Kerberos, il processo decisionale riguardo all'accesso alle risorse viene delegato ai singoli servizi all'interno della rete. Questi servizi sono quindi responsabili di valutare i diritti e le autorizzazioni dell'utente autenticato, basandosi sulle informazioni fornite da Kerberos sui privilegi dell'utente. Questa architettura permette una separazione delle responsabilità tra l'autenticazione dell'identità degli utenti e la gestione dei loro diritti di accesso, consentendo un approccio più flessibile e sicuro alla gestione delle risorse nelle reti distribuite.

Porta predefinita: 88/tcp/udp

PORT   STATE SERVICE
88/tcp open  kerberos-sec

Per imparare come abusare di Kerberos dovresti leggere il post su Active Directory.

Ambienti Kerberos-only: preparazione del client e troubleshooting

Quando NTLM è disabilitato sui servizi di dominio (SMB/WinRM/etc.), devi autenticarti con Kerberos. Trappole comuni e una procedura funzionante:

  • La sincronizzazione dell'orologio è obbligatoria. Se l'orologio del tuo host è sfasato di più di pochi minuti vedrai KRB_AP_ERR_SKEW e tutte le autenticazioni Kerberos falliranno. Sincronizza con il DC:
bash
# quick one-shot sync (requires sudo)
sudo ntpdate <dc.fqdn> || sudo chronyd -q 'server <dc.fqdn> iburst'
  • Genera un krb5.conf valido per il realm/dominio di destinazione. netexec (fork di CME) può generarne uno per te mentre testi SMB:
bash
# Generate krb5.conf and install it
netexec smb <dc.fqdn> -u <user> -p '<pass>' -k --generate-krb5-file krb5.conf
sudo cp krb5.conf /etc/krb5.conf
  • Ottieni un TGT e verifica il ccache:
bash
kinit <user>
klist
  • Usa Kerberos con SMB tooling (no passwords sent, uses your ccache):
bash
# netexec / CME
netexec smb <dc.fqdn> -k            # lists shares, runs modules using Kerberos
# impacket examples also support -k / --no-pass to use the ccache
smbclient --kerberos //<dc.fqdn>/IPC$
  • GSSAPI SSH single sign-on (OpenSSH a Windows OpenSSH server):
bash
# Ensure krb5.conf is correct and you have a TGT (kinit)
# Use the FQDN that matches the host SPN. Wrong names cause: "Server not found in Kerberos database"
ssh -o GSSAPIAuthentication=yes <user>@<host.fqdn>

Suggerimenti:

  • Ensure your /etc/hosts resolves the exact FQDN you will SSH/SMB to, and that it comes before any bare domain entries if you are overriding DNS. SPN mismatches break GSSAPI.
  • If NTLM is disabled on SMB you may see STATUS_NOT_SUPPORTED with NTLM attempts; add -k to force Kerberos.

Altro

Shodan

  • port:88 kerberos

MS14-068

La vulnerabilità MS14-068 permette a un attaccante di manomettere il token di login Kerberos di un utente legittimo per dichiarare falsamente privilegi elevati, ad esempio essere un Domain Admin. Questa rivendicazione contraffatta viene erroneamente convalidata dal Domain Controller, consentendo accesso non autorizzato alle risorse di rete attraverso l'Active Directory forest.

Kerberos Vulnerability in MS14-068 (KB3011780) Explained – Active Directory & Azure AD/Entra ID Security

Altri exploit: https://github.com/SecWiki/windows-kernel-exploits/tree/master/MS14-068/pykek

Riferimenti

HackTricks Comandi automatici

Protocol_Name: Kerberos    #Protocol Abbreviation if there is one.
Port_Number:  88   #Comma separated if there is more than one.
Protocol_Description: AD Domain Authentication         #Protocol Abbreviation Spelled out

Entry_1:
Name: Notes
Description: Notes for Kerberos
Note: |
Kerberos operates on a principle where it authenticates users without directly managing their access to resources. This is an important distinction because it underlines the protocol's role in security frameworks.
In environments like **Active Directory**, Kerberos is instrumental in establishing the identity of users by validating their secret passwords. This process ensures that each user's identity is confirmed before they interact with network resources. However, Kerberos does not extend its functionality to evaluate or enforce the permissions a user has over specific resources or services. Instead, it provides a secure way of authenticating users, which is a critical first step in the security process.

https://book.hacktricks.wiki/en/network-services-pentesting/pentesting-kerberos-88/index.html

Entry_2:
Name: Pre-Creds
Description: Brute Force to get Usernames
Command: nmap -p 88 --script=krb5-enum-users --script-args krb5-enum-users.realm="{Domain_Name}",userdb={Big_Userlist} {IP}

Entry_3:
Name: With Usernames
Description: Brute Force with Usernames and Passwords
Note: consider git clone https://github.com/ropnop/kerbrute.git ./kerbrute -h

Entry_4:
Name: With Creds
Description: Attempt to get a list of user service principal names
Command: GetUserSPNs.py -request -dc-ip {IP} active.htb/svc_tgs

tip

Impara e pratica il hacking AWS:HackTricks Training AWS Red Team Expert (ARTE)
Impara e pratica il hacking GCP: HackTricks Training GCP Red Team Expert (GRTE) Impara e pratica il hacking Azure: HackTricks Training Azure Red Team Expert (AzRTE)

Supporta HackTricks