Created
November 9, 2023 18:55
-
-
Save Samirbous/94651b743d936eb2eddbac597a15aa00 to your computer and use it in GitHub Desktop.
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
// DLLs normally located in system32 but unsigned and loaded from elsewhere | |
// https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-enrich-data.html | |
// example ENRICH libs-policy creation steps | |
https://gist.github.com/Samirbous/9f9c3237a0ada745e71cc2ba3425311c | |
ES|QL query: | |
from .ds-logs-endpoint.events.library-* | |
| where event.action == "load" and process.code_signature.status == "trusted" and dll.code_signature.status != "trusted" and | |
not dll.path rlike """[c-fC-F]:\\Windows\\(System32|SysWOW64)\\[a-zA-Z0-9_]+.dll""" | |
| ENRICH enrich-dll1 | |
| where native == "yes" and not dll.path like "?:?Windows?assembly?NativeImages*" | |
| eval process_path = replace(process.executable, "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", ""), dll_path = replace(dll.path, "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}", "") | |
| stats cc = count(*) by dll.name, process_path, dll_path | |
| sort cc desc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment