Skip to main content

🧠 AWS EC2 Security Group allows public IPv4 (0.0.0.0/0) access to admin ports - prod.logic.yaml 🟒

Flags​

Input Type​

TypeAPI NameExtractsExtract FilesLogic Files
πŸ”’πŸ“• AWS EC2 Security GroupCA10__CaAwsSecurityGroup__c1117

Uses​

Test Results πŸŸ’β€‹

Generated at: 2025-04-24T23:44:35.705692539Z Open

ResultIdCondition IndexCondition TextRuntime Error
🟒test1βœ”οΈ 99βœ”οΈ isDisappeared(CA10__disappearanceTime__c)βœ”οΈ null
🟒test2βœ”οΈ 199βœ”οΈ CA10__AWS_EC2_Security_Group_Rules__r.has(INCOMPLIANT)βœ”οΈ null
🟒test3βœ”οΈ 199βœ”οΈ CA10__AWS_EC2_Security_Group_Rules__r.has(INCOMPLIANT)βœ”οΈ null
🟒test4βœ”οΈ 199βœ”οΈ CA10__AWS_EC2_Security_Group_Rules__r.has(INCOMPLIANT)βœ”οΈ null
🟒test5βœ”οΈ 199βœ”οΈ CA10__AWS_EC2_Security_Group_Rules__r.has(INCOMPLIANT)βœ”οΈ null
🟒test6βœ”οΈ 199βœ”οΈ CA10__AWS_EC2_Security_Group_Rules__r.has(INCOMPLIANT)βœ”οΈ null
🟒test7βœ”οΈ 200βœ”οΈ otherwiseβœ”οΈ null
🟒test8βœ”οΈ 200βœ”οΈ otherwiseβœ”οΈ null
🟒test9βœ”οΈ 200βœ”οΈ otherwiseβœ”οΈ null
🟒test10βœ”οΈ 200βœ”οΈ otherwiseβœ”οΈ null
🟒test11βœ”οΈ 200βœ”οΈ otherwiseβœ”οΈ null

Generation​

FileMD5
Open/ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/policy.yaml891E68A0C63B092E6AA4DDBEE94C857F
Open/ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/prod.logic.yaml3C1DD3E3D6AD04825C41CC524C6F0F58
Open/ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/test-data.jsonAE2B2619878774C1DCDA1180B94352D3
Open/types/CA10__CaAwsSecurityGroupRule2__c/object.extracts.yaml58DC1872D7462985D50972C65C61C237

Generate FULL script​

java -jar repo-manager.jar policies generate FULL /ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/prod.logic.yaml

Generate DEBUG script​

java -jar repo-manager.jar policies generate DEBUG /ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/prod.logic.yaml

Generate CAPTURE_TEST_DATA script​

java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/prod.logic.yaml

Generate TESTS script​

java -jar repo-manager.jar policies generate TESTS /ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/prod.logic.yaml

Execute tests​

java -jar repo-manager.jar policies test /ce/ca/aws/ec2/security-group-allows-public-ipv4-to-admin-ports/prod.logic.yaml

Content​

Open File

---
inputType: "CA10__CaAwsSecurityGroup__c"
testData:
- file: "test-data.json"
conditions:
- status: "INCOMPLIANT"
currentStateMessage: "This Security Group allows ingress from 0.0.0.0/0 to remote server administration ports."
remediationMessage: "Consider changing the Security Group source field to a range other than 0.0.0.0/0 or delete the offending inbound rule."
check:
RELATED_LIST_HAS:
status: "INCOMPLIANT"
relationshipName: "CA10__AWS_EC2_Security_Group_Rules__r"
otherwise:
status: "COMPLIANT"
currentStateMessage: "This Security Group doesn't allow ingress from 0.0.0.0/0."
relatedLists:
- relationshipName: "CA10__AWS_EC2_Security_Group_Rules__r"
importExtracts:
- file: "/types/CA10__CaAwsSecurityGroupRule2__c/object.extracts.yaml"
conditions:
- status: "INAPPLICABLE"
currentStateMessage: "This is an outbound security group rule."
check:
NOT_EQUAL:
left:
EXTRACT: "CA10__direction__c"
right:
TEXT: "Inbound"
- status: "INAPPLICABLE"
currentStateMessage: "This security group rule does not allow unrestricted access."
check:
NOT_EQUAL:
left:
EXTRACT: "CA10__sourceIpRange__c"
right:
TEXT: "0.0.0.0/0"
- status: "INAPPLICABLE"
currentStateMessage: "This security group rule protocol is not All, TCP, or UDP."
check:
# check that protocol is neither all, tcp, or udp
NOT:
arg:
OR:
args:
- IS_EQUAL:
left:
EXTRACT: "CA10__protocol__c"
right:
TEXT: "All"
- IS_EQUAL:
left:
EXTRACT: "CA10__protocol__c"
right:
TEXT: "tcp"
- IS_EQUAL:
left:
EXTRACT: "CA10__protocol__c"
right:
TEXT: "udp"
- status: "INCOMPLIANT"
currentStateMessage: "This Security Group allows ingress from 0.0.0.0/0."
remediationMessage: "Consider changing the source field to a range other than 0.0.0.0/0 or delete the offending inbound rule."
check:
# check that port range either includes port 22 or port 3389, or the range is empty (all ports)
OR:
args:
- AND:
args:
- LESS_THAN_EQUAL:
left:
EXTRACT: "CA10__fromPort__c"
right:
NUMBER: 22.0
- GREATER_THAN_EQUAL:
left:
EXTRACT: "CA10__toPort__c"
right:
NUMBER: 22.0
- AND:
args:
- LESS_THAN_EQUAL:
left:
EXTRACT: "CA10__fromPort__c"
right:
NUMBER: 3389.0
- GREATER_THAN_EQUAL:
left:
EXTRACT: "CA10__toPort__c"
right:
NUMBER: 3389.0
- IS_EMPTY:
arg:
EXTRACT: "CA10__fromPort__c"
- IS_EMPTY:
arg:
EXTRACT: "CA10__toPort__c"
otherwise:
status: "COMPLIANT"
currentStateMessage: "This Security Group doesn't allow ingress from 0.0.0.0/0."