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)
wmiexecexecutes commands viaWMIsmbexecexecutes commands by creating and running a service, similarly to thePsExecutilityatexecexecutes commands by remotely scheduling a task with through the Windows task schedulermmcexecexecutes commands over theMMC20.ApplicationDCOMobject
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
--lsaoption dumps LSA secrets which can't be used inPass-the-Hashattack and are harder to crack.The
<TARGET>and<MODULE>should be specified before the credentials as aCrackMapExecbug could skip the targets / module otherwise.If the targeted host is unreachable,
CrackMapExecmay 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 - PowerShellnote).If a
permission deniederror is raised upon first execution ofcrackmapexecon a Linux system, necessary rights to create new files in the user'sHOMEfolder may be missing. A temporary alternativeHOMEfolder can be specified forcrackmapexecexecution:HOME=<PATH> crackmapexec [...].
Last updated