Author: Andrew Rathbun
Description: The name of an account was changed
EventId: 4781
Channel: Security
Provider: Microsoft-Windows-Security-Auditing
Maps:
  -
    Property: UserName
    PropertyValue: "%domain%\\%user% (%sid%)"
    Values:
      -
        Name: domain
        Value: "/Event/EventData/Data[@Name=\"SubjectDomainName\"]"
      -
        Name: user
        Value: "/Event/EventData/Data[@Name=\"SubjectUserName\"]"
      -
        Name: sid
        Value: "/Event/EventData/Data[@Name=\"SubjectUserSid\"]"
  -
    Property: PayloadData1
    PropertyValue: "OldTargetUserName: %OldTargetUserName%"
    Values:
      -
        Name: OldTargetUserName
        Value: "/Event/EventData/Data[@Name=\"OldTargetUserName\"]"
  -
    Property: PayloadData2
    PropertyValue: "NewTargetUserName: %NewTargetUserName%"
    Values:
      -
        Name: NewTargetUserName
        Value: "/Event/EventData/Data[@Name=\"NewTargetUserName\"]"
  -
    Property: PayloadData3
    PropertyValue: "TargetDomainName: %TargetDomainName%"
    Values:
      -
        Name: TargetDomainName
        Value: "/Event/EventData/Data[@Name=\"TargetDomainName\"]"
  -
    Property: PayloadData4
    PropertyValue: "TargetSid: %TargetSid%"
    Values:
      -
        Name: TargetSid
        Value: "/Event/EventData/Data[@Name=\"TargetSid\"]"

# Documentation:
# https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4781
# https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4781
# https://github.com/nasbench/EVTX-ETW-Resources/blob/main/ETWProvidersCSVs/Internal/Microsoft-Windows-Security-Auditing.csv
#
# Example Event Data:
# <Event>
#  <System>
#    <Provider Name="Microsoft-Windows-Security-Auditing" Guid="54856625-5478-7794-a5ba-3e3b0328c30d" />
#    <EventID>4781</EventID>
#    <Version>0</Version>
#    <Level>0</Level>
#    <Task>13784</Task>
#    <Opcode>0</Opcode>
#    <Keywords>0x8020000000000000</Keywords>
#    <TimeCreated SystemTime="2020-10-02 02:02:00.0351195" />
#    <EventRecordID>210012591</EventRecordID>
#    <Correlation ActivityID="f145a4ae-985f-0000-a1a4-61h15f98d601" />
#    <Execution ProcessID="774" ThreadID="768" />
#    <Channel>Security</Channel>
#    <Computer>hostname</Computer>
#    <Security />
#  </System>
#  <EventData>
#    <Data Name="OldTargetUserName">Administrators</Data>
#    <Data Name="NewTargetUserName">Administrators</Data>
#    <Data Name="TargetDomainName">Builtin</Data>
#    <Data Name="TargetSid">S-1-5-32-123</Data>
#    <Data Name="SubjectUserSid">S-1-5-18</Data>
#    <Data Name="SubjectUserName">username</Data>
#    <Data Name="SubjectDomainName">domain</Data>
#    <Data Name="SubjectLogonId">0x3E7</Data>
#    <Data Name="PrivilegeList">-</Data>
#  </EventData>
# </Event>
