Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudTrail: DataEvents not enabled is incorrect #1674

Open
teddy-codes opened this issue Oct 8, 2024 · 0 comments
Open

CloudTrail: DataEvents not enabled is incorrect #1674

teddy-codes opened this issue Oct 8, 2024 · 0 comments
Labels
bug Something isn't working potential Unconfirmed issue

Comments

@teddy-codes
Copy link

teddy-codes commented Oct 8, 2024

When using ScoutSuite to audit our infrastructure, we came across a problem where data events were incorrectly being logged.

Our CloudTrail logs from aws look like this:

{
  "TrailARN": "<trail-arn>",
  "EventSelectors": [
    {
      "ReadWriteType": "All",
      "IncludeManagementEvents": true,
      "DataResources": [
        {
          "Type": "AWS::Lambda::Function",
          "Values": [
            "arn:aws:lambda"
          ]
        }
      ],
      "ExcludeManagementEventSources": []
    },
    {
      "ReadWriteType": "All",
      "IncludeManagementEvents": true,
      "DataResources": [
        {
          "Type": "AWS::S3::Object",
          "Values": [
            "arn:aws:s3:::"
          ]
        }
      ],
      "ExcludeManagementEventSources": []
    },
    {
      "ReadWriteType": "All",
      "IncludeManagementEvents": true,
      "DataResources": [],
      "ExcludeManagementEventSources": []
    }
  ]
}

This is the check that is occuring:

for event_selector in trail.get('EventSelectors', []):
trail['DataEventsEnabled'] = len(event_selector['DataResources']) > 0
trail['ManagementEventsEnabled'] = event_selector['IncludeManagementEvents']

Which is incorrect as it reads not ALL data events, but overwrites DataEventsEnabled while iterating through the EventSelectors.

@teddy-codes teddy-codes added bug Something isn't working potential Unconfirmed issue labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working potential Unconfirmed issue
Projects
None yet
Development

No branches or pull requests

1 participant