Overview
impacket-psexec uploads an executable to the ADMIN$ share, creates a Windows service to run it, and returns a SYSTEM-level interactive shell over SMB (port 445). It is the noisiest of the Impacket exec tools but provides full interactive access.
Authentication Methods
| Method | Flag | Example |
|---|---|---|
| Password | (default) | domain/user:password@target |
| NTLM hash | -hashes | -hashes :NT_HASH |
| Kerberos | -k -no-pass | -k -no-pass -dc-ip DC_IP |
| AES key | -aesKey | -aesKey AES256_KEY |
Basic Usage — Interactive Shell
Execute Specific Command
How It Works
- Authenticates to the target via SMB (port 445).
- Connects to the
ADMIN$share (C:\Windows). - Uploads a service binary (
RemComSvc) toADMIN$. - Creates a Windows service pointing to the uploaded binary via the Service Control Manager (SCM).
- Starts the service, which spawns
cmd.exeas SYSTEM. - Communicates I/O through named pipes over SMB.
- On exit, stops the service, deletes it, and removes the uploaded binary.
OPSEC Considerations
| Indicator | Detail |
|---|---|
| Service creation | Creates RemComSvc service (event 7045) |
| Binary on disk | Writes executable to C:\Windows |
| Event logs | Service install in System log, logon in Security log (4624 type 3) |
| Detection | Easily flagged by EDR/AV — binary is well-signatured |
| Noise level | High — most detectable of the three exec tools |
- System Event ID 7045 (new service installed)
- Security Event ID 4624 (network logon type 3)
- Security Event ID 4672 (special privileges assigned)
- File creation under
C:\Windows\
Pass-the-Hash
Kerberos Authentication
Requires a valid ccache file or keytab.Target Specific Port
Common Errors and Fixes
| Error | Cause | Fix |
|---|---|---|
STATUS_ACCESS_DENIED | User lacks local admin or ADMIN$ access | Verify local admin membership |
STATUS_SHARING_VIOLATION | Previous RemComSvc binary not cleaned up | Manually delete from C:\Windows |
ERROR_SERVICE_EXISTS | Stale service from previous run | sc.exe delete RemComSvc on target |
Connection refused | SMB port 445 blocked | Check firewall, try -port |
KDC_ERR_PREAUTH_FAILED | Wrong password or expired ticket | Verify creds, regenerate ccache |
SessionError: STATUS_LOGON_FAILURE | Incorrect credentials | Double-check password/hash |
| Hangs after connection | AV/EDR killed the uploaded binary | Try wmiexec or smbexec instead |