Skip to content
WETNav

Credential access · Windows

setspn.exe

SetSPN

Reads and edits service principal names on AD accounts. Listing SPNs across the domain finds service accounts that can be Kerberoasted.

Legitimate use

Admins use it to register SPNs for services such as SQL Server and IIS.

Worst caseMedium

Switches

-q<value>

Queries for SPNs that match a pattern. Wildcards search the whole forest.

Medium
-l<value>

Lists the SPNs on one account.

Low
-t<value>

Limits a query to a domain.

Low
-s

Adds an SPN after checking for duplicates.

Medium
-a

Adds an SPN without checking for duplicates.

Medium
-d

Deletes an SPN.

Medium
-x

Reports duplicate SPNs.

Low

Command lines to worry about

  • Medium

    Domain-wide SPN listing

    Lists every SPN in the domain. This is the usual first step before Kerberoasting. Look for a burst of 4769 events with RC4 encryption.

    Detection regexsetspn(\.exe)?\s+.*-q\s+\*\/\*

    T1558.003

Where it is recorded

  • Security4688Process creation with the full command line, when command-line auditing is enabled.
  • Sysmon1Process creation with command line, hashes and parent process.
  • Security4769Kerberos service tickets requested on the DC. Many requests with encryption type 0x17 follow SPN enumeration in Kerberoasting.

Community detections

1 SigmaHQ rule for setspn.exe. The explainer checks every pasted command line against all of them.

Rules from SigmaHQ (rules/windows/process_creation), Detection Rule License (DRL) 1.1. Each rule links to its source and credits its authors.