Use this when configuring cloud security groups.
Security Groups
packet → SG rules → allow
Context & applicabilityCommon mistakes · platform/version boundaries
- Opening 0.0.0.0/0 temporarily for troubleshooting and forgetting it.
- One security group shared by many unrelated workloads.
- Using IP rules where security group references would be clearer.
- Not reviewing rules with flow logs to find unused ones.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Finding risky rules Verify boundary
aws ec2 describe-security-groups --query "SecurityGroups[?IpPermissions[?IpRanges[?CidrIp=='0.0.0.0/0']]].[GroupId,GroupName]"
az network nsg list --query "[].securityRules[?sourceAddressPrefix=='*' || sourceAddressPrefix=='Internet']"
Rules allowing 0.0.0.0/0 on SSH (22), RDP (3389) or database ports are the first to fix.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Security groups are stateful.
- Reference other groups instead of wide CIDRs.
- 0.0.0.0/0 on admin ports is a critical finding.
aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values=0.0.0.0/0— open to world- Unused security groups — cleanup
- References between SGs — least privilege
ReferenceWhy it matters1 section · depth on demand
Rules of thumb
- Allow only required ports from specific sources; never
0.0.0.0/0on SSH/RDP/databases. - Reference other security groups instead of IP ranges inside the VPC.
- Security groups are stateful (return traffic allowed); NACLs are stateless.
- Review unused and overly broad rules with CSPM.
aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values=0.0.0.0/0 finds open rules.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Security groups (AWS) and network security groups (Azure) are stateful, virtual firewalls attached to instances or network interfaces. They allow traffic based on protocol, port and source/destination, and return traffic is allowed automatically.
Good practice:
| Practice | Example |
|---|---|
| Least privilege rules | Allow 443 from the load balancer's group, not from anywhere |
| Reference groups instead of IPs | App tier allows DB access from "app-sg" |
| No admin ports to the internet | SSH/RDP via bastion or session manager |
| Descriptive names and tags | Purpose and owner on every rule |
| Regular review | Remove unused rules and groups |
aws ec2 describe-security-groups --query "SecurityGroups[?IpPermissions[?IpRanges[?CidrIp=='0.0.0.0/0']]].[GroupId,GroupName]"
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Cloud Security → Security Groups. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://csrc.nist.gov/pubs/sp/800/210/final · confidence 94%