Fix KRB_AP_ERR_MODIFIED and Kerberos event 4: the server cannot decrypt the service ticket because its SPN is on the wrong account or registered twice. Find it with setspn -Q or setspn -X, move it with setspn -D and -S.
Home › Guides › KRB_AP_ERR_MODIFIED
Last updated 18 November 2026
KRB_AP_ERR_MODIFIED means the target server could not decrypt the Kerberos service ticket the client sent it. The domain controller encrypts a service ticket with the password of the account that holds the requested service principal name (SPN). If that SPN is on the wrong account, or on two accounts, the ticket is encrypted with a key the service doesn't have, and the user typically gets access denied (error 5). Microsoft's fix, from an elevated prompt with Enterprise Administrator credentials:
setspn -Q <SPN> setspn -D <SPN> <computername> setspn -S <SPN> <computername of computer which had the System event 4>
That is: find which account holds the SPN, delete it from the wrong account, and add it to the account the service really runs as. setspn is installed with the AD DS role or with RSAT.
Microsoft-Windows-Security-Kerberos, has a longer text: This indicates that the target server failed to decrypt the ticket provided by the client. This can occur when the target server principal name (SPN) is registered on an account other than the account the target service is using. Please ensure that the target SPN is registered on, and only registered on, the account used by the server.KRB_ERROR whose error code is KRB_AP_ERR_MODIFIED (41). RFC 4120 lists error 41 as Message stream modified; the Microsoft 4769 table writes the same code in hex as 0x29.Microsoft's KB says the client puts event 4 in its System event log, and names the server in the event text. Look up event 4 and the other Kerberos IDs in the Windows Event ID Lookup.
| Cause | What goes wrong |
|---|---|
| SPN on the wrong account | The ticket is encrypted with the secret of the account the SPN is on, not the server's, so the server can't decrypt it (Microsoft KB 2706695). |
| Duplicate SPN | The same SPN is on two accounts, A and B. The KDC may encrypt with A's password while the service tries to decrypt with B's. |
| Wrong or out-of-date DNS | The 4769 page lists the client sending the request to the wrong server because DNS data was incorrect or out-of-date on the client. |
| Identically named accounts | Two computers with the same name in different domains (the KB event text mentions identically named machine accounts in the target realm and the client realm). |
| Client asks for the wrong SPN (CNAME) | When a web site name is a DNS CNAME, the client can request the SPN of the host the alias points to (HTTP/iis01.test.com instead of HTTP/contoso.test.com). |
| IIS kernel-mode authentication | Kernel-mode authentication (the IIS 7+ default) decrypts with the machine account no matter which account runs the application pool, so an SPN registered on a domain service account doesn't match. |
| Password out of sync | The service uses a different password for its account than the KDC has (from the event 4 text in the IIS Support Blog example). |
Microsoft also notes that, less commonly, network problems between client and server truncate the ticket.
An SPN has the form serviceclass/host:port/servicename; the port and service name are only needed when they aren't standard. Query it (-Q) or search for duplicates (-X):
setspn -Q http/server1.contoso.com setspn -T * -T contoso -X setspn -T contoso -F -Q */MyServer
The second command is Microsoft's example for all duplicate SPNs in your domain and the contoso domain; the third finds all SPNs for MyServer in the contoso forest. -F runs the query at forest level, -T picks the domain (or forest with -F) and can be repeated, and -X returns duplicates that exist across all targets. Microsoft notes that SPNs aren't required to be unique across forests, but duplicates can cause authentication issues during cross-forest authentication.
Check the HOST/ SPN too. HOST/ is used as the fallback when no HTTP/ SPN exists, and a host SPN can stand in for many built-in service classes (cifs, http, rpcss and others) unless they are placed on objects explicitly. To list what an account already has:
setspn -L <accountname> Get-ADComputer -Identity ComputerName -Properties ServicePrincipalName | Select-Object -ExpandProperty ServicePrincipalName Get-ADUser -Identity UserName -Properties ServicePrincipalName | Select-Object -ExpandProperty ServicePrincipalName
On the domain controller side, Microsoft's directory services team shows duplicate SPNs surfacing as a KDC event 11 in the DC's System log.
setspn -D http/server1.contoso.com server1 setspn -S http/myserver.mydomain.com myDomain\myServer setspn -U -S http/MyServer User01
-D deletes the SPN from the wrong account. -S adds it after verifying that no duplicates exist; Microsoft says to use -S instead of -A for that reason. -U and -C say the account is a user or a computer (they are exclusive). If an account's computer SPNs look wrong, setspn -R <hostname> resets the default registrations. The PowerShell equivalent of adding one:
$userID = "UserName"
$spn = "HTTP/webserver.domain.com"
Set-ADUser -Identity $userID -Add @{ServicePrincipalName=$spn}
You need Domain Admins or Enterprise Admins membership, or the Validated write to service principal name permission on the object. Which account is "right" depends on the service:
MSSQLSvc SPNs left on the computer account after the service was moved from Local System to a domain account, so they exist on both.useAppPoolCredentials="true" so IIS uses the application pool identity, and keep the SPN on the service account.nslookup for internal-only names.The IIS Support Blog's data collection starts with clearing the client's cached tickets and DNS cache before reproducing:
klist purge ipconfig /flushdns
Then reproduce the access. If event 4 comes back, read the target name in the event and run setspn -Q on exactly that name. Generate a strong password for a new service account with the UUID / Password Generator and keep the setspn and AD cmdlets in the PowerShell Cheat Sheet.
Event 4769 (A Kerberos service ticket was requested) is generated only on domain controllers, each time the KDC gets a TGS request. A failure shows a Failure Code other than 0x0. In Microsoft's description of this error, the DC issues the ticket and it is the target server that can't decrypt it, so start from event 4 on the client and the target name in it. The 4769 codes that point at SPN problems:
| Code | Name | Microsoft's description |
|---|---|---|
| 0x7 | KDC_ERR_S_PRINCIPAL_UNKNOWN | Server not found in Kerberos database: the DC can't find the server's name in Active Directory. |
| 0x8 | KDC_ERR_PRINCIPAL_NOT_UNIQUE | Multiple principal entries in KDC database: duplicate principal names exist. |
| 0x1B | KDC_ERR_MUST_USE_USER2USER | Server principal valid for user2user only: the service is missing an SPN. |
| 0x20 | KRB_AP_ERR_TKT_EXPIRED | The ticket has expired. Microsoft says you'll typically see many of these and they have little to no security relevance. |
| 0x29 | KRB_AP_ERR_MODIFIED | Message stream modified and checksum didn't match: the authentication data was encrypted with the wrong key for the intended server, modified in transit, or sent to the wrong server because of incorrect or out-of-date DNS data. |
Some errors are only reported when the KdcExtraLogLevel registry value has the right flag set: 0x01 audits SPN unknown errors and 0x10 logs encryption type and bad options errors. Test filters for exported 4769 or event 4 text in the Regex Tester.
Look up Kerberos event 4, 4769 and related IDs in the Windows Event ID Lookup, keep setspn, Get-ADComputer and Set-ADUser examples in the PowerShell Cheat Sheet, test filters for exported event text in the Regex Tester and create a strong service account password with the UUID / Password Generator. Related guides: Event ID 4625 status and sub status codes (includes the 4771 Kerberos codes) and Netlogon event 5719.
The target server could not decrypt the Kerberos service ticket the client sent it. The ticket was encrypted with the password of a different account than the one the service uses, most often because the SPN is registered on the wrong account or on two accounts. RFC 4120 lists it as error 41, Message stream modified (0x29 in hex).
Run setspn -Q with the SPN to see which account holds it, or setspn -X to search for duplicates. Microsoft's example setspn -T * -T contoso -X checks your domain and the contoso domain; add -F to query at forest level. Check the HOST/ SPN as well as HTTP/.
Read the target name in the event, find the account that holds that SPN with setspn -Q, remove it from the wrong account with setspn -D and add it to the account the service runs as with setspn -S. Then run klist purge on the client and try again.
setspn -S adds the SPN only after verifying that no duplicates exist. Microsoft's setspn reference says to use -S instead of -A for that reason.
With kernel-mode authentication (the IIS 7+ default) the ticket is decrypted with the machine account, whatever account runs the application pool. Either register the HTTP SPN on the computer account or set useAppPoolCredentials to true so IIS uses the application pool identity.
Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.