> 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-ecr-private-repository-with-cross-account-access.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# AWS ECR private repository with cross-account access

### Synopsis

| Field               | Value                                                |
| ------------------- | ---------------------------------------------------- |
| Rule Type           | Detection                                            |
| Finding Type        | AWS ECR private repository with cross-account access |
| Finding ID          | 60001487                                             |
| Generates a Finding | This detection rule also generates a finding         |
| Severity            | Medium                                               |
| Category            | CONFIGURATION                                        |
| Cloud Providers     | AWS                                                  |
| Platform Module     | CSPM                                                 |
| Asset Types         | CONTAINER\_IMAGE\_REPOSITORY                         |

### Description

AWS ECR repositories configured for cross-account access pose a significant security risk, potentially leading to unauthorized image access and data breaches.

AWS ECR offers private repositories for storing Docker container images. Enabling cross-account access allows accounts outside the owner's to pull or push images. Untrusted accounts gaining access could download sensitive images, deploy malicious containers, or exfiltrate data. This misconfiguration undermines the intended security of private repositories.

Compromised images or data leaks could disrupt services, expose sensitive information, and violate compliance regulations. Restricting access to only trusted accounts is crucial to maintain the integrity and confidentiality of container images and their associated data.

Implement strong access controls using IAM roles and policies. Limit cross-account access to specific accounts only when absolutely necessary, regularly reviewing and revoking unnecessary permissions. Employ least privilege, granting only the minimum required 'pull' or 'push' access to each authorized account. Monitor access logs for suspicious activity.

### Remediation

To restrict the access to AWS ECR private repository policy, perform the following actions:

1. Log in to the AWS Console
2. In the console, select the specific region from the region drop-down on the top right corner, for which the alert is generated.
3. Navigate to the 'ECR' dashboard from the 'Services' dropdown
4. In the navigation pane, choose 'Repositories'
5. On the Repositories page, Select the repository for which the alert is being generated
6. From the repository image list view, in the navigation pane, choose 'Permissions' from 'Actions' dropdown, and Edit.
7. On the Edit permissions page, Click on 'Edit policy JSON' to modify the JSON so that Principal is restrictive

   7a. Remove the statements that grant access to actions to other AWS accounts

   or

   7b. Remove the permitted actions from the statements
8. After modifications, click on 'Save'.


---

# 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-ecr-private-repository-with-cross-account-access.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.
