# 0016: Target process fields - Stage: **X (abandoned)** - Date: **2021-11-16** This RFC is to add model events that span multiple processes. There are some events for when one OS process accesses another. In Windows, this starts with a call to `OpenProcess` to gain a handle and then there are several APIs for things you can do with the handle once its open. For all of these operations, the general concept persists: one process requested access to another. The most common use cases for Windows: * reading the memory space, which is most famously done by mimikatz * injecting code * attaching a debugger * reading the Process Environment Block (PEB) for other benign or nefarious purpose ## Stage X This RFC is not being worked on actively, and it has been marked as abandoned. If an individual wishes to advance it in the future, open a new pull request against this proposal. ## Fields **Stage 0** | Name | Type | Description | | ---- | ---- | ----------- | | process.* | group | Remains unchanged and is always the _source_ process for cross-process activity. | | process.target.* | group | The `process.*` fieldset reused at `process.target.*` | | process.target.parent.* | group | Capture information about the parent of the target process. | **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 ``` ## Usage 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 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` ## Scope of impact ## Concerns 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. ## People The following are the people that consulted on the contents of this RFC. * @rw-access | author * @andrewstucki | co-author * @devonakerr | sponsor ## References ### RFC Pull Requests * Stage 0: https://github.com/elastic/ecs/pull/1286 * Stage 1: https://github.com/elastic/ecs/pull/1297 * Stage X: https://github.com/elastic/ecs/pull/1666