CrackMapExec

CrackMapExec is a "Swiss army knife for pentesting Windows / Active Directory environments" that wraps around multiples Impacket modules.

CrackMapExec can be used to test credentials and execute commands through SMB, WinRM, MSSQL, SSH, HTTP services.

Over SMB, CrackMapExec supports different command execution methods:

  • (Default) wmiexec executes commands via WMI

  • smbexec executes commands by creating and running a service, similarly to the PsExec utility

  • atexec executes commands by remotely scheduling a task with through the Windows task scheduler

  • mmcexec executes commands over the MMC20.Application DCOM object

CrackMapExec additionally supports authentication with Kerberos tickets (specified in the KRB5CCNAME environment variable) on Linux operating systems.

CrackMapExec installation

CrackMapExec requires various Python dependencies (sometimes in specific version), making its installation somewhat challenging at times.

CrackMapExec pre-compiled binaries for Linux and Windows (that still require Python3 to be installed on the system) can be downloaded on the CrackMapExec's GitHub repository's "Actions". Fully standalone binaries for Linux and Windows can be retrieved in the OffensivePythonPipeline.

For more information on CrackMapExec's installation refer to the official documentation.

# As of March 2021, the crackmapexec package of the Kali Linux distribution is up to date and can be used to easily install CrackMapExec.
apt install crackmapexec

# Installation using Docker.
docker pull byt3bl33d3r/crackmapexec
docker run byt3bl33d3r/crackmapexec:latest [...]

CrackMapExec usage

Additionally, CrackMapExec includes multiples modules that can be used for post-exploitation:

CrackMapExec modules

CrackMapExec notable modules usage:

For more information on how to remotely extract credentials from the SAM registry hive and the LSASS process, refer to the [Windows] Post exploitation note.

Note that:

  • The --lsa option dumps LSA secrets which can't be used in Pass-the-Hash attack and are harder to crack.

  • The <TARGET> and <MODULE> should be specified before the credentials as a CrackMapExec bug could skip the targets / module otherwise.

  • If the targeted host is unreachable, CrackMapExec may exit with out returning any error message.

  • In case the metinject fails, a local administrator can be added for RDP access or a powershell reverse shell injected in memory instead (refer to the [General] Shells - PowerShell note).

  • If a permission denied error is raised upon first execution of crackmapexec on a Linux system, necessary rights to create new files in the user's HOME folder may be missing. A temporary alternative HOME folder can be specified for crackmapexec execution: HOME=<PATH> crackmapexec [...].

Last updated