goliath-normalize 0.2.18

Declarative source definitions that turn raw log records into OCSF events
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# The Windows Security event log, as `evtx_dump -o json` writes it: one JSON
# object per record, `Event.System` and `Event.EventData`, the same shape as
# the Sysmon definition reads.
#
# Kinds cover the audit events detections lean on most: logons and their
# failures, Kerberos tickets, process creation, changes to accounts,
# computer accounts, rights, and group membership, scheduled tasks, services
# installed, access to objects and network shares, directory changes, and
# the log being cleared. Every
# EventData member not mapped below is kept under `unmapped` by its Windows
# name, such as `ElevatedToken` or `TicketEncryptionType`.
#
# Windows writes `-` where a field has no value, such as the address of a
# local logon; such a field is left out rather than stored as `-`. Process
# and logon identifiers, written as `0x1a2c`, are read as numbers where OCSF
# holds a number.
#
# In process creation (4688), the subject is the account that started the
# process, which is the account the process runs as unless the event names
# another; it is written where Sysmon writes `User`, so that rules written
# for one match the other.

name: windows-security
version: 2
framing: json-values
decoding: json
nil: ["-"]

# The ATT&CK data components its records supply: those ATT&CK names for
# WinEventLog:Security, of the records the kinds below read.
data_components:
  - Logon Session Creation
  - Logon Session Metadata
  - User Account Authentication
  - Active Directory Credential Request
  - Process Creation
  - Command Execution
  - User Account Creation
  - User Account Deletion
  - User Account Modification
  - Scheduled Job Creation
  - Scheduled Job Modification
  - Service Creation
  - Active Directory Object Access
  - Active Directory Object Modification
  - Network Share Access
  - File Access
  - Windows Registry Key Access
  - Windows Registry Key Modification

common:
  time: { from: Event.System.TimeCreated.#attributes.SystemTime, as: timestamp }
  severity_id: { value: 1 }
  metadata.version: { value: "1.5.0" }
  metadata.product.name: { value: Windows Security Auditing }
  metadata.product.vendor_name: { value: Microsoft }
  metadata.log_name: Event.System.Channel
  metadata.uid: { from: Event.System.EventRecordID, as: string }
  metadata.event_code: { from: Event.System.EventID, as: string }
  device.hostname: Event.System.Computer
  device.os.type_id: { value: 100 }
  device.os.name: { value: Windows }

kinds:
  - name: logon
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4624
    # Authentication: Logon.
    class: { class_uid: 3002, activity_id: 1 }
    fields:
      status_id: { value: 1 }
      user.name: Event.EventData.TargetUserName
      user.domain: Event.EventData.TargetDomainName
      user.uid: Event.EventData.TargetUserSid
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
      actor.process.file.path: Event.EventData.ProcessName
      actor.process.pid: { from: Event.EventData.ProcessId, as: integer }
      session.uid: Event.EventData.TargetLogonId
      logon_type_id: &logon_type
        from: Event.EventData.LogonType
        # Windows numbers logon types as OCSF does.
        map:
          "0": 1
          "2": 2
          "3": 3
          "4": 4
          "5": 5
          "7": 7
          "8": 8
          "9": 9
          "10": 10
          "11": 11
          "12": 12
          "13": 13
        otherwise: 99
      logon_process.name: Event.EventData.LogonProcessName
      auth_protocol: Event.EventData.AuthenticationPackageName
      src_endpoint.hostname: Event.EventData.WorkstationName
      src_endpoint.ip: Event.EventData.IpAddress
      src_endpoint.port: { from: Event.EventData.IpPort, as: integer }
    unmapped: [Event.EventData]

  - name: logon_failure
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4625
    # Authentication: Logon.
    class: { class_uid: 3002, activity_id: 1 }
    fields:
      status_id: { value: 2 }
      # NTSTATUS codes, such as 0xC000006D; the sub-status says which check
      # failed, such as 0xC000006A for a wrong password.
      status_code: Event.EventData.Status
      status_detail: Event.EventData.SubStatus
      user.name: Event.EventData.TargetUserName
      user.domain: Event.EventData.TargetDomainName
      user.uid: Event.EventData.TargetUserSid
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
      actor.process.file.path: Event.EventData.ProcessName
      actor.process.pid: { from: Event.EventData.ProcessId, as: integer }
      logon_type_id: *logon_type
      logon_process.name: Event.EventData.LogonProcessName
      auth_protocol: Event.EventData.AuthenticationPackageName
      src_endpoint.hostname: Event.EventData.WorkstationName
      src_endpoint.ip: Event.EventData.IpAddress
      src_endpoint.port: { from: Event.EventData.IpPort, as: integer }
    unmapped: [Event.EventData]

  - name: explicit_credentials
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4648
    # Authentication: Logon, attempted by a process with credentials other
    # than its own, as `runas` does. Windows reports the attempt, not its
    # outcome.
    class: { class_uid: 3002, activity_id: 1 }
    fields:
      user.name: Event.EventData.TargetUserName
      user.domain: Event.EventData.TargetDomainName
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
      actor.process.file.path: Event.EventData.ProcessName
      actor.process.pid: { from: Event.EventData.ProcessId, as: integer }
      dst_endpoint.hostname: Event.EventData.TargetServerName
      src_endpoint.ip: Event.EventData.IpAddress
      src_endpoint.port: { from: Event.EventData.IpPort, as: integer }
    unmapped: [Event.EventData]

  - name: logoff
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4634
    # Authentication: Logoff.
    class: { class_uid: 3002, activity_id: 2 }
    fields:
      user.name: Event.EventData.TargetUserName
      user.domain: Event.EventData.TargetDomainName
      user.uid: Event.EventData.TargetUserSid
      session.uid: Event.EventData.TargetLogonId
      logon_type_id: *logon_type
    unmapped: [Event.EventData]

  - name: user_logoff
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4647
    # Authentication: Logoff, as the user asked for it.
    class: { class_uid: 3002, activity_id: 2 }
    fields:
      user.name: Event.EventData.TargetUserName
      user.domain: Event.EventData.TargetDomainName
      user.uid: Event.EventData.TargetUserSid
      session.uid: Event.EventData.TargetLogonId
    unmapped: [Event.EventData]

  - name: credential_validation
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4776
    # Authentication: Logon, as the computer holding the account checked a
    # password with NTLM. `Status` is 0x0 when it was right.
    class: { class_uid: 3002, activity_id: 1 }
    fields:
      status_code: Event.EventData.Status
      status_id: { from: Event.EventData.Status, map: { "0x0": 1 }, otherwise: 2 }
      user.name: Event.EventData.TargetUserName
      auth_protocol: Event.EventData.PackageName
      src_endpoint.hostname: Event.EventData.Workstation
    unmapped: [Event.EventData]

  - name: kerberos_ticket
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4768
    # Authentication: Authentication Ticket.
    class: { class_uid: 3002, activity_id: 3 }
    fields: &kerberos
      # A Kerberos result code: 0x0 is success.
      status_code: Event.EventData.Status
      status_id: { from: Event.EventData.Status, map: { "0x0": 1 }, otherwise: 2 }
      user.name: Event.EventData.TargetUserName
      user.domain: Event.EventData.TargetDomainName
      user.uid: Event.EventData.TargetSid
      service.name: Event.EventData.ServiceName
      service.uid: Event.EventData.ServiceSid
      src_endpoint.ip: Event.EventData.IpAddress
      src_endpoint.port: { from: Event.EventData.IpPort, as: integer }
    unmapped: [Event.EventData]

  - name: kerberos_service_ticket
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4769
    # Authentication: Service Ticket Request.
    class: { class_uid: 3002, activity_id: 4 }
    fields: *kerberos
    unmapped: [Event.EventData]

  - name: kerberos_pre_authentication_failure
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4771
    # Authentication: Preauth, which this event reports only when it failed.
    class: { class_uid: 3002, activity_id: 6 }
    fields: *kerberos
    unmapped: [Event.EventData]

  - name: process_creation
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4688
    # Process Activity: Launch.
    class: { class_uid: 1007, activity_id: 1 }
    fields:
      process.file.path: Event.EventData.NewProcessName
      process.cmd_line: Event.EventData.CommandLine
      process.pid: { from: Event.EventData.NewProcessId, as: integer }
      process.user.name: Event.EventData.SubjectUserName
      process.user.domain: Event.EventData.SubjectDomainName
      process.user.uid: Event.EventData.SubjectUserSid
      process.session.uid: Event.EventData.SubjectLogonId
      process.parent_process.file.path: Event.EventData.ParentProcessName
      process.parent_process.pid: { from: Event.EventData.ProcessId, as: integer }
    unmapped: [Event.EventData]

  - name: account_created
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4720
    # Account Change: Create.
    class: { class_uid: 3001, activity_id: 1 }
    fields: &account
      user.name: Event.EventData.TargetUserName
      user.domain: Event.EventData.TargetDomainName
      user.uid: Event.EventData.TargetSid
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: account_enabled
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4722
    # Account Change: Enable.
    class: { class_uid: 3001, activity_id: 2 }
    fields: *account
    unmapped: [Event.EventData]

  - name: password_changed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4723
    # Account Change: Password Change.
    class: { class_uid: 3001, activity_id: 3 }
    fields: *account
    unmapped: [Event.EventData]

  - name: password_reset
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4724
    # Account Change: Password Reset.
    class: { class_uid: 3001, activity_id: 4 }
    fields: *account
    unmapped: [Event.EventData]

  - name: account_disabled
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4725
    # Account Change: Disable.
    class: { class_uid: 3001, activity_id: 5 }
    fields: *account
    unmapped: [Event.EventData]

  - name: account_deleted
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4726
    # Account Change: Delete.
    class: { class_uid: 3001, activity_id: 6 }
    fields: *account
    unmapped: [Event.EventData]

  - name: computer_account_created
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4741
    # Account Change: Create, of a computer account such as `WS-12$`.
    class: { class_uid: 3001, activity_id: 1 }
    fields: *account
    unmapped: [Event.EventData]

  - name: computer_account_deleted
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4743
    # Account Change: Delete, of a computer account.
    class: { class_uid: 3001, activity_id: 6 }
    fields: *account
    unmapped: [Event.EventData]

  - name: account_changed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4738
    # Account Change: Other. What changed, such as `UserAccountControl` or
    # `AllowedToDelegateTo`, is kept as Windows writes it.
    class: { class_uid: 3001, activity_id: 99 }
    fields: *account
    unmapped: [Event.EventData]

  - name: computer_account_changed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4742
    # Account Change: Other, of a computer account.
    class: { class_uid: 3001, activity_id: 99 }
    fields: *account
    unmapped: [Event.EventData]

  - name: right_assigned
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4704
    # Account Change: Attach Policy. The rights assigned, such as
    # `SeDebugPrivilege`, are the policy.
    class: { class_uid: 3001, activity_id: 7 }
    fields:
      user.uid: Event.EventData.TargetSid
      policy.name: Event.EventData.PrivilegeList
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: account_locked
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4740
    # Account Change: Lock.
    class: { class_uid: 3001, activity_id: 9 }
    fields:
      user.name: Event.EventData.TargetUserName
      user.uid: Event.EventData.TargetSid
      # In this event, `TargetDomainName` is the computer the failed logons
      # came from, not the account's domain.
      src_endpoint.hostname: Event.EventData.TargetDomainName
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: global_group_member_added
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4728
    # Group Management: Add User.
    class: { class_uid: 3006, activity_id: 3 }
    fields: &member
      # The member's distinguished name, or `-` for a local account.
      user.name: Event.EventData.MemberName
      user.uid: Event.EventData.MemberSid
      group.name: Event.EventData.TargetUserName
      group.domain: Event.EventData.TargetDomainName
      group.uid: Event.EventData.TargetSid
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: local_group_member_added
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4732
    # Group Management: Add User.
    class: { class_uid: 3006, activity_id: 3 }
    fields: *member
    unmapped: [Event.EventData]

  - name: universal_group_member_added
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4756
    # Group Management: Add User.
    class: { class_uid: 3006, activity_id: 3 }
    fields: *member
    unmapped: [Event.EventData]

  - name: global_group_member_removed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4729
    # Group Management: Remove User.
    class: { class_uid: 3006, activity_id: 4 }
    fields: *member
    unmapped: [Event.EventData]

  - name: local_group_member_removed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4733
    # Group Management: Remove User.
    class: { class_uid: 3006, activity_id: 4 }
    fields: *member
    unmapped: [Event.EventData]

  - name: universal_group_member_removed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4757
    # Group Management: Remove User.
    class: { class_uid: 3006, activity_id: 4 }
    fields: *member
    unmapped: [Event.EventData]

  - name: global_group_created
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4727
    # Group Management: Create.
    class: { class_uid: 3006, activity_id: 6 }
    fields: &group
      group.name: Event.EventData.TargetUserName
      group.domain: Event.EventData.TargetDomainName
      group.uid: Event.EventData.TargetSid
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: local_group_created
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4731
    # Group Management: Create.
    class: { class_uid: 3006, activity_id: 6 }
    fields: *group
    unmapped: [Event.EventData]

  - name: universal_group_created
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4754
    # Group Management: Create.
    class: { class_uid: 3006, activity_id: 6 }
    fields: *group
    unmapped: [Event.EventData]

  - name: global_group_deleted
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4730
    # Group Management: Delete.
    class: { class_uid: 3006, activity_id: 5 }
    fields: *group
    unmapped: [Event.EventData]

  - name: local_group_deleted
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4734
    # Group Management: Delete.
    class: { class_uid: 3006, activity_id: 5 }
    fields: *group
    unmapped: [Event.EventData]

  - name: universal_group_deleted
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4758
    # Group Management: Delete.
    class: { class_uid: 3006, activity_id: 5 }
    fields: *group
    unmapped: [Event.EventData]

  - name: scheduled_task_created
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4698
    # Scheduled Job Activity: Create. The task's XML, with its actions and
    # triggers, is kept under `unmapped` as `TaskContent`.
    class: { class_uid: 1006, activity_id: 1 }
    fields:
      job.name: Event.EventData.TaskName
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: scheduled_task_deleted
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4699
    # Scheduled Job Activity: Delete.
    class: { class_uid: 1006, activity_id: 3 }
    fields: &task
      job.name: Event.EventData.TaskName
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: scheduled_task_enabled
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4700
    # Scheduled Job Activity: Enable.
    class: { class_uid: 1006, activity_id: 4 }
    fields: *task
    unmapped: [Event.EventData]

  - name: scheduled_task_disabled
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4701
    # Scheduled Job Activity: Disable.
    class: { class_uid: 1006, activity_id: 5 }
    fields: *task
    unmapped: [Event.EventData]

  - name: scheduled_task_updated
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4702
    # Scheduled Job Activity: Update. The new XML is `TaskContentNew`.
    class: { class_uid: 1006, activity_id: 2 }
    fields: *task
    unmapped: [Event.EventData]

  - name: service_installed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4697
    # Windows Service Activity: Create.
    class: { class_uid: 201004, activity_id: 1 }
    fields:
      win_service.name: Event.EventData.ServiceName
      # The image and its arguments, as the service will be started.
      win_service.cmd_line: Event.EventData.ServiceFileName
      win_service.service_start_name: Event.EventData.ServiceAccount
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: object_handle_requested
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4656
    # Windows Resource Activity: Access. The rights asked for are kept as
    # Windows writes them, `AccessMask` and `AccessList`.
    class: { class_uid: 201003, activity_id: 1 }
    fields: &object
      win_resource.name: Event.EventData.ObjectName
      win_resource.type: Event.EventData.ObjectType
      win_resource.uid: Event.EventData.HandleId
      actor.process.file.path: Event.EventData.ProcessName
      actor.process.pid: { from: Event.EventData.ProcessId, as: integer }
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: object_accessed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4663
    # Windows Resource Activity: Access.
    class: { class_uid: 201003, activity_id: 1 }
    fields: *object
    unmapped: [Event.EventData]

  - name: directory_object_operation
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4662
    # Windows Resource Activity: Access, to an Active Directory object. The
    # rights and properties used, `AccessMask` and `Properties`, are kept
    # as Windows writes them: replication rights there are how a directory
    # being copied out shows.
    class: { class_uid: 201003, activity_id: 1 }
    fields: *object
    unmapped: [Event.EventData]

  - name: sam_handle_requested
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4661
    # Windows Resource Activity: Access, to a SAM object such as a user or
    # a domain.
    class: { class_uid: 201003, activity_id: 1 }
    fields: *object
    unmapped: [Event.EventData]

  - name: registry_value_modified
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 4657
    # Windows Resource Activity: Access, to a registry key. The value and
    # its data, `ObjectValueName`, `OldValue`, and `NewValue`, are kept as
    # Windows writes them.
    class: { class_uid: 201003, activity_id: 1 }
    fields: *object
    unmapped: [Event.EventData]

  - name: share_accessed
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 5140
    # SMB Activity: Other. The SMB activities OCSF names are file
    # operations, and a share being connected to is none of them.
    class: { class_uid: 4006, activity_id: 99 }
    fields:
      share: Event.EventData.ShareName
      src_endpoint.ip: Event.EventData.IpAddress
      src_endpoint.port: { from: Event.EventData.IpPort, as: integer }
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: share_file_checked
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 5145
    # SMB Activity: Other. Windows checked whether a file on a share may be
    # accessed; the file is named relative to the share.
    class: { class_uid: 4006, activity_id: 99 }
    fields:
      share: Event.EventData.ShareName
      file.path: Event.EventData.RelativeTargetName
      src_endpoint.ip: Event.EventData.IpAddress
      src_endpoint.port: { from: Event.EventData.IpPort, as: integer }
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: directory_object_modified
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Security-Auditing
      Event.System.EventID: 5136
    # Entity Management: Update. Which attribute changed and how,
    # `AttributeLDAPDisplayName`, `AttributeValue`, and `OperationType`,
    # are kept as Windows writes them.
    class: { class_uid: 3004, activity_id: 3 }
    fields:
      entity.name: Event.EventData.ObjectDN
      entity.uid: Event.EventData.ObjectGUID
      entity.type: Event.EventData.ObjectClass
      actor.user.name: Event.EventData.SubjectUserName
      actor.user.domain: Event.EventData.SubjectDomainName
      actor.user.uid: Event.EventData.SubjectUserSid
    unmapped: [Event.EventData]

  - name: log_cleared
    when:
      Event.System.Provider.#attributes.Name: Microsoft-Windows-Eventlog
      Event.System.EventID: 1102
    # Event Log Activity: Clear.
    class: { class_uid: 1008, activity_id: 1 }
    fields:
      actor.user.name: Event.UserData.LogFileCleared.SubjectUserName
      actor.user.domain: Event.UserData.LogFileCleared.SubjectDomainName
      actor.user.uid: Event.UserData.LogFileCleared.SubjectUserSid
    unmapped: [Event.UserData.LogFileCleared]