nxc-winrm
Execute commands on Windows machines via WinRM
TLDR
Search for valid credentials by trying out every combination in the specified lists of [u]sernames and [p]asswords
Specify the domain to authenticate to (avoids an initial SMB connection)
Execute the specified command on the host
Execute the specified PowerShell command on the host as administrator using LAPS
SYNOPSIS
nxc-winrm [options]
PARAMETERS
--help
Show program's help message and exit.
-t
Target(s) to attack. Can be a single IP/hostname, CIDR range, or a file containing a list of targets.
-u
Username for authentication.
-p
Password for authentication.
-H
NTLM hash for authentication (instead of password).
--port
WinRM port (default: 5985 for HTTP, 5986 for HTTPS).
--transport
WinRM transport protocol (http or https, default: http).
-c
Command to execute on the target(s).
-x
Path to a script to execute on the target(s).
--no-ssl
Disable SSL verification (useful for self-signed certificates).
--timeout
Timeout for the connection (default: 10 seconds).
--kerberos
Use Kerberos authentication.
--kdcHost
Hostname or IP of the KDC (Kerberos Key Distribution Center).
--local-auth
Use local user authentication (useful for some configurations).
DESCRIPTION
The `nxc-winrm` command, part of the `NetExec` (formerly `CrackMapExec`) suite, enables executing commands on remote Windows systems using the Windows Remote Management (WinRM) protocol from a Linux environment. It facilitates penetration testing, security auditing, and system administration tasks by providing a way to interact with Windows hosts without requiring SMB or other traditional Windows networking protocols. It utilizes authentication methods like username/password, Kerberos, or certificates to establish a secure connection. `nxc-winrm` simplifies the process of remote command execution, file transfer, and other administrative functions. The command allows pentesters to run command-line tools to enumerate information, run exploits, and escalate privileges on Windows hosts. The tool requires proper credentials and an enabled WinRM service on the target Windows machines. This command provides features to execute scripts and cmd commands, and helps pentesters to run their tests effectively, especially useful when testing against hardened environments.
CAVEATS
WinRM must be enabled and properly configured on the target Windows systems. Firewall rules may block WinRM traffic. Incorrect credentials or authentication issues can prevent successful command execution. Privilege escalation may be required to execute certain commands.
AUTHENTICATION METHODS
Username/Password: Standard authentication using a username and password.
NTLM Hash: Authenticate using the NTLM hash of the password, avoiding the need to transmit the password in plain text.
Kerberos: Use Kerberos for authentication, providing a more secure method in domain environments.
TARGET SPECIFICATION
Targets can be specified as a single IP address, a hostname, a CIDR range (e.g., 192.168.1.0/24), or a file containing a list of targets, one per line.
ERROR HANDLING
Pay attention to the exit codes of executed command. Check for permission issues or any other connection issues. Validate connectivity before the command execution. Review the output of `nxc-winrm` for error messages and exceptions to troubleshoot connection or command execution problems.
HISTORY
The `nxc-winrm` command is part of the NetExec (formerly CrackMapExec) suite, a post-exploitation tool used in penetration testing. It evolved from a desire to have a more flexible and reliable way to interact with Windows hosts remotely, especially in environments where traditional SMB access is restricted. Its development has been driven by the needs of penetration testers and security auditors. Development started around 2016 and since it has been a popular choice among professionals.