← 返回列表

My Methodology to AWS Detection Engineering (Part 2: Risk Assignment)

单站 chesterlebron 作者 Chester Le Bron 发布 2024-08-26T08:30:00.002-05:00 入库 2026-11-18T05:14:15

My Methodology to AWS Detection Engineering (Part 2: Risk Assignment)

Introduction

Welcome back to the second installment of the blog series discussing my methodology for threat detection engineering in AWS. I am humbled by the response to Part One, so thank you to everyone who reached out. I'm very happy that some of you found it helpful. In case you missed it, we covered RBA object selection for AWS and how an example of how that could be of use. I recommend reading Part One before continuing here. But since you're back, I assume you are here for Part Two, so let's get into it. We will look at an example application of risk score assignment with the concepts discussed in Part One and the lessons I've learned using the available RBA features in Splunk ES.

This will be a shorter post as I want to focus on the key components that make up the risk assignment rule. Let's start by jumping right into the logic needed in this methodology.

Core Components:

Initial Filter 1

index=notable tag_field="aws"

In this approach, we will use the index that contains your triggered detections. This is up to you, but you could just as easily add the logic mentioned in the rest of this blog in every detection rule you have. Just know that the

collect commandis going to run and output results whenever you execute the correlation search ad-hoc which can cause headaches. I prefer to have one rule to manage my AWS risk assignments, as it gives me the freedom to manage it in one spot…again, up to you.

Initial Filter 2

tag_field="aws"

  1. This is a filtering field and could be whatever field you use to tag and identify detections as AWS-specific alerts…assuming you have done this in some capacity
  2. If you don't have this or a similar tag, but you happen to output the "sourcetype" in your detections, you could use this as your filter (sourcetype="aws:*")
  3. If there is no sourcetype or tag field, then you could get really lazy with it and use the alert name field, search_name="*AWS*"
  4. If you've made it this far, chances are you probably want to just add the logic below into your individual AWS correlation searches... though I'd argue it's simpler to just add a tag to those searches and use that field as noted in Step 1 😉

Severity & Fidelity

| eval severity=coalesce(severity,"informational")
| eval fidelity=coalesce(fidelity,1)

Risk Objects

| eval risk_object=mvappend(aws_identity_arn, aws_principal_id, target_resource_name, src_ip,instance_id,...)
| mvexpand risk_object
| eval risk_object_type=IF(match(risk_object,"^i-[0-9a-f]{7,17}$|\b(?:\d{1,3}\.){3}\d{1,3}\b"),"system","user")
[here](https://docs.splunk.com/Documentation/ES/7.3.2/RBA/PrioritizeThreatObjects).

Base Risk Score

| lookup severity_score.csv severity output score as base_score
| eval base_risk_score=base_score
| eval risk_score=base_risk_score * fidelity

This creates your base score from the severity_score lookup, which contains simple key/value pairs that align with the scores outlined

hereor your own custom scoring scheme. This base_score is used in the risk_score calculation by multiplying the fidelity by the base score.

The Magic: Risk Score Assignment

| eval event_time=orig_time
| collect index=risk

I was totally kidding when I said "the magic," as this is pretty straightforward. The event_time piece ensures you are pulling in the original _time from the alerted event. If you were doing this within the original detection rules, then it would just be a matter of setting event_time to _time. However, in this approach, we are querying the notable index for the triggered detections, so orig_time is what we need.

The collect statement is what we use to send this information to the risk index. Trust me when I say this method (the collect command) is the most liberating in comparison to the alternatives, which I will briefly touch on later.

Advice

| eval raw_event_hash=sha256(_raw)
| search NOT [search index=risk tag_field="aws" | table raw_event_hash]

Alternative risk assignment methods

There are two methods in particular you could use (sendalert & Risk Adaptive Action) but let me explain why I prefer not to use them:

I will spend a little time on the last bullet point. Yes, Splunk introduced

Risk Factorsa few years ago (2021, I believe), and this is great for those just getting started, but at least for me, I didn't want to do everything within the console. I believe if you want to do this in a medium or large enterprise, it doesn't scale all that well. I'd suggest using Risk Factors for general use cases, like the ones shown

here, but in general this a nice feature to use in your RBA strategy.

Conclusion

MITRE ATT&CKframework (technique/sub-technique IDs) and where possible the

Cloud Matrix, as this will be useful in scoring and aggregation rules you create later.

See you soon!

原文链接:https://chesterlebron.blogspot.com/2024/08/my-methodology-to-aws-detection.html