Check ID:
Provider: AWS
Service:
Severity: HIGH
Categories:
Resource type:
ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mongodb_27017_27018Provider: AWS
Service:
ec2Severity: HIGH
Categories:
internet-exposedResource type:
AwsEc2SecurityGroupWhat this check verifies
EC2 security groups are inspected for inbound rules that expose MongoDB onTCP 27017-27018 to the Internet via 0.0.0.0/0 or ::/0.
It identifies groups where these ports are reachable from any address.
Risk
Public MongoDB ports invite unauthenticated probing, brute force, and misuse of weak configs. Attackers can read/alter data, drop collections, or deploy ransomware, compromising confidentiality and integrity. Exposure also enables enumeration and lateral movement, threatening availability.Recommendation
Apply least privilege to MongoDB access:- Block
0.0.0.0/0and::/0 - Allow only trusted IPs or private networks
- Prefer private connectivity and SG-to-SG references
- Enforce authentication and TLS
- Segment east-west traffic and monitor access for defense in depth
Remediation
- CLI
- Terraform
- Native IaC
- Dashboard steps
References
- https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html
- https://support.icompaas.com/support/solutions/articles/62000127019-ensure-security-groups-do-not-allow-unrestricted-ingress-access-to-mongodb-ports-27017-and-27018
Where this check fires
This check runs on every scheduled scan against your AWS account. Findings appear at Cloud Security → Findings filterable byCheck ID = ec2_securitygroup_allow_ingress_from_internet_to_tcp_port_mongodb_27017_27018. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to AWS checks