Check ID: ec2_instance_port_elasticsearch_kibana_exposed_to_internet
Provider: AWS
Service: ec2
Severity: CRITICAL
Categories: internet-exposed
Resource type: AwsEc2Instance

What this check verifies

EC2 instances with Elasticsearch/Kibana ports (9200, 9300, 5601) exposed to the Internet through inbound security group rules. Assesses reachability considering instance public IP and subnet to reflect real exposure.

Risk

Public access to Elasticsearch/Kibana can lead to:
  • Unauthorized queries or dashboard viewing confidentiality loss
  • Index changes or cluster control via 9300 integrity impact
  • Scans and bulk queries availability degradation
Enables data exfiltration and lateral movement.

Recommendation

Apply least privilege to network exposure:
  • Restrict 9200, 9300, 5601 to trusted sources or keep them private
  • Use private subnets, VPN/peering, or bastion/SSM for admin access
  • Enforce authentication and TLS on Elasticsearch/Kibana
  • Avoid public IPs unless strictly required

Remediation

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

References

Where this check fires

This check runs on every scheduled scan against your AWS account. Findings appear at Cloud Security → Findings filterable by Check ID = ec2_instance_port_elasticsearch_kibana_exposed_to_internet. 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