AWS-0102 is triggered for NACL rule **denying** access to/from all ports #7004
Replies: 3 comments 5 replies
-
Hi @majacannavo ! Thanks for the report. Indeed, for the following Terraform configuration the rule "AVD-AWS-0102" is triggered:
But this is only valid for terraform configuration, since in CF "all" is an invalid value for the protocol. But I'm a little confused by the steps for reproducing it. You say to create a configuration that allows traffic for a specific set of ports and give an example of a deny rule for all ports. Your configuration looks good and the rule shouldn't be triggered. cat main.json
{
"Resources": {
"MyNACL": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": "vpc-1122334455aabbccd",
"Tags": [
{
"Key": "Name",
"Value": "NACLforSSHTraffic"
}
]
}
},
"InboundRule": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "MyNACL"
},
"RuleNumber": 100,
"Protocol": -1,
"RuleAction": "deny",
"CidrBlock": "0.0.0.0/0"
}
},
"OutboundRule": {
"Type": "AWS::EC2::NetworkAclEntry",
"Properties": {
"NetworkAclId": {
"Ref": "MyNACL"
},
"RuleNumber": 100,
"Protocol": -1,
"Egress": false,
"RuleAction": "deny",
"CidrBlock": "0.0.0.0/0"
}
}
}
}%
trivy conf main.json
2024-06-25T13:26:23+07:00 INFO Misconfiguration scanning is enabled
2024-06-25T13:26:24+07:00 INFO Detected config files num=1 |
Beta Was this translation helpful? Give feedback.
-
Created #7006 |
Beta Was this translation helpful? Give feedback.
-
Hi @nikpivkin , thanks for your response! Here's the full list of NACL entries (with exact port numbers redacted -- some are single ports and some are ranges) -- hopefully this is enough to reproduce the issue. {
"NetworkAcls": [
{
...
"Entries": [
{
"CidrBlock": "0.0.0.0/0",
"Egress": true,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 20
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": true,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 30
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": true,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 40
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": true,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 60
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": true,
"Protocol": "-1",
"RuleAction": "deny",
"RuleNumber": 32767
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 20
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 30
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 40
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 50
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"PortRange": {
"From": xx,
"To": xx
},
"Protocol": "6",
"RuleAction": "allow",
"RuleNumber": 60
},
{
"CidrBlock": "0.0.0.0/0",
"Egress": false,
"Protocol": "-1",
"RuleAction": "deny",
"RuleNumber": 32767
}
],
"IsDefault": false,
...
}
]
} |
Beta Was this translation helpful? Give feedback.
-
IDs
AVD-AWS-0102
Description
When a VPC's NACL contains an entry like
that denies access from all ports, it triggers AWS-0102:
Network ACL rule allows access using ALL ports.
Reproduction Steps
Target
Filesystem
Scanner
Misconfiguration
Target OS
No response
Debug Output
Version
Checklist
-f json
that shows data sources and confirmed that the security advisory in data sources was correctBeta Was this translation helpful? Give feedback.
All reactions