Detection rules › Panther

Lambda CRUD Actions

Severity
high
Group by
userIdentity.arn
Compliance
CIS 3.12
Log types
AWS.CloudTrail
Tags
AWS, Security Control, Configuration Required
Reference
https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html
Source
github.com/panther-labs/panther-analysis

Unauthorized lambda Create, Read, Update, or Delete event occurred.

MITRE ATT&CK coverage

TacticTechniques
PersistenceT1525 Implant Internal Image

Rule body yaml

AnalysisType: rule
Filename: aws_lambda_crud.py
RuleID: "AWS.LAMBDA.CRUD"
DisplayName: "Lambda CRUD Actions"
Enabled: false
LogTypes:
  - AWS.CloudTrail
Tags:
  - AWS
  - Security Control
  - Configuration Required
Reports:
  CIS:
    - 3.12
  MITRE ATT&CK:
    - TA0005:T1525
Severity: High
Description: Unauthorized lambda Create, Read, Update, or Delete event occurred.
Runbook: https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html
Reference: https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html
SummaryAttributes:
  - eventSource
  - eventName
  - recipientAccountId
  - awsRegion
  - p_any_aws_arns
Tests:
  - Name: Lambda DeleteFunction Unauthorized Account
    ExpectedResult: true
    Log:
      {
        "eventVersion": "1.03",
        "userIdentity":
          {
            "type": "IAMUser",
            "principalId": "A1B2C3D4E5F6G7EXAMPLE",
            "arn": "arn:aws:iam::999999999999:user/myUserName",
            "accountId": "999999999999",
            "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
            "userName": "myUserName",
          },
        "eventTime": "2015-03-18T19:04:42Z",
        "eventSource": "lambda.amazonaws.com",
        "eventName": "DeleteFunction",
        "awsRegion": "us-east-1",
        "sourceIPAddress": "127.0.0.1",
        "userAgent": "Python-httplib2/0.8 (gzip)",
        "requestParameters": { "functionName": "basic-node-task" },
        "responseElements": null,
        "requestID": "a2198ecc-cda1-11e4-aaa2-e356da31e4ff",
        "eventID": "20b84ce5-730f-482e-b2b2-e8fcc87ceb22",
        "eventType": "AwsApiCall",
        "recipientAccountId": "999999999999",
      }
  - Name: Lambda DeleteFunction Unauthorized User
    ExpectedResult: true
    Log:
      {
        "eventVersion": "1.03",
        "userIdentity":
          {
            "type": "IAMUser",
            "principalId": "A1B2C3D4E5F6G7EXAMPLE",
            "arn": "arn:aws:iam::123456789012:user/myUserName",
            "accountId": "123456789012",
            "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
            "userName": "myUserName",
          },
        "eventTime": "2015-03-18T19:04:42Z",
        "eventSource": "lambda.amazonaws.com",
        "eventName": "DeleteFunction",
        "awsRegion": "us-east-1",
        "sourceIPAddress": "127.0.0.1",
        "userAgent": "Python-httplib2/0.8 (gzip)",
        "requestParameters": { "functionName": "basic-node-task" },
        "responseElements": null,
        "requestID": "a2198ecc-cda1-11e4-aaa2-e356da31e4ff",
        "eventID": "20b84ce5-730f-482e-b2b2-e8fcc87ceb22",
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }
  - Name: Lambda DeleteFunction Authorized Account
    ExpectedResult: false
    Log:
      {
        "eventVersion": "1.03",
        "userIdentity":
          {
            "type": "IAMUser",
            "principalId": "A1B2C3D4E5F6G7EXAMPLE",
            "arn": "arn:aws:iam::123456789012:user/DeployRole",
            "accountId": "123456789012",
            "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
            "userName": "myUserName",
          },
        "eventTime": "2015-03-18T19:04:42Z",
        "eventSource": "lambda.amazonaws.com",
        "eventName": "DeleteFunction",
        "awsRegion": "us-west-1",
        "sourceIPAddress": "127.0.0.1",
        "userAgent": "Python-httplib2/0.8 (gzip)",
        "requestParameters": { "functionName": "basic-node-task" },
        "responseElements": null,
        "requestID": "a2198ecc-cda1-11e4-aaa2-e356da31e4ff",
        "eventID": "20b84ce5-730f-482e-b2b2-e8fcc87ceb22",
        "eventType": "AwsApiCall",
        "recipientAccountId": "123456789012",
      }

Detection logic

Condition

eventSource eq "lambda.amazonaws.com"
eventName in ["AddPermission", "CreateAlias", "CreateEventSourceMapping", "CreateFunction", "DeleteAlias", "DeleteEventSourceMapping", "DeleteFunction", "PublishVersion", "RemovePermission", "UpdateAlias", "UpdateEventSourceMapping", "UpdateFunctionCode", "UpdateFunctionConfiguration"]
userIdentity.arn not wildcard "*DeployRole"

Exclusions

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

FieldKindExcluded values
userIdentity.arnends_withDeployRole

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
  • AddPermission
  • CreateAlias
  • CreateEventSourceMapping
  • CreateFunction
  • DeleteAlias
  • DeleteEventSourceMapping
  • DeleteFunction
  • PublishVersion
  • RemovePermission
  • UpdateAlias
  • UpdateEventSourceMapping
  • UpdateFunctionCode
  • UpdateFunctionConfiguration
eventSourceeq
  • lambda.amazonaws.com

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.

FieldSource
eventName
eventSource
awsRegion
recipientAccountId
sourceIPAddress
userAgent
userIdentity
arnuserIdentity.arn