Overview
impacket-atexec executes commands on a remote Windows host by creating a scheduled task via the ATSVC (Task Scheduler) named pipe. The command output is written to a temp file on the target and retrieved over SMB.
Useful when other execution methods (psexec, wmiexec, smbexec) are blocked but the Task Scheduler service is still accessible.
Authentication
| Method | Flag | Example |
|---|---|---|
| Password | domain/user:password | CORP/admin:Password1 |
| NTLM hash | -hashes | -hashes :aad3b435b51404eeaad3b435b51404ee |
| Kerberos | -k -no-pass | -k -no-pass -dc-ip 10.10.10.1 |
Basic Usage
Execute a command and get output:How It Works
- Authenticates to the target over SMB (port 445)
- Connects to the ATSVC named pipe (Task Scheduler RPC interface)
- Creates a scheduled task set to execute immediately
- The task runs
cmd.exe /C <command> > %windir%\Temp\<random>.tmp 2>&1 - Reads the output file from the
ADMIN$share (ADMIN$\Temp\<random>.tmp, i.e.C:\Windows\Temp) over SMB - Deletes the output file and the scheduled task
OPSEC
| Artifact | Details |
|---|---|
| Event 4698 | Scheduled task created (Security log) |
| Event 4702 | Scheduled task updated (Security log) |
| Event 4699 | Scheduled task deleted (Security log) |
| Event 106 | Task registered (Task Scheduler log) |
| Event 141 | Task removed (Task Scheduler log) |
| Temp file | Output written to C:\Windows\Temp\<random>.tmp |
| Process | cmd.exe spawned by svchost.exe (Task Scheduler) |
Pass-the-Hash
Kerberos Authentication
Requires a valid TGT in theKRB5CCNAME environment variable.
When to Use atexec
| Scenario | Why atexec |
|---|---|
| PsExec blocked | Target blocks service creation but Task Scheduler runs |
| WMI blocked | Firewall blocks WMI (DCOM) ports 135/49152+ |
| SMBExec detected | EDR flags smbexec’s service creation pattern |
| Need single command | Quick one-off command execution without a shell |
| Lateral movement | Alternative pivot method when standard tools fail |
wmiexec or smbexec.