Insecure AWS EC2 VPC Security Group Ingress Rule Added

Last updated a month ago on 2026-08-05
Created 2 years ago on 2024-04-16

About

Identifies when a specified inbound (ingress) rule is added or adjusted for a VPC security group in AWS EC2. This rule detects when a security group rule is added that allows traffic from any IP address or from a specific IP address to common remote access ports, such as 22 (SSH) or 3389 (RDP). Adversaries may add these rules to allow remote access to VPC instances from any location, increasing the attack surface and potentially exposing the instances to unauthorized access.
Tags
Domain: CloudPlatform: AWSData Source: AWS CloudTrailService: AWS EC2Tactic: Defense EvasionRule Type: Custom Query (KQL)Language: kuery
Severity
medium
Risk Score
47
MITRE ATT&CK™

Defense Evasion (TA0005)(external, opens in a new tab or window)

Initial Access (TA0001)(external, opens in a new tab or window)

False Positive Examples
Administrators may legitimately add security group rules to allow traffic from any IP address or from specific IP addresses to common remote access ports.
License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Query (Kibana Query Language)
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
filebeat-*logs-aws.cloudtrail-*
Related Integrations

aws(external, opens in a new tab or window)

Query
text code block:
data_stream.dataset: "aws.cloudtrail" and event.provider: ec2.amazonaws.com and event.action: AuthorizeSecurityGroupIngress and event.outcome: success and aws.cloudtrail.flattened.request_parameters.ipPermissions.items.ipRanges.items.cidrIp: ("0.0.0.0/0" or "::/0") and aws.cloudtrail.flattened.request_parameters.ipPermissions.items.fromPort: ( 21 or 22 or 23 or 445 or 3389 or 5985 or 5986) and not user_agent.original: (*packer-plugin-amazon* or *Terraform* or *Pulumi*)

Install detection rules in Elastic Security

Detect Insecure AWS EC2 VPC Security Group Ingress Rule Added in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).