# Enumeracion con klist

{% hint style="info" %}
Para llevar tu aprendizaje al siguiente nivel y practicar estas técnicas de manera segura y efectiva, te invitamos a adquirir acceso premium a nuestro material de curso. No pierdas esta oportunidad de profundizar tus conocimientos. Para más información y adquirir tu acceso, visita nuestro canal de ventas: <https://wa.link/j265a0>. ¡Te esperamos para empezar este viaje juntos!
{% endhint %}

{% hint style="success" %}
**OBJETIVO DEL EJERCICIO #12:**

Utiliza`klist`para enumerar los tickets cacheados en el equipo. \
Para realizarlo es suficiente tener encendido UNICAMENTE `WEBSERVER` y `First-DC`.
{% endhint %}

* <mark style="color:red;">**Función**</mark><mark style="color:red;">:</mark> `klist` es una herramienta de línea de comandos utilizada en sistemas operativos Windows para visualizar los tickets de Kerberos almacenados en la caché de un cliente.
* <mark style="color:red;">**Uso Común**</mark><mark style="color:red;">:</mark> Se utiliza para diagnosticar problemas de autenticación y para verificar que los tickets de Kerberos se han emitido correctamente.
* <mark style="color:red;">**Características**</mark><mark style="color:red;">:</mark>
  * Puede mostrar tanto los Ticket Granting Tickets (TGT) como los Service Tickets (ST).
  * Permite a los usuarios ver la duración de la validez de los tickets y otros detalles como el tipo de cifrado y flags asociados.
* <mark style="color:red;">**Importancia en Ciberseguridad**</mark><mark style="color:red;">:</mark> En el contexto de la ciberseguridad ofensiva, `klist` se utiliza para entender el estado de las credenciales Kerberos en una máquina comprometida, lo que puede ser crucial para movimientos laterales y escalada de privilegios en un entorno de Active Directory.

## <mark style="color:red;">Desglose de la Salida de</mark> `klist`

Vamos a desglosar la siguiente salida del comando klist despues de habernos autenticado por RDP con el usuario regular.user:

```
C:\Users\admin\Desktop>klist

Current LogonId is 0:0x10d6046
Cached Tickets: (2)

#0>     Client: regular.user @ SPARTANCYBERSEC.CORP
        Server: krbtgt/SPARTANCYBERSEC.CORP @ SPARTANCYBERSEC.CORP
        KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96
        Ticket Flags 0x40e10000 -> forwardable renewable initial pre_authent name_canonicalize
        Start Time: 11/12/2023 20:30:04 (local)
        End Time:   11/13/2023 6:30:04 (local)
        Renew Time: 11/19/2023 20:30:04 (local)
        Session Key Type: AES-256-CTS-HMAC-SHA1-96
        Cache Flags: 0x1 -> PRIMARY
        Kdc Called: First-DC.spartancybersec.corp

#1>     Client: regular.user @ SPARTANCYBERSEC.CORP
        Server: ldap/First-DC.spartancybersec.corp/spartancybersec.corp @ SPARTANCYBERSEC.CORP
        KerbTicket Encryption Type: AES-256-CTS-HMAC-SHA1-96
        Ticket Flags 0x40a50000 -> forwardable renewable pre_authent ok_as_delegate name_canonicalize
        Start Time: 11/12/2023 20:30:04 (local)
        End Time:   11/13/2023 6:30:04 (local)
        Renew Time: 11/19/2023 20:30:04 (local)
        Session Key Type: AES-256-CTS-HMAC-SHA1-96
        Cache Flags: 0
        Kdc Called: First-DC.spartancybersec.corp
```

1. <mark style="color:red;">**Información General**</mark><mark style="color:red;">:</mark>
   * `Current LogonId is 0:0x10d6046`: Identifica la sesión actual en la que se ejecuta el comando.
2. <mark style="color:red;">**Detalles de los Tickets en Caché**</mark><mark style="color:red;">:</mark>
   * <mark style="color:red;">**Número de Tickets**</mark><mark style="color:red;">:</mark> Se muestran dos tickets en caché (`Cached Tickets: (2)`).
3. <mark style="color:red;">**Ticket #0**</mark><mark style="color:red;">:</mark>
   * <mark style="color:red;">**Cliente**</mark><mark style="color:red;">:</mark> `regular.user @ SPARTANCYBERSEC.CORP`. Este es el usuario para el cual se emitió el ticket.
   * <mark style="color:red;">**Servidor**</mark><mark style="color:red;">:</mark> `krbtgt/SPARTANCYBERSEC.CORP @ SPARTANCYBERSEC.CORP`. Es el Ticket Granting Ticket (TGT) para el dominio `SPARTANCYBERSEC.CORP`.
   * <mark style="color:red;">**Tipo de Encriptación del Ticket**</mark><mark style="color:red;">:</mark> `AES-256-CTS-HMAC-SHA1-96`.
   * <mark style="color:red;">**Flags del Ticket**</mark><mark style="color:red;">:</mark> Indican características como `forwardable`, `renewable`, `initial`, `pre_authent`, `name_canonicalize`.
   * <mark style="color:red;">**Tiempos de Validez**</mark><mark style="color:red;">:</mark> Inicio (`Start Time`), fin (`End Time`) y renovación (`Renew Time`) del ticket.
   * <mark style="color:red;">**Tipo de Clave de Sesión**</mark><mark style="color:red;">:</mark> `AES-256-CTS-HMAC-SHA1-96`.
   * <mark style="color:red;">**Flags de Caché**</mark><mark style="color:red;">:</mark> `0x1 -> PRIMARY` indica que es el ticket primario en la caché.
   * <mark style="color:red;">**KDC Llamado**</mark><mark style="color:red;">:</mark> `First-DC.spartancybersec.corp`.
4. <mark style="color:red;">**Ticket #1**</mark><mark style="color:red;">:</mark>
   * Similar al Ticket #0, pero este es específico para el servicio LDAP (`ldap/First-DC.spartancysec.corp/spartancybersec.corp`).
   * Este ticket tiene el flag `ok_as_delegate`, indicando que puede ser utilizado para delegación de credenciales.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://books.spartan-cybersec.com/cpad/enumeracion-en-ad/enumeracion-con-klist.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
