Detection rules › Panther

EC2 VPC Modified

Severity
informational
Group by
recipientAccountId
Compliance
CIS 3.14
Log types
AWS.CloudTrail
Tags
AWS, Security Control, Defense Evasion:Impair Defenses
Reference
https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html
Source
github.com/panther-labs/panther-analysis

An EC2 VPC was modified.

MITRE ATT&CK coverage

TacticTechniques
StealthT1562 Impair Defenses

Rule body yaml

AnalysisType: rule
Filename: aws_ec2_vpc_modified.py
RuleID: "AWS.EC2.VPCModified"
DisplayName: "EC2 VPC Modified"
Enabled: true
LogTypes:
  - AWS.CloudTrail
Tags:
  - AWS
  - Security Control
  - Defense Evasion:Impair Defenses
Reports:
  CIS:
    - 3.14
  MITRE ATT&CK:
    - TA0005:T1562
Severity: Info
DedupPeriodMinutes: 720 # 12 hours
Description: An EC2 VPC was modified.
Runbook: https://docs.runpanther.io/alert-runbooks/built-in-rules/aws-ec2-vpc-modified
Reference: https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html
SummaryAttributes:
  - eventName
  - userAgent
  - sourceIpAddress
  - recipientAccountId
  - p_any_aws_arns
Tests:
  - Name: VPC Modified
    ExpectedResult: true
    Log:
      {
        "eventVersion": "1.05",
        "userIdentity":
          {
            "type": "AssumedRole",
            "principalId": "1111:tester",
            "arn": "arn:aws:sts::123456789012:assumed-role/tester",
            "accountId": "123456789012",
            "accessKeyId": "1",
            "sessionContext":
              {
                "sessionIssuer":
                  {
                    "type": "Role",
                    "principalId": "1111",
                    "arn": "arn:aws:iam::123456789012:role/tester",
                    "accountId": "123456789012",
                    "userName": "tester",
                  },
                "webIdFederationData": {},
                "attributes":
                  {
                    "mfaAuthenticated": "true",
                    "creationDate": "2019-01-01T00:00:00Z",
                  },
              },
          },
        "eventTime": "2019-01-01T00:00:00Z",
        "eventSource": "ec2.amazonaws.com",
        "eventName": "CreateVpc",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "console.ec2.amazonaws.com",
        "requestParameters":
          {
            "cidrBlock": "0.0.0.0/26",
            "instanceTenancy": "default",
            "amazonProvidedIpv6CidrBlock": false,
          },
        "responseElements":
          {
            "requestID": "1",
            "vpc":
              {
                "vpcId": "vpc-1",
                "state": "pending",
                "ownerId": "123456789012",
                "cidrBlock": "0.0.0.0/26",
                "cidrBlockAssociationSet":
                  {
                    "items":
                      [
                        {
                          "cidrBlock": "0.0.0.0/26",
                          "associationId": "vpc-cidr-assoc-1",
                          "cidrBlockState": { "state": "associated" },
                        },
                      ],
                  },
                "ipv6CidrBlockAssociationSet": {},
                "dhcpOptionsId": "dopt-1",
                "instanceTenancy": "default",
                "tagSet": {},
                "isDefault": false,
              },
          },
        "requestID": "1",
        "eventID": "1",
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }
  - Name: VPC Not Modified
    ExpectedResult: false
    Log:
      {
        "eventVersion": "1.05",
        "userIdentity":
          {
            "type": "AssumedRole",
            "principalId": "1111:tester",
            "arn": "arn:aws:sts::123456789012:assumed-role/tester",
            "accountId": "123456789012",
            "accessKeyId": "1",
            "sessionContext":
              {
                "sessionIssuer":
                  {
                    "type": "Role",
                    "principalId": "1111",
                    "arn": "arn:aws:iam::123456789012:role/tester",
                    "accountId": "123456789012",
                    "userName": "tester",
                  },
                "webIdFederationData": {},
                "attributes":
                  {
                    "mfaAuthenticated": "false",
                    "creationDate": "2019-01-01T00:00:00Z",
                  },
              },
          },
        "eventTime": "2019-01-01T00:00:00Z",
        "eventSource": "ec2.amazonaws.com",
        "eventName": "DescribeVpcs",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "Mozilla",
        "requestParameters": { "vpcSet": {}, "filterSet": {} },
        "responseElements": null,
        "requestID": "1",
        "eventID": "1",
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }
  - Name: Error Modifying VPC
    ExpectedResult: false
    Log:
      {
        "errorCode": "UnknownParameter",
        "eventVersion": "1.05",
        "userIdentity":
          {
            "type": "AssumedRole",
            "principalId": "1111:tester",
            "arn": "arn:aws:sts::123456789012:assumed-role/tester",
            "accountId": "123456789012",
            "accessKeyId": "1",
            "sessionContext":
              {
                "sessionIssuer":
                  {
                    "type": "Role",
                    "principalId": "1111",
                    "arn": "arn:aws:iam::123456789012:role/tester",
                    "accountId": "123456789012",
                    "userName": "tester",
                  },
                "webIdFederationData": {},
                "attributes":
                  {
                    "mfaAuthenticated": "true",
                    "creationDate": "2019-01-01T00:00:00Z",
                  },
              },
          },
        "eventTime": "2019-01-01T00:00:00Z",
        "eventSource": "ec2.amazonaws.com",
        "eventName": "CreateVpc",
        "awsRegion": "us-west-2",
        "sourceIPAddress": "111.111.111.111",
        "userAgent": "console.ec2.amazonaws.com",
        "requestParameters":
          {
            "cidrBlock": "0.0.0.0/26",
            "instanceTenancy": "default",
            "amazonProvidedIpv6CidrBlock": false,
          },
        "responseElements":
          {
            "requestID": "1",
            "vpc":
              {
                "vpcId": "vpc-1",
                "state": "pending",
                "ownerId": "123456789012",
                "cidrBlock": "0.0.0.0/26",
                "cidrBlockAssociationSet":
                  {
                    "items":
                      [
                        {
                          "cidrBlock": "0.0.0.0/26",
                          "associationId": "vpc-cidr-assoc-1",
                          "cidrBlockState": { "state": "associated" },
                        },
                      ],
                  },
                "ipv6CidrBlockAssociationSet": {},
                "dhcpOptionsId": "dopt-1",
                "instanceTenancy": "default",
                "tagSet": {},
                "isDefault": false,
              },
          },
        "requestID": "1",
        "eventID": "1",
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }

Detection logic

Condition

not (errorCode is_not_null or errorMessage is_not_null)
eventName in ["CreateVpc", "DeleteVpc", "ModifyVpcAttribute", "AcceptVpcPeeringConnection", "CreateVpcPeeringConnection", "DeleteVpcPeeringConnection", "RejectVpcPeeringConnection", "AttachClassicLinkVpc", "DetachClassicLinkVpc", "DisableVpcClassicLink", "EnableVpcClassicLink"]

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
errorCodeis_not_null(no value, null check)
errorMessageis_not_null(no value, null check)

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
eventNamein
  • AcceptVpcPeeringConnection
  • AttachClassicLinkVpc
  • CreateVpc
  • CreateVpcPeeringConnection
  • DeleteVpc
  • DeleteVpcPeeringConnection
  • DetachClassicLinkVpc
  • DisableVpcClassicLink
  • EnableVpcClassicLink
  • ModifyVpcAttribute
  • RejectVpcPeeringConnection

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

Field
eventName
eventSource
awsRegion
recipientAccountId
sourceIPAddress
userAgent
userIdentity