> 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-network-acls-allow-ingress-traffic-on-admin-ports-22-3389.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# AWS Network ACLs allow ingress traffic on Admin ports 22/3389

### Synopsis

| Field               | Value                                                         |
| ------------------- | ------------------------------------------------------------- |
| Rule Type           | Detection                                                     |
| Finding Type        | AWS Network ACLs allow ingress traffic on Admin ports 22/3389 |
| Finding ID          | 60000961                                                      |
| Generates a Finding | This detection rule also generates a finding                  |
| Severity            | High                                                          |
| Category            | CONFIGURATION                                                 |
| Cloud Providers     | AWS                                                           |
| Platform Module     | CSPM                                                          |
| Asset Types         | EC2\_NETWORK\_ACL                                             |
| ATT\&CK Tactic      | TA0112 (TA0112)                                               |
| ATT\&CK Technique   | T1685 (T1685)                                                 |

### Description

AWS Network Access Control Lists (NACLs) permitting inbound traffic on administrative ports 22 (SSH) and 3389 (RDP) create a significant security misconfiguration.

AWS NACLs control network traffic to and from resources. Allowing unrestricted ingress on ports 22 and 3389 exposes EC2 instances and other resources to unauthorized access. Attackers could exploit this misconfiguration to gain control of systems, potentially leading to data breaches, lateral movement within the network, and ransomware attacks.

The impact of this misconfiguration includes compromised systems, data loss, and disruption of services. Restricting access to administrative ports minimizes the attack surface and strengthens security posture. Following this best practice reduces the risk of unauthorized access and maintains a secure environment.

To mitigate this risk, restrict inbound access to ports 22 and 3389 using NACLs. Implement least privilege access, allowing only trusted IP addresses access to these ports.

### Remediation

**Manual steps:**

EC2 Network ACL - This security issue identifies AWS Network Access Control Lists (NACLs) that allow ingress traffic on server administration ports (SSH port 22 and RDP port 3389). This configuration increases the vulnerability of EC2 instances and other network resources to unauthorized access and cyberattacks:

1. Sign in to the AWS console and navigate to the Amazon VPC console.
2. In the navigation pane, choose 'Network ACLs' under the 'Security' section.
3. Select the reported Network ACL.
4. Click on 'Actions' and select 'Edit inbound rules'.
5. Identify the rule that allows ingress traffic from '0.0.0.0/0' or '::/0' and includes port 22 or 3389 in the 'Port Range'.
6. Click on 'Remove' to remove this rule.
7. Click on 'Save' to apply the changes.

**Note:** Carefully review and test the changes before implementing them in a production environment. Removing rules from your NACLs can impact the connectivity of your resources. Ensure that you understand the impact of the changes before proceeding.

**CLI code:**

EC2 Network ACL - This command modifies the specified Network ACL entry to deny ingress traffic on the specified port range. The '--dry-run' option simulates the command without making any changes. To apply the changes, remove '--dry-run':

```bash
aws ec2 replace-network-acl-entry --network-acl-id ${entity} --rule-number <ruleNumber> --rule-action deny --protocol <protocol> --port-range From=<fromPort>,To=<toPort> --ingress --cidr-block 0.0.0.0/0 --dry-run
```

**Terraform code:**

EC2 Network ACL - This Terraform code snippet modifies the existing AWS Network ACLs to remove the rule that allows ingress traffic on admin ports 22/3389 from 0.0.0.0/0. This helps in resolving the security violation by preventing unauthorized access to server administration ports:

```hcl
# The following code block will modify the existing AWS Network ACLs to remove the rule that allows ingress traffic on admin ports 22/3389.
resource "aws_network_acl" "example_acl" {
 # ... other configurations

 ingress {
 protocol = ["REPLACE_WITH_YOUR_VALUE"]
 rule_no = ["REPLACE_WITH_YOUR_VALUE"]
 cidr_block = ["REPLACE_WITH_YOUR_VALUE"] #Replace the CIDR block 0.0.0.0/0 with Trusted/allowed IP ranges
 from_port = ["REPLACE_WITH_ADMIN_PORTS"]
 to_port = ["REPLACE_WITH_ADMIN_PORTS"]
 }
}
```


---

# 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-network-acls-allow-ingress-traffic-on-admin-ports-22-3389.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.
