-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Adds new security module to detect anomalous activity in host-based logs #195582
Merged
sodhikirti07
merged 6 commits into
main
from
kirti/prebuilt_security_jobs_add_new_module
Nov 27, 2024
+191
−1
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4135920
Add new prebuilt security module
sodhikirti07 ed39312
Add security_host to module list
sodhikirti07 2f203c8
change expected length of config to 19
sodhikirti07 f7ae3ec
Update detector description of the jobs
sodhikirti07 ccbfe65
add security_host to recognize_module.ts
sodhikirti07 3d9ca8b
Merge branch 'main' into kirti/prebuilt_security_jobs_add_new_module
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
x-pack/plugins/ml/server/models/data_recognizer/modules/security_host/logo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"icon": "logoSecurity" | ||
} |
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/ml/server/models/data_recognizer/modules/security_host/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"id": "security_host", | ||
"title": "Security: Host", | ||
"description": "Detect anomalous activity in your ECS-compatible host-based logs.", | ||
"type": "Host data", | ||
"logoFile": "logo.json", | ||
"defaultIndexPattern": "auditbeat-*,logs-*,filebeat-*,winlogbeat-*", | ||
"query": { | ||
"bool": { | ||
"filter": [ | ||
{ | ||
"exists": { | ||
"field": "event.category" | ||
} | ||
}, | ||
{ | ||
"exists": { | ||
"field": "host.name" | ||
} | ||
}, | ||
{ | ||
"exists": { | ||
"field": "event.dataset" | ||
} | ||
}, | ||
{ | ||
"term": { | ||
"event.outcome": "success" | ||
} | ||
} | ||
], | ||
"must_not": { "terms": { "_tier": ["data_frozen", "data_cold"] } } | ||
} | ||
}, | ||
"jobs": [ | ||
{ | ||
"id": "high_count_events_for_a_host_name", | ||
"file": "high_count_events_for_a_host_name.json" | ||
}, | ||
{ | ||
"id": "low_count_events_for_a_host_name", | ||
"file": "low_count_events_for_a_host_name.json" | ||
} | ||
], | ||
"datafeeds": [ | ||
{ | ||
"id": "datafeed-high_count_events_for_a_host_name", | ||
"file": "datafeed_high_count_events_for_a_host_name.json", | ||
"job_id": "high_count_events_for_a_host_name" | ||
}, | ||
{ | ||
"id": "datafeed-low_count_events_for_a_host_name", | ||
"file": "datafeed_low_count_events_for_a_host_name.json", | ||
"job_id": "low_count_events_for_a_host_name" | ||
} | ||
], | ||
"tags": [ | ||
"security" | ||
] | ||
} |
33 changes: 33 additions & 0 deletions
33
.../data_recognizer/modules/security_host/ml/datafeed_high_count_events_for_a_host_name.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"job_id": "JOB_ID", | ||
"indices": [ | ||
"INDEX_PATTERN_NAME" | ||
], | ||
"max_empty_searches": 10, | ||
"query": { | ||
"bool": { | ||
"filter": [ | ||
{ | ||
"exists": { | ||
"field": "event.category" | ||
} | ||
}, | ||
{ | ||
"exists": { | ||
"field": "host.name" | ||
} | ||
}, | ||
{ | ||
"exists": { | ||
"field": "event.dataset" | ||
} | ||
}, | ||
{ | ||
"term": { | ||
"event.outcome": "success" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...s/data_recognizer/modules/security_host/ml/datafeed_low_count_events_for_a_host_name.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"job_id": "JOB_ID", | ||
"indices": [ | ||
"INDEX_PATTERN_NAME" | ||
], | ||
"max_empty_searches": 10, | ||
"query": { | ||
"bool": { | ||
"filter": [ | ||
{ | ||
"exists": { | ||
"field": "event.category" | ||
} | ||
}, | ||
{ | ||
"exists": { | ||
"field": "host.name" | ||
} | ||
}, | ||
{ | ||
"exists": { | ||
"field": "event.dataset" | ||
} | ||
}, | ||
{ | ||
"term": { | ||
"event.outcome": "success" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...er/models/data_recognizer/modules/security_host/ml/high_count_events_for_a_host_name.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"description": "Security: Host - Looks for a sudden spike in host based traffic. This can be due to a range of security issues, such as a compromised system, DDoS attacks, malware infections, privilege escalation, or data exfiltration.", | ||
"groups": ["security", "host"], | ||
"analysis_config": { | ||
"bucket_span": "3h", | ||
"detectors": [ | ||
{ | ||
"detector_description": "high count of host based events", | ||
"function": "high_count", | ||
"partition_field_name": "host.name", | ||
"detector_index": 0 | ||
} | ||
], | ||
"influencers": ["host.name", "host.ip", "event.dataset", "event.action", "event.category"] | ||
}, | ||
"allow_lazy_open": true, | ||
"analysis_limits": { | ||
"model_memory_limit": "128mb" | ||
}, | ||
"data_description": { | ||
"time_field": "@timestamp" | ||
}, | ||
"custom_settings": { | ||
"created_by": "ml-module-security-host", | ||
"security_app_display_name": "Spike in the Host Traffic", | ||
"managed": true, | ||
"job_revision": 1 | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ver/models/data_recognizer/modules/security_host/ml/low_count_events_for_a_host_name.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"description": "Security: Host - Looks for a sudden drop in host based traffic. This can be due to a range of security issues, such as a compromised system, a failed service, or a network misconfiguration.", | ||
"groups": ["security", "host"], | ||
"analysis_config": { | ||
"bucket_span": "3h", | ||
"detectors": [ | ||
{ | ||
"detector_description": "low count of host based events", | ||
"function": "low_count", | ||
"partition_field_name": "host.name", | ||
"detector_index": 0 | ||
} | ||
], | ||
"influencers": ["host.name", "host.ip", "event.dataset", "event.action", "event.category"] | ||
}, | ||
"allow_lazy_open": true, | ||
"analysis_limits": { | ||
"model_memory_limit": "128mb" | ||
}, | ||
"data_description": { | ||
"time_field": "@timestamp" | ||
}, | ||
"custom_settings": { | ||
"created_by": "ml-module-security-host", | ||
"security_app_display_name": "Decrease in the Host Traffic", | ||
"managed": true, | ||
"job_revision": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to make edits to a couple of the test files to fix the test errors:
https://github.com/elastic/kibana/blob/main/x-pack/test/functional/services/ml/supplied_configurations.ts#L30 - up the expected length to
19
for the new module.https://github.com/elastic/kibana/blob/main/x-pack/test/api_integration/apis/ml/modules/get_module.ts#L15 - add in
security_host
to the two arrays in this file (module IDs need to be in alphabetical order, so it will need to go in aftersecurity_cloudtrail
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this one which will also need updating - https://github.com/elastic/kibana/blob/main/x-pack/test/api_integration/apis/ml/modules/recognize_module.ts#L136 - add in
security_host
to the expected array in this file, aftersecurity_auth
.