Author: Mike Pilkington
Description: Attempt was made to access an object
EventId: 4663
Channel: Security
Provider: Microsoft-Windows-Security-Auditing
Maps:
  -
    Property: UserName
    PropertyValue: "%domain%\\%user%"
    Values:
      -
        Name: domain
        Value: "/Event/EventData/Data[@Name=\"SubjectDomainName\"]"
      -
        Name: user
        Value: "/Event/EventData/Data[@Name=\"SubjectUserName\"]"
  -
    Property: PayloadData1
    PropertyValue: "ObjectServer: %ObjectServer%"
    Values:
      -
        Name: ObjectServer
        Value: "/Event/EventData/Data[@Name=\"ObjectServer\"]"
  -
    Property: PayloadData2
    PropertyValue: "ObjectType: %ObjectType%"
    Values:
      -
        Name: ObjectType
        Value: "/Event/EventData/Data[@Name=\"ObjectType\"]"
  -
    Property: PayloadData3
    PropertyValue: "ObjectName: %ObjectName%"
    Values:
      -
        Name: ObjectName
        Value: "/Event/EventData/Data[@Name=\"ObjectName\"]"
  -
    Property: PayloadData4
    PropertyValue: "AccessList: %AccessList%"
    Values:
      -
        Name: AccessList
        Value: "/Event/EventData/Data[@Name=\"AccessList\"]"
  -
    Property: ExecutableInfo
    PropertyValue: "%ProcessName%"
    Values:
      -
        Name: ProcessName
        Value: "/Event/EventData/Data[@Name=\"ProcessName\"]"

Lookups:
  -
    Name: AccessList
    Default: Unknown code
    Values:
      "%%4416": ReadData (or ListDirectory)
      "%%4417": WriteData (or AddFile)
      "%%4418": AppendData (or AddSubdirectory or CreatePipeInstance)
      "%%4419": ReadEA (or Enumerate SubKeys)
      "%%4420": WriteEA
      "%%4421": Execute/Traverse
      "%%4422": DeleteChild
      "%%4423": ReadAttributes
      "%%4424": WriteAttributes
      "%%1537": DELETE
      "%%1538": READ_CONTROL
      "%%1539": WRITE_DAC
      "%%1540": WRITE_OWNER
      "%%1541": SYNCHRONIZE
      "%%1542": ACCESS_SYS_SEC

# Documentation:
# https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4663
# https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4663
# https://github.com/nasbench/EVTX-ETW-Resources/blob/main/ETWProvidersCSVs/Internal/Microsoft-Windows-Security-Auditing.csv
#
# Example Event Data:
# <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
# <System>
# <Provider Name="Microsoft-Windows-Security-Auditing" Guid="{54849625-5478-4994-A5BA-3E3B0328C30D}" />
# <EventID>4663</EventID>
# <Version>1</Version>
# <Level>0</Level>
# <Task>12800</Task>
# <Opcode>0</Opcode>
# <Keywords>0x8020000000000000</Keywords>
# <TimeCreated SystemTime="2015-09-18T22:13:54.770429700Z" />
# <EventRecordID>273866</EventRecordID>
# <Correlation />
# <Execution ProcessID="516" ThreadID="524" />
# <Channel>Security</Channel>
# <Computer>DC01.contoso.local</Computer>
# <Security />
# </System>
# <EventData>
# <Data Name="SubjectUserSid">S-1-5-21-3457937927-2839227994-823803824-1104</Data>
# <Data Name="SubjectUserName">dadmin</Data>
# <Data Name="SubjectDomainName">CONTOSO</Data>
# <Data Name="SubjectLogonId">0x4367b</Data>
# <Data Name="ObjectServer">Security</Data>
# <Data Name="ObjectType">File</Data>
# <Data Name="ObjectName">C:\\Documents\\HBI Data.txt</Data>
# <Data Name="HandleId">0x1bc</Data>
# <Data Name="AccessList">%%4417 %%4418</Data>
# <Data Name="AccessMask">0x6</Data>
# <Data Name="ProcessId">0x458</Data>
# <Data Name="ProcessName">C:\\Windows\\System32\\notepad.exe</Data>
# <Data Name="ResourceAttributes">S:AI(RA;ID;;;;WD;("Impact\_MS",TI,0x10020,3000))</Data>
# </EventData>
# </Event>
