> 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/appsec-rules/iac-security/compute/appsec-aws-386.md).

# Potential WhoAMI name confusion attack exposure misconfiguration detected in code

## Rule Details

|                       |                           |
| --------------------- | ------------------------- |
| Cortex AppSec Rule ID | APPSEC\_AWS\_386          |
| Category              | Compute                   |
| Provider              | AWS                       |
| Severity              | LOW                       |
| Framework             | Terraform, Terraform Plan |

## Impact

This rule checks for the potential misuse of cloud image names that could lead to confusion or malicious exploitation, specifically in the context of Amazon Web Services (AWS). The risk arises when an attacker might attempt to name their malicious images similarly to widely-used or trusted images, such as "ami-ubuntu," leading users to inadvertently select the harmful image instead of the legitimate one.

Allowing for such name collisions can facilitate social engineering attacks, as users might assume they are launching trusted images based on naming conventions rather than verifying the source or integrity of the image. This can compromise security and lead to unauthorized access or the deployment of malicious software, ultimately putting sensitive data and infrastructure at risk. It is crucial to ensure that image naming conventions are clear, unique, and well-documented to mitigate this risk.

## How to Fix

## To reduce the potential for WhoAMI cloud image name confusion attacks, ensure that the `name` attribute of your `aws_ami` resource is unique and descriptive or include an `owner`. \[source,go]

data "aws\_ami" "fail1" {

* owners = \["099720109477"] # Owner added

filter { name = "name"

* values = \["ubuntu/images/hvm-ssd/ubuntu-*-amd64-server"] # "*" in name
* values = \["ubuntu/images/hvm-ssd/ubuntu-20.04-amd64-server-20230517"] # Specific version } }

***


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/compute/appsec-aws-386.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
