Skip to content

Cherry-pick #17517 to 7.x: Add Kerberos Events - Other Logon Events - ECS event Categories and Types#18174

Merged
andrewkroh merged 1 commit intoelastic:7.xfrom
andrewkroh:backport_17517_7.x
May 4, 2020
Merged

Cherry-pick #17517 to 7.x: Add Kerberos Events - Other Logon Events - ECS event Categories and Types#18174
andrewkroh merged 1 commit intoelastic:7.xfrom
andrewkroh:backport_17517_7.x

Conversation

@andrewkroh
Copy link
Copy Markdown
Member

Cherry-pick of PR #17517 to 7.x branch. Original message:

Added Kerberos Tickets Events (4768,4769,4770,4771,4776), aditional logon events (4778,4779,4964), sensitive privilege use events (4673,4674), service and task scheduler events (4697,4698,4699,4700,4701,4702)

Event categories, types and outcome were aligned to the ones defined in ECS 1.5

Other minor fixes/improvements introduced

New Events
The new events are commonly used when analyzing lateral movements
Sources:
https://www.jpcert.or.jp/english/pub/sr/20170612ac-ir_research_en.pdf
https://www.sans.org/security-resources/posters/dfir/windows-forensic-analysis-170
https://www.sans.org/security-resources/posters/dfir/hunt-evil-165
https://www.sans.org/security-resources/posters/dfir/windows-forensics-evidence-of-75

Event Description
4673 A privileged service was called.
4674 An operation was attempted on a privileged object.
4697 A service was installed in the system.
4698 A scheduled task was created.
4699 A scheduled task was deleted.
4700 A scheduled task was enabled.
4701 A scheduled task was disabled.
4702 A scheduled task was updated.
4768 A Kerberos authentication ticket TGT was requested.
4769 A Kerberos service ticket was requested.
4770 A Kerberos service ticket was renewed.
4771 Kerberos pre-authentication failed.
4776 The computer attempted to validate the credentials for an account.
4778 A session was reconnected to a Window Station.
4779 A session was disconnected from a Window Station.
4964 Special groups have been assigned to a new logon.

Event Categories and Types

ECS 1.5 define which are the values allowed for event categories and types.
https://www.elastic.co/guide/en/ecs/current/ecs-allowed-values-event-category.html
https://www.elastic.co/guide/en/ecs/current/ecs-allowed-values-event-type.html

Modifications have been introduced in order to adjust the events to fall into allowed categories/types.
In order to add flexibility the function addActionDesc was replace for a more general function, the addEventFields. This function completes the category (event.category), the primary type (event.type) and the action description (event.action).
Aditional types can be attached to the event via AppendTo function.
For example, for Evt 4719 the addEventFields sets the event.category="iam", event.type="admin" but because it is also a change thet event.type=change is also added via AppendTo in the specific function that process the event
Having more than one value in the event.type, allow us to detect, for example, this type of activity

 event.category:iam AND event.type:admin AND event.type:change

event type example

In this way event categories/types can be easily modified according to futher ECS changes.

For all events the evet.outcome was also aligned to the specification of ECS 1.5
https://www.elastic.co/guide/en/ecs/current/ecs-allowed-values-event-outcome.html

Fixes/Improvements

  • Event 4648:
    Events 4648 and 4624 were processed by the same function, but the winlog.logon.id field needs to be copied from different source field in the case of evt 4648
    For evt 4624 the winlog.logon.id comes from winlog.data.TargetLogonID whereas that for evt 4648 should be copied from winlog.data.SubjectLogonID
    The processing for those events were decoupled.
    In the Evt 4648 we have now the winlog.logon.id of the user logging in with the explicit credentials and thus be able to correlate with the original winlog.logon.id. See example below

4648_example

  • Event 4625:
    In this event the Add(copyTargetUserLogonId) was replaced for the .Add(copySubjectUserLogonId). The relevant LogonID information is in the winlog.event_data.SubjectLogonId and was obtain from winlog.event_dataTargetLogonId
    Normaly the winlog.event_data.SubjectLogonId is 0x0 but when one logged-in user tries to run as a different user and fails to, the LogonID is the one of the logged-in user
    In this way we can track all the activity, right from the original connection. See example below
    4625_follow-up

  • Events 4728,4729,4732,4733,4743,4746,4747,4751,4752,4756,4757,4761,4762 :
    Extracted user from winlog.event_data.MemberName in order to be added to related.user field

  • Events 4688 and 4689: winlog.logon.id field was missing. The .Add(copySubjectUserLogonId) was added.

  • Event 4688: Modified to not to add related.user when winlog.event_data.TargetUserName is "-"

  • Event 4672: add event.outcome. Aligned to ECS 1.5

  • Event 4647: Missing event.action

  • Event 4731 and 1102: Wrong event.action

  • copyTargetUser was modify in order to parse properly the user name in Kerberos Events

  • Added missing codes to logonFailureStatus table in order to map failure codes from Event 4776

  • addAuthSuccess and addAuthFailed removed and replaced for addEventOutcome and addEventFields functions.

  • Enrichment information sources. For all tables with data used to enrich events the source of that information was added.

Future Work

…ypes (elastic#17517)

Add support for event IDs 4673, 4674, 4697, 4698, 4699, 4700, 4701, 4702, 4768, 4769, 4770, 4771, 4776, 4778, 4779, 4964 to the Winlogbeat Security module.

Co-authored-by: Lee E. Hinman <lee.e.hinman@elastic.co>
(cherry picked from commit 955bc46)
@andrewkroh andrewkroh requested a review from a team as a code owner May 4, 2020 14:29
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 4, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/siem (Team:SIEM)

@andrewkroh andrewkroh removed the needs_team Indicates that the issue/PR needs a Team:* label label May 4, 2020
@andrewkroh andrewkroh requested a review from leehinman May 4, 2020 14:30
Copy link
Copy Markdown
Contributor

@leehinman leehinman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview stats

Expand to view the summary

Build stats

Test stats 🧪

Test Results
Failed 0
Passed 261
Skipped 1
Total 262

@andrewkroh andrewkroh merged commit 56941b5 into elastic:7.x May 4, 2020
@andrewkroh andrewkroh deleted the backport_17517_7.x branch January 14, 2022 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants