↳ GitHub sourceAnalytics ruleMedium

AWSCloudTrail - EC2 Startup Shell Script Changed

Description

Identifies changes to the EC2 startup script. The shell script will be executed as root/SYSTEM every time the specific instances are booted up. ref : https://github.com/RhinoSecurityLabs/pacu/blob/master/pacu/modules/ec2__startup_shell_script/main.py
Rule type
Scheduled
Version
1.0.1
Declared status
Available
Query frequency
15m
Query period
15m
Trigger
gt 0

Declared MITRE coverage

Declared sources

Metadata from the source file. No dependencies inferred from KQL.

Connectors

Data types

KQL query

Original query, unchanged.

AWSCloudTrail
| where EventName in~ ("ModifyInstanceAttribute", "CreateLaunchTemplate")
| extend RequestParametersJson = parse_json(RequestParameters)
| where tostring(RequestParametersJson.userData) != ""
| extend userData_ = tostring(RequestParametersJson.userData)
| extend instanceId_ = tostring(RequestParametersJson.instanceId)
| project-away SourceSystem, Category, Type, TenantId, EventVersion, SessionIssuerAccountId
| extend UserName = substring(UserIdentityPrincipalid, indexof_regex(UserIdentityPrincipalid, ":") + 1)
| extend Name = split(UserName,'@')[0],UpnSuffix = split(UserName,'@')[1]
| project TimeGenerated, EventName, UserName, Name, UpnSuffix, instanceId_, AWSRegion, SourceIpAddress, EventSource, UserIdentityArn, EventTypeName

Declared entities

AccountIP

Related content

Links established from declared identifiers and solution manifests.

Source provenance

GitHub

Displayed values come from files in Azure/Azure-Sentinel. They describe the published template, not your workspace configuration.

Source identifier
f8577e4d-8481-437b-a94e-06f615985668
Additional source files 2Solutions/Amazon Web Services/Analytic Rules/AWS_EC2StartupShellScriptChanged.yamlsource ↗Solutions/Amazon Web Services/Data/Solution_AmazonWebServices.jsonsolution-membership ↗
GSTEP / CATALOG TRACKING

Added to catalog : 16 Sept 2026 · 05:49 UTC
Last change observed : 16 Sept 2026 · 05:49 UTC

GSTEP sync dates, separate from the source content’s publication dates.