Skip to content

Conversation

@marshallmain
Copy link
Collaborator

No description provided.

Copy link
Contributor

@magermark magermark left a comment

Choose a reason for hiding this comment

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

Looks pretty good, just need to update some descriptions and change metrics to an array of keywords

- name: version
level: custom
type: keyword
description: Ransomware detection version.
Copy link
Contributor

Choose a reason for hiding this comment

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

description: Ransomware artifact version

- name: files
level: custom
type: object
description: Information about each file targeted by the ransomware. Expected to be an array.
Copy link
Contributor

Choose a reason for hiding this comment

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

description: Information about each file event attributed to the ransomware. Expected to be an array.

- name: files.entropy
level: custom
type: double
description: TODO write description and check that type is indeed double
Copy link
Contributor

Choose a reason for hiding this comment

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

description: "Entropy of file contents"

- name: files.data
level: custom
type: binary
description: Combined header_string + data buffer field
Copy link
Contributor

Choose a reason for hiding this comment

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

description: File header or MBR bytes

- name: files.operation
level: custom
type: keyword
description: Operation applied to file.
Copy link
Contributor

@magermark magermark Oct 16, 2020

Choose a reason for hiding this comment

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

@wburgess1 Operation is string-based here. So I take it we'll need to map the file operation dword values to their string equivalents before forming the alert?

Copy link

@wburgess1 wburgess1 Oct 19, 2020

Choose a reason for hiding this comment

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

@magermark operation is only ever one int value right? So this is fine just being a keyword and not say an array?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's correct

- name: files.metrics
level: custom
type: double
description: TODO idk what this is
Copy link
Contributor

Choose a reason for hiding this comment

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

metrics should be an array of strings (keywords?), so something like this:

name: files.metrics level: custom type: keyword description: Characteristics that describe uniqueness of file event normalize: - array 
Copy link

@wburgess1 wburgess1 Oct 19, 2020

Choose a reason for hiding this comment

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

I would be tempted to go with a description like:

description: Suspicious ransomware behaviours associated with the file event. 
- name: files.score
level: custom
type: double
description: Ransomware score for this particular file. No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

description: Ransomware score for this particular file event

fields:
id:
exceptionable: true
rule:
Copy link
Contributor

Choose a reason for hiding this comment

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

Would rule apply for a ransomware alert? This seems out of place here but I see it's being used for malware alerts so maybe it's safe just to leave it in just in case it's needed: https://github.com/elastic/endpoint-package/blob/master/custom_subsets/elastic_endpoint/alerts/malware_event.yaml

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Initially when making the malware schema I thought we might use rule to capture high level information about the malware module and make it easily accessible - basically treating the malware detection routine as one large rule. That hasn't happened so the fields are unused afaik. It's a core ECS fieldset though so maintaining them is free for us.

- name: files.path
level: custom
type: keyword
description: File path after being ransomed
Copy link

@wburgess1 wburgess1 Oct 19, 2020

Choose a reason for hiding this comment

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

I feel like this description (and ones above) might be slightly misleading. It's mainly the before/being ransomed that I'm uncomfortable with (and may be misleading in some circumstances).

I would be tempted to put these descriptions in more neutral language e.g. File path for suspicious file activity / File path before suspicious file activity etc.. or maybe even just File path?

Thoughts @magermark ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think File path is sufficient. There are circumstances (ransom notes, benign activity) where a file path isn't necessarily being encrypted, so the description should be more general.

- name: feature
level: custom
type: keyword
description: Specific ransomware feature, e.g. MBR/Lua/Canaries.

Choose a reason for hiding this comment

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

description: Ransomware feature which triggered the alert. 
- name: score
level: custom
type: double
description: Total score of all files ransomed.
Copy link

@wburgess1 wburgess1 Oct 19, 2020

Choose a reason for hiding this comment

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

description: Total ransomware score for aggregated file events. 
- name: child_pids
level: custom
type: long
description: Array of PIDs for cases where ransomware spawns numerous child processes (e.g. lockergoga)

Choose a reason for hiding this comment

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

description: Array of child PIDs for ransomware which spawns numerous processes to handle encryption. 
Copy link
Collaborator

@jonathan-buttner jonathan-buttner left a comment

Choose a reason for hiding this comment

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

Just did a quick look over, need to review more in depth.

type: long
description: Array of PIDs for cases where ransomware spawns numerous child processes (e.g. lockergoga)
normalize:
- array
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does the normalize do here?

Copy link
Collaborator Author

@marshallmain marshallmain Oct 19, 2020

Choose a reason for hiding this comment

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

It doesn't do anything for elasticsearch right now, but it's used in some ECS core fields as well for documentation that a field is expected to be an array.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah thanks!

@@ -0,0 +1,383 @@
---
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add these:

 # these fields are needed in the mapping so the maps page of the security app does not throw a bunch of errors source: fields: geo: fields: "*" destination: fields: geo: fields: "*" 

It's a bit of a hack to get around this issue: elastic/kibana#73304
#87


- name: score
level: custom
type: double
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this need to be a double or could it be a smaller float? In your example @wburgess1 they only had one decimal places I think. Will that always be the case?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jonathan-buttner We typically require up to three decimal places at the moment

normalize:
- array

- name: files
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we imagine the user searching across these files? Would we need to switch it to type: nested?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jonathan-buttner Yes, users would likely be interested in searching / scanning through this list to determine the extent of the breach. type: nested seems like it would be appropriate in this use case

Choose a reason for hiding this comment

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

I feel like if we can make it searchable it sounds like a good idea but not sure if that comes at a performance cost. Note that max number of objects will be 200, on average though its probs around ~50. @jonathan-buttner how would these numbers affect nested limitations ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah so the advantage of nested is being able to query the objects in the array independently of each other, which is probably what we'd want to do. At endgame we ran into issues with nested objects because they have these limits by default:

https://www.elastic.co/guide/en/elasticsearch/reference/master/mapping.html#:~:text=Default%20is%2050%20.&text=The%20maximum%20number%20of%20nested,Default%20is%2010000%20.

image

https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html

image

If worst case is 200, I think we'll be fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@magermark Would users want to query for a specific alert based on files that are breached? Or would they only need be able to scan through the list of files after picking a specific alert based on other criteria? Even without nested they'll be able to see all the information in files once they are looking at a specific alert document.

The use case that nested enables is a query like "find ransomware alerts where a certain ransomed file had (property 1 AND property 2)".

Choose a reason for hiding this comment

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

@jared-day Do you have any opinion on the above? Is it desirable for users to be able to query for a specific file that may have been encrypted/affected?

Choose a reason for hiding this comment

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

@marshallmain that was the main use case @magermark and I were thinking about - a user may want to search for a specific file that may have been affected by this kind of incident (e.g. for incident response).

Is it easy to change this in the future? My view is still the same, if we can do it and it's fine performance wise then it makes sense to gives users as much flexibility as possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not easy to change the type of a field in the future so I went ahead and changed it to nested.


- name: files.score
level: custom
type: double
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question here does this need to be a full double?

Copy link
Contributor

Choose a reason for hiding this comment

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

Up to three decimal places should suffice

Copy link
Collaborator

Choose a reason for hiding this comment

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

Gotcha, if we wanted to save some space we could probably switch it to like a float or maybe even half_float I think:

https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html#number

@@ -0,0 +1,392 @@
---
name: ransomware_event
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just double checking but we don't need any of the core file fields right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Entries in the files array (Ransomware.files) here will greatly differ from typical core file entries, so we do not need to inherit any fields from file.

- name: files.previous_extension
level: custom
type: keyword
description: Previous file extension.
Copy link

@wburgess1 wburgess1 Oct 20, 2020

Choose a reason for hiding this comment

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

Another nitpick and feel free to ignore but I noticed in the file fields schema (

description: Original file path prior to a modification event
) it uses the following:

description: Original file path prior to a modification event 

To remain consistent we could also use something like (basing the below on descriptions taken from that schema):

description: Previous file extension prior to a ransomware file event. description: Previous file path prior to a ransomware file event. description: Full path to the file, including the file name. It should include the drive letter, when appropriate 
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We might also want to use files.original.path to remain consistent with the custom file fieldset. Thoughts? Would that mean the same thing?

Choose a reason for hiding this comment

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

I think files.path is still fine for this. If anything previous_path / previous_extension could be renamed to original.path / original.extension to be more consistent with ECS 👍

@wburgess1
Copy link

This LGTM now. The only possible change which I will defer to you @marshallmain is changing the description of Ransomware.files[].original.path/extension respectively to:

description: Original file path prior to the file event. description: Original file extension prior to the file event. Also could do `files.path` --> description: Full path to the file, including the file name. 

As an FYI, I sanity checked custom_ransomware.yml to ensure everything we want is collected there (and ensured all superfluous fields were removed) and it looks good to me 👍. I also double checked all the field types (and cross referenced to the old endgame schema) and that looks good too. Lastly, I checked ransomware_event.ymland cross referenced it to an alert currently being generated. All the top level fields listed in ransomware_event.yml were present apart from Dll, rule, threat, user, group (+ source/destination) which I believe are all to be expected ( as FYI user info is collected as part of process).

@marshallmain marshallmain merged commit 576bf76 into elastic:master Oct 26, 2020
@ferullo ferullo mentioned this pull request Jun 21, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants