> 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-341.md).

# AWS Auto Scaling group launch configuration configured with Instance Metadata Service hop count grea

## Rule Details

|                        |                                         |
| ---------------------- | --------------------------------------- |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_341                        |
| Category - Subcategory | Compute - Unsanctioned Resource Or Type |
| Provider               | AWS                                     |
| Severity               | MEDIUM                                  |
| Framework              | Terraform, Terraform Plan               |
| Mapped CSPM/KSPM Rule  | d9b2ff26-a1b3-49a7-885a-dade1183d193    |

## Impact

This rule checks if the Launch template in AWS (Amazon Web Services) has a metadata response hop limit greater than 1. The metadata response hop limit is a security setting that determines how many networking hops (steps) an EC2 instance metadata request can traverse. If this limit is set to a value greater than 1, it could allow an attacker to potentially intercept the request and gain access to sensitive information. So it's always safer to limit it to 1 to minimize vulnerabilities.

## How to Fix

*Resource:* aws\_launch\_configuration, aws\_launch\_template

* *Arguments:* metadata\_options.http\_put\_response\_hop\_limit

## To fix the issue, you should enable the HttpPutResponseHopLimit on the AWS launch template and set it to 1. This limits the number of hops a metadata packet can take to 1, ensuring that the IMDSv1 is not reachable. \[source,go]

resource "aws\_launch\_template" "default" { name = "example"

block\_device\_mappings { device\_name = "/dev/sda1" }

instance\_market\_options { market\_type = "spot" }

## metadata\_options { http\_tokens = "required" http\_put\_response\_hop\_limit = 1 } }


---

# 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/appsec-rules/iac-security/compute/appsec-aws-341.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.
