Skip to content

Commit 477df5c

Browse files
authored
[Rule Tuning] AWS S3 Static Site Javascript File Uploaded (#5264)
This rule is triggering as expected. However, the threat this rule is meant to capture is a potential malicious .js file upload. Currently it is capturing both GetObject (read file) and PutObject (write file) API calls which is adding noise without adding much threat detection value. - Removed `GetObject` API call from scope, so this rule focuses only on write activity. This reduced alert telemetry volume by ~73% - added `event.outcome == success` criteria to exclude failed upload attempts - corrected `Pulumi` typo in user agent exclusion criteria - reduced execution window - added highlighted fields
1 parent ee06afd commit 477df5c

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

rules/integrations/aws/impact_s3_static_site_js_file_uploaded.toml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
creation_date = "2025/04/15"
33
integration = ["aws"]
44
maturity = "production"
5-
updated_date = "2025/09/25"
5+
updated_date = "2025/10/28"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
This rule detects when a JavaScript file is uploaded or accessed in an S3 static site directory (`static/js/`) by an IAM
10+
This rule detects when a JavaScript file is uploaded in an S3 static site directory (`static/js/`) by an IAM
1111
user or assumed role. This can indicate suspicious modification of web content hosted on S3, such as injecting malicious
1212
scripts into a static website frontend.
1313
"""
@@ -17,7 +17,7 @@ false_positives = [
1717
Verify the user agent, source IP, and whether the modification was expected.
1818
""",
1919
]
20-
from = "now-9m"
20+
from = "now-6m"
2121
language = "esql"
2222
license = "Elastic License v2"
2323
name = "AWS S3 Static Site JavaScript File Uploaded"
@@ -73,10 +73,11 @@ query = '''
7373
from logs-aws.cloudtrail* metadata _id, _version, _index
7474
7575
| where
76-
// S3 object read/write activity
76+
// S3 object write activity
7777
event.dataset == "aws.cloudtrail"
7878
and event.provider == "s3.amazonaws.com"
79-
and event.action in ("GetObject", "PutObject")
79+
and event.action == "PutObject"
80+
and event.outcome == "success"
8081
8182
// IAM users or assumed roles only
8283
and aws.cloudtrail.user_identity.type in ("IAMUser", "AssumedRole")
@@ -88,7 +89,7 @@ from logs-aws.cloudtrail* metadata _id, _version, _index
8889
and not (
8990
user_agent.original like "*Terraform*"
9091
or user_agent.original like "*Ansible*"
91-
or user_agent.original like "*Pulumni*"
92+
or user_agent.original like "*Pulumi*"
9293
)
9394
9495
// Extract fields from request parameters
@@ -127,10 +128,27 @@ id = "T1565.001"
127128
name = "Stored Data Manipulation"
128129
reference = "https://attack.mitre.org/techniques/T1565/001/"
129130

130-
131-
132131
[rule.threat.tactic]
133132
id = "TA0040"
134133
name = "Impact"
135134
reference = "https://attack.mitre.org/tactics/TA0040/"
136135

136+
[rule.investigation_fields]
137+
field_names = [
138+
"@timestamp",
139+
"user.name",
140+
"user_agent.original",
141+
"source.ip",
142+
"aws.cloudtrail.user_identity.arn",
143+
"aws.cloudtrail.user_identity.type",
144+
"aws.cloudtrail.user_identity.access_key_id",
145+
"aws.cloudtrail.resources.arn",
146+
"aws.cloudtrail.resources.type",
147+
"event.action",
148+
"event.outcome",
149+
"cloud.account.id",
150+
"cloud.region",
151+
"aws.cloudtrail.request_parameters",
152+
"aws.cloudtrail.response_elements"
153+
]
154+

0 commit comments

Comments
 (0)