> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/aws-cloudtrail-bucket-is-publicly-accessible.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# AWS CloudTrail bucket is publicly accessible

### Synopsis

| Field               | Value                                        |
| ------------------- | -------------------------------------------- |
| Rule Type           | Detection                                    |
| Finding Type        | AWS CloudTrail bucket is publicly accessible |
| Finding ID          | 60000001                                     |
| Generates a Finding | This detection rule also generates a finding |
| Severity            | High                                         |
| Category            | CONFIGURATION                                |
| Cloud Providers     | AWS                                          |
| Platform Module     | CSPM                                         |
| Asset Types         | S3\_BUCKET                                   |
| ATT\&CK Tactic      | TA0010 (TA0010)                              |
| ATT\&CK Technique   | T1530 (T1530)                                |

### Description

Publicly accessible Amazon S3 buckets storing AWS CloudTrail data pose a significant security risk, enabling unauthorized access to sensitive audit logs. This exposes crucial information about account activity, potentially leading to data breaches and compromised security posture.

CloudTrail logs contain detailed records of API calls made within the AWS account. Storing these logs in a publicly accessible S3 bucket allows anyone to download and analyze this data, revealing sensitive information such as user activity, infrastructure configurations, and security events. Attackers could exploit this to gain unauthorized access or identify further vulnerabilities within the environment.

The impact of this misconfiguration is severe, resulting in data breaches, regulatory non-compliance, and reputational damage. Maintaining the confidentiality and integrity of CloudTrail data is crucial for effective security monitoring and incident response. Best practices mandate strict access control to protect sensitive audit data.

To mitigate this risk, ensure that S3 buckets storing CloudTrail data are configured with appropriate access control lists (ACLs) and bucket policies. Restrict access to only authorized users and applications using IAM roles and policies. Regularly review and update access controls to prevent unauthorized access. Utilize CloudTrail's integration with other AWS services, like Amazon S3, for secure log storage and management.

### Remediation

**Manual steps:**

S3 Bucket - This remediation address the S3 bucket storing CloudTrail data that is publicly accessible. This poses a significant security risk as sensitive audit data could be accessed by unauthorized individuals or applications:

1. **Access the S3 Bucket:** Log in to the AWS Console and navigate to the 'S3' service. Locate the S3 bucket identified in the alert.
2. **Review Permissions:** Within the S3 bucket, click on the 'Permissions' tab.
3. **Access Control List (ACL):** If the 'Access Control List' is set to 'Public', follow these steps:
   1. Click on 'Everyone' under 'Access Control List'.
   2. Uncheck all items under 'Everyone'.
   3. Click on 'Save'.
4. **Bucket Policy:** If the 'Bucket Policy' is set to public, follow these steps:
   1. Under 'Bucket Policy', modify the policy to revoke public access. Ensure that the policy only grants access to authorized users or applications.
   2. Click on 'Save'.
   3. If the 'Bucket Policy' is not required, delete the existing 'Bucket Policy'.

**Note:** Carefully review and test the changes made to the S3 bucket's permissions before implementing them. Ensure that the modifications do not disrupt the intended access to CloudTrail data by authorized users or applications.

**CLI code:**

S3 Bucket - This command sets the public access block configuration for the S3 bucket identified in the finding. It disables public access to the bucket by setting all public access block configuration options to true:

```bash
aws s3api put-public-access-block --bucket ${entity} --public-access-block-configuration '{"BlockPublicAcls":true,"IgnorePublicAcls":true,"BlockPublicPolicy":true,"RestrictPublicBuckets":true}' --region ${entity}
```

**Terraform code:**

S3 Bucket - This Terraform code remediates the policy violation by configuring the CloudTrail bucket to be private. It creates a new S3 bucket for CloudTrail logs, configures bucket logging for the new bucket, and updates the CloudTrail trail to use the new bucket. This ensures that CloudTrail logs are stored in a private S3 bucket, protecting sensitive audit data:

```hcl
# Configure the CloudTrail bucket to be private
resource "aws_s3_bucket_public_access_block" "example" {
  bucket = aws_s3_bucket.example.id
  block_public_acls       = true
  block_public_policy     = true
  ignore_public_acls      = true
  restrict_public_buckets = true
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/aws-cloudtrail-bucket-is-publicly-accessible.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
