Back to controls

Ensure that Elasticsearch database is not exposed to the internet (ports 9200 and/or 9300)

Services and databases store data that may be sensitive, protected by law, subject to regulatory requirements or compliance standards.

Category

Controls

Medium

Applies to

AWS

Coverage

1 queries

Asset types

1 covered

Overview

Services and databases store data that may be sensitive, protected by law, subject to regulatory requirements or compliance standards.

Review the affected security group and reduce its scope if possible.

We recommend accessing Elasticsearch only from within your VPC.

Remediation guidance

AWS remediation

Restrict Elasticsearch/OpenSearch ports 9200 and 9300 to trusted sources only.

Console

  1. Open affected security group.
  2. Remove 0.0.0.0/0 and ::/0 ingress on ports 9200 and 9300.
  3. Allow only trusted CIDRs or app security groups.

AWS CLI

aws ec2 revoke-security-group-ingress \
  --group-id <sg-id> \
  --ip-permissions IpProtocol=tcp,FromPort=9200,ToPort=9200,IpRanges='[{CidrIp=0.0.0.0/0}]'
aws ec2 revoke-security-group-ingress \
  --group-id <sg-id> \
  --ip-permissions IpProtocol=tcp,FromPort=9300,ToPort=9300,IpRanges='[{CidrIp=0.0.0.0/0}]'

References

  • https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html
  • https://docs.aws.amazon.com/cli/latest/reference/ec2/revoke-security-group-ingress.html

Service-wide remediation

Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.

AWS

Use AWS Organizations guardrails, AWS Config rules or conformance packs where they fit, approved account baselines, and IaC modules so new resources inherit the secure setting.

Operational rollout

  1. Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
  2. Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
  3. Re-scan and track approved exceptions with an owner and expiry date.

Query logic

These are the stored checks tied to this control.

Potential Elasticsearch database exposed to the internet (ports 9200 and/or 9300)

Connectors

AWS

Covered asset types

SecurityGroup

Expected check: eq []

{ securityGroups(where: {vms_NOT: null, rules_SOME: {direction: "Inbound", AND: [{OR: [{sources_INCLUDES: "cidr:0.0.0.0/0"}, {sources_INCLUDES: "cidr:::/0"}]}, {OR: [{destFromPort_LTE: 9200, destToPort_GTE: 9200}, {destFromPort_LTE: 9300, destToPort_GTE: 9300}]}]}}) {...AssetFragment}}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon