Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Continue target process RFC to stage 1 #1297

Merged
merged 8 commits into from
Jun 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 76 additions & 7 deletions rfcs/text/0016-target-process.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 0016: Target process fields
<!-- Leave this ID at 0000. The ECS team will assign a unique, contiguous RFC number upon merging the initial stage of this RFC. -->

- Stage: **0 (strawperson)** <!-- Update to reflect target stage. See https://elastic.github.io/ecs/stages.html -->
- Date: **2021-03-09** <!-- The ECS team sets this date at merge time. This is the date of the latest stage advancement. -->
- Stage: **1 (draft)** <!-- Update to reflect target stage. See https://elastic.github.io/ecs/stages.html -->
- Date: **2021-06-09** <!-- The ECS team sets this date at merge time. This is the date of the latest stage advancement. -->



Expand All @@ -29,6 +29,27 @@ The most common use cases for Windows:
Stage 1: Describe at a high level how this change affects fields. Include new or updated yml field definitions for all of the essential fields in this draft. While not exhaustive, the fields documented here should be comprehensive enough to deeply evaluate the technical considerations of this change. The goal here is to validate the technical details for all essential fields and to provide a basis for adding experimental field definitions to the schema. Use GitHub code blocks with yml syntax formatting.
-->

**Stage 1**
This causes reuse of the `process.*` field set at two locations:
* `process.target.*`
* `process.parent.target*`


The `process.parent.target` reused fieldset could be descoped if it's too complex or increases the field count too significantly. It does have value, because information of the parent process of the target remains valuable. More on that utility in the next section.

```yml
reusable:
top_level: true
expected:
- at: process
as: parent
- at: process
as: target
# collect the parent of the target process at process.target.parent
- at: process.target
as: parent
```

<!--
Stage 2: Add or update all remaining field definitions. The list should now be exhaustive. The goal here is to validate the technical details of all remaining fields and to provide a basis for releasing these field definitions as beta in the schema. Use GitHub code blocks with yml syntax formatting.
-->
Expand All @@ -39,12 +60,60 @@ Stage 2: Add or update all remaining field definitions. The list should now be e
Stage 1: Describe at a high-level how these field changes will be used in practice. Real world examples are encouraged. The goal here is to understand how people would leverage these fields to gain insights or solve problems. ~1-3 paragraphs.
-->

Target process information is valuable to detect several kinds of attacker behavior, but also good to profile or audit a system.
The most commonly known attacker behaviors where one process directly accesses another:

* Process injection [T1055](https://attack.mitre.org/techniques/T1055/)
* Access token manipulation [T1134](https://attack.mitre.org/techniques/T1134/)
* Credential theft from lsass [T1003.001](https://attack.mitre.org/techniques/T1003/001/)


Here are some example detections that could be written in KQL:

| Example rule name | KQL query |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| Injection to a browser | event.action : "process_injection" and process.target.name : ("GoogleChrome.exe", "iexplore.exe", "firefox.exe") |
| Token theft from explorer | event.action : "token_theft" and process.name : (not "explorer.exe") and process.target.name : "explorer.exe" |
| Injection to a service process | event.action : "process_injection" and process.target.parent.name : "services.exe" |
| Password dumping from lsass | event.action : "process_memory_read" and process.target.name : "lsass.exe" |
| Generic process access | event.action : "process_access" an process.target.name : * |


## Source data

<!--
Stage 1: Provide a high-level description of example sources of data. This does not yet need to be a concrete example of a source document, but instead can simply describe a potential source (e.g. nginx access log). This will ultimately be fleshed out to include literal source examples in a future stage. The goal here is to identify practical sources for these fields in the real world. ~1-3 sentences or unordered list.
-->

Example sources of data include EDR-like products that collect operating system telemetry. Although cross-process events are more commonly known with Windows (injection, memory reads), they are also possible with Linux and macOS. The most universal use case across operating systems is attaching remote debuggers, which could be used for benign or malicious purposes.


Example event from Microsoft Sysmon [source](https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=90010), which is used by Winlogbeat:

Process accessed:
UtcTime: 2017-05-15 00:02:01.463
SourceProcessGUID: {d49b2de5-efa6-5918-0000-00104d553c00}
SourceProcessId: 4704
SourceThreadId: 4124
SourceImage: C:\mimikatz\x64\mimikatz.exe
TargetProcessGUID: {d49b2de5-e852-5918-0000-00100b0f0700}
TargetProcessId: 1576
TargetImage: C:\Windows\system32\winlogon.exe
GrantedAccess: 0x40
CallTrace: C:\Windows\SYSTEM32\ntdll.dll+a5594|C:\Windows\system32\KERNELBASE.dll+1e865|C:\mimikatz\x64\mimikatz.exe+77ad|C:\mimikatz\x64\mimikatz.exe+7759|C:\mimikatz\x64\mimikatz.exe+f095|C:\mimikatz\x64\mimikatz.exe+6610a|C:\mimikatz\x64\mimikatz.exe+65dc4|C:\mimikatz\x64\mimikatz.exe+4ac00|C:\mimikatz\x64\mimikatz.exe+4aa36|C:\mimikatz\x64\mimikatz.exe+4a81d|C:\mimikatz\x64\mimikatz.exe+6ebe5|C:\Windows\system32\KERNEL32.DLL+18102|C:\Windows\SYSTEM32\ntdll.dll+5c5b4

The `Target*` fields of the Sysmon event would map:
* `TargetProcessGUID` -> `process.target.entity_id`
* `TargetProcessID` -> `process.target.pid`
* `TargetProcessImage` -> `process.target.executable` and `process.target.name`

The `Source*` fields of the Sysmon would map:
* `SourceProcessGUID` -> `process.entity_id`
* `SourceProcessId` -> `process.pid`
* `SourceThreadId` -> `process.thread.tid` (side question: does it make sense to move `thread.*` from `process`?)
* `SourceImage` -> `process.executable` and `process.name`


<!--
Stage 2: Included a real world example source document. Ideally this example comes from the source(s) identified in stage 1. If not, it should replace them. The goal here is to validate the utility of these field changes in the context of a real world example. Format with the source name as a ### header and the example document in a GitHub code block with json formatting.
-->
Expand All @@ -65,10 +134,13 @@ The goal here is to research and understand the impact of these changes on users

## Concerns


<!--
Stage 1: Identify potential concerns, implementation challenges, or complexity. Spend some time on this. Play devil's advocate. Try to identify the sort of non-obvious challenges that tend to surface later. The goal here is to surface risks early, allow everyone the time to work through them, and ultimately document resolution for posterity's sake.
-->

The biggest concern is the duplication of fields and the double-nested `process` group at `process.target.parent`. This could require some updates to our reuse mechanism, but that's an issue internal to this repository. We should make sure that we don't accidentally populate `process.parent.target`, which would have different meaning. Because of this, we will need to make sure that we articulate what each reuse means, similar to https://www.elastic.co/guide/en/ecs/current/ecs-user.html#ecs-user-nestings.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for calling this out.

Changes will need to be made to support reusing process.* fields as parent.* underneath process.target since self-nestings (fields reused within themselves) aren't carried around to other places (avoids nestings like user.target.* from getting carried over to source.user.target.*)


<!--
Stage 2: Document new concerns or resolutions to previously listed concerns. It's not critical that all concerns have resolutions at this point, but it would be helpful if resolutions were taking shape for the most significant concerns.
-->
Expand All @@ -83,6 +155,7 @@ The following are the people that consulted on the contents of this RFC.

* @rw-access | author
* @andrewstucki | co-author
* @devonakerr | sponsor



Expand All @@ -95,8 +168,4 @@ The following are the people that consulted on the contents of this RFC.
<!-- An RFC should link to the PRs for each of it stage advancements. -->

* Stage 0: https://github.com/elastic/ecs/pull/1286

<!--
* Stage 1: https://github.com/elastic/ecs/pull/NNN
...
-->
* Stage 1: https://github.com/elastic/ecs/pull/1297