Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / ACTIVE DIRECTORY / LATERAL MOVEMENT / EXEC

PsExec

This note documents detection patterns related to PsExec within Active Directory environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security4624Successful logonHighNetwork logon using administrative credentials.
Security4672Special privileges assignedHighAdmin privileges used during remote execution.
Security7045Service installedCriticalPsExec installs a temporary service (often PSEXESVC).
Security5140Network share accessedHighADMIN$ share accessed to drop service binary.
Sysmon1Process creationHighcmd.exe spawned from service context.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
PSEXESVC service creationTemporary service installedCriticalClassic PsExec artifact.
ADMIN$ share writeBinary dropped remotelyHighUsed for service payload.
Service created then removedShort-lived service executionHighCommon PsExec behavior.

Common Tools

ToolUsage
Sysinternals PsExecNative remote command execution tool.
Impacket psexec.pyPython implementation used in attacks.
CrackMapExecAutomates PsExec-style execution.
Metasploit psexec modulesUsed for lateral movement.

Relevant Artifacts

  • Security logs (4624, 4672, 7045)
  • Service control manager logs
  • ADMIN$ share access logs
  • Sysmon process creation
  • EDR telemetry

MITRE ATT&CK References

  • T1021.002 SMB/Windows Admin Shares
  • T1569.002 Service Execution

Decision Tree

  1. Detect service installation event.
  2. Identify service name (e.g., PSEXESVC).
  3. Identify source host initiating connection.
  4. Inspect spawned command process.
  5. Determine lateral movement scope.

Example Detection Templates

KQL

SecurityEvent
| where EventID == 7045
| where ServiceName contains "PSEXESVC"

EQL

process where event.code == "7045"

Sigma

title: PsExec Service Installation
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 7045
    ServiceName|contains: PSEXESVC
  condition: selection
level: high

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Admin share controlRestrict ADMIN$ usageHighLimits remote execution.
Service monitoringAlert on service installsHighDetects lateral movement.
Credential hygieneLimit admin reuseCriticalPrevents propagation.