elastic / detection-rules

https://www.elastic.co/guide/en/security/current/detection-engine-overview.html
Other
1.92k stars 492 forks source link

[New Rule] Instance Metadata Service (IMDS) API Requests - Linux #4005

Closed terrancedejesus closed 1 month ago

terrancedejesus commented 1 month ago

Pull Request

Issue link(s): https://github.com/elastic/ia-trade-team/issues/272

Summary - What I changed

Adding a new detection rule for unusual instance metadata service (IMDS) API requests. The IMDS has a global API for cloud service providers that will allow compute instance information retrieval, as well as can facilitate federated authentication and credential access. Adversaries, with compromised credentials or instance, may leverage a custom binary or native tools to send requests to IMDS' API for instance information or event temporary credential requests.

How To Test

Personal stack

Screenshot 2024-08-26 at 11 28 15 AM

Telemetry

Last 4 months there is ~36 alerts that match this. A majority of these are FP for a specific custom shellscript by a client that should be an exception rather than global exclusion in the query.

Checklist

Contributor checklist

protectionsmachine commented 1 month ago

Rule: New - Guidelines

These guidelines serve as a reminder set of considerations when proposing a new rule.

Documentation and Context

Rule Metadata Checks

New BBR Rules

Testing and Validation

terrancedejesus commented 1 month ago

Added event.type and event.action to the sequence, as the screenshot you provided detects a UID change event followed by a network event, rather than a process execution event. You might want to go back and check whether the query still works as intended with this change.

joining on process.entity_id and process.parent.entity_id for the sequences does not match the expected events, hence the image you pointed out. Rather, they entity IDs for both parent and child process are the same so I added process.parent.entity_id to the initial sequence by ... instead.

Screenshot 2024-08-28 at 12 22 00 PM