First Time AWS Cloudformation Stack Creation by User
This rule detects the first time a principal calls AWS Cloudwatch CreateStack
or CreateStackSet
API. Cloudformation is used to create a single collection of cloud resources called a stack, via a defined template file. An attacker with the appropriate privileges could leverage Cloudformation to create specific resources needed to further exploit the environment. This is a new terms rule that looks for the first instance of this behavior in the last 10 days for a role or IAM user within a particular account.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/07/25"
3integration = ["aws"]
4maturity = "production"
5min_stack_comments = "Multiple field support in the New Terms rule type was added in Elastic 8.6"
6min_stack_version = "8.6.0"
7updated_date = "2024/07/31"
8
9[rule]
10author = ["Elastic"]
11description = """
12This rule detects the first time a principal calls AWS Cloudwatch `CreateStack` or `CreateStackSet` API. Cloudformation is used to create a single collection of cloud resources called a stack, via a defined template file. An attacker with the appropriate privileges could leverage Cloudformation to create specific resources needed to further exploit the environment. This is a new terms rule that looks for the first instance of this behavior in the last 10 days for a role or IAM user within a particular account.
13"""
14false_positives = [
15 """
16 Verify whether the user identity should be using the `CreateStack` or `CreateStackSet` APIs. If known behavior is causing false positives, it can be exempted from the rule. The "history_window_start" value can be modified to reflect the expected frequency of known activity within a particular environment.
17 """,
18]
19from = "now-6m"
20index = ["filebeat-*", "logs-aws.cloudtrail-*"]
21language = "kuery"
22license = "Elastic License v2"
23name = "First Time AWS Cloudformation Stack Creation by User"
24references = [
25 "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-cli-creating-stack.html/",
26 "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-concepts.html/",
27 "https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html/",
28 "https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStackSet.html/",
29]
30risk_score = 47
31rule_id = "0415258b-a7b2-48a6-891a-3367cd9d4d31"
32severity = "medium"
33tags = [
34 "Domain: Cloud",
35 "Data Source: AWS",
36 "Data Source: Amazon Web Services",
37 "Data Source: Cloudformation",
38 "Use Case: Asset Visibility",
39 "Tactic: Execution",
40]
41timestamp_override = "event.ingested"
42type = "new_terms"
43
44query = '''
45event.dataset:aws.cloudtrail and event.provider:cloudformation.amazonaws.com and
46 event.action: (CreateStack or CreateStackSet) and event.outcome:success
47'''
48
49[[rule.threat]]
50framework = "MITRE ATT&CK"
51
52[rule.threat.tactic]
53id = "TA0002"
54name = "Execution"
55reference = "https://attack.mitre.org/tactics/TA0002/"
56
57[rule.new_terms]
58field = "new_terms_fields"
59value = ["cloud.account.id","user.name"]
60[[rule.new_terms.history_window_start]]
61field = "history_window_start"
62value = "now-10d"
References
Related rules
- AWS Lambda Layer Added to Existing Function
- AWS S3 Bucket Expiration Lifecycle Configuration Added
- AWS S3 Bucket Server Access Logging Disabled
- AWS RDS Snapshot Deleted
- AWS RDS DB Instance Restored