luizmachado.dev

PT EN

Open Source Software to Strengthen Security on AWS

1. Intrusion Detection (IDS/IPS)

1.1 Wazuh (OSSEC Fork)

  • What it is:

- Wazuh is a security platform that emerged as a fork of OSSEC, providing host-based intrusion detection (HIDS), log analysis, and file integrity monitoring (FIM).

  • Why use it on AWS:

- It can be integrated with EC2 instances, containers, or even on-premises VMs in a hybrid environment, consolidating all logs in the Wazuh Manager.

- It uses agents that monitor suspicious activities such as privilege escalation, critical file changes, unusual login attempts, etc.

  • Integrations:

- Combined with Amazon OpenSearch Service (formerly Elasticsearch), S3 (for log archiving), and Amazon Kinesis Firehose, you can scale event ingestion and correlation to hundreds or thousands of instances.

1.2 Suricata and Snort

  • What they are:

- Both are IDS/IPS (Intrusion Detection/Prevention Systems) tools based on signatures and behaviors. Suricata is maintained by the OISF (Open Information Security Foundation), while Snort is maintained by Cisco.

  • Why use them on AWS:

- They can be deployed in traffic mirroring mode (using VPC Traffic Mirroring) to inspect network traffic in real time and detect malicious activities.

  • Challenges:

- Scaling these tools in the network flow may require advanced solutions (for example, using Network Load Balancers and optimized instances). It is essential to plan the architecture well to avoid creating bottlenecks.

---

2. Container and Kubernetes Security

2.1 Falco

  • What it is:

- Falco (by Sysdig) is a CNCF (Cloud Native Computing Foundation) project focused on monitoring anomalous behaviors in containers and Kubernetes hosts.

  • Features:

- It observes kernel syscalls in real time, detecting suspicious events (for example, a container opening an unexpected interactive shell, modifications to sensitive directories, etc.).

  • Why use it on AWS:

- It integrates well with EKS (Amazon Elastic Kubernetes Service) and ECS (with Fargate or EC2).

- It can send alerts to services like AWS Security Hub or Amazon EventBridge, enabling automated responses.

2.2 Trivy, Clair, and Anchore Engine (Image Analysis)

  • Trivy (Aqua Security)

- Vulnerability and insecure configuration scanner for Docker images, configuration files, and code repositories.

- Easily integrates into CI/CD pipelines, preventing vulnerable images from being published to Amazon ECR.

  • Clair

- Created by CoreOS (now Red Hat), it scans containers for vulnerabilities. It stores metadata and history of discovered vulnerabilities.

  • Anchore Engine

- Beyond CVE scanning, it performs compliance analysis and container policy enforcement.

  • Why use them:

- AWS offers ECR Image Scanning (based on Amazon Inspector), but open source scanners can complement it with additional vulnerability repositories and greater policy granularity.

---

3. Configuration Analysis and Infrastructure as Code (IaC)

3.1 Checkov (Bridgecrew) and tfsec

  • What they are:

- Static security analysis tools for Terraform, CloudFormation, Kubernetes YAML, and other IaC definitions.

  • Benefits:

- They identify insecure configurations, such as open ports in security groups, lack of encryption on S3, overly permissive IAM roles, etc., before even going to production.

  • Why use them on AWS:

- They ensure compliance and security through shift-left (in the development pipeline).

- They integrate with Git repositories (GitHub, GitLab) and CI/CD pipelines, generating automatic reports or failing the build in case of policy violations.

3.2 Kube-score, kubeval, and Polaris

  • Focused on Kubernetes:

- kube-score: Evaluates readiness/liveness probes, CPU/memory resources, and recommended security practices (such as non-root).

- kubeval: Validates YAML definitions against the official Kubernetes schema.

- Polaris: Provides security and best practice auditing and recommendations for K8s deployments.

  • Relevance on EKS:

- Before applying a manifest to the EKS cluster, validate that configurations follow security practices. This minimizes configuration failures and vulnerabilities.

---

4. Monitoring and Open Source SIEM

4.1 ELK Stack (Elasticsearch, Logstash, Kibana) / OpenSearch

  • Log Collection and Analysis

- You can use Elasticsearch or AWS OpenSearch Service as a search and log analysis engine, with Logstash or Beats for ingestion and Kibana (or OpenSearch Dashboards) for visualization.

  • Why use it:

- It centralizes application logs, VPC Flow Logs, CloudTrail, and even IDS/IPS data like Suricata, facilitating event correlation and alert creation.

  • Integration with AWS:

- You can configure services like Amazon Kinesis Firehose to send logs directly to an OpenSearch cluster, whether self-hosted or managed by AWS.

4.2 Graylog

  • What it is:

- A log management platform that uses Elasticsearch/OpenSearch as a backend and offers analysis and dashboard generation features.

  • Differentiators:

- Less complex in some aspects than ELK, focused on simplified administration and alerting.

  • Challenges:

- Depending on data volume, you may need to increase cluster capacity. Planning for scalability and partitioning is crucial.

4.3 Open Source SIEM (OSSIM)

  • What it is:

- AlienVault OSSIM is an open source platform that includes intrusion detection (Snort/Suricata), log analysis, asset inventory, and event correlation.

  • Why use it:

- It can be a unified solution for monitoring small/medium hybrid environments, integrating with AWS (CloudTrail and VPC Flow Logs).

  • Limitations:

- In large-scale environments, the OSSIM version may require additional tuning and scalability effort.

---

5. Application and API Security

5.1 ModSecurity (Open Source WAF)

  • What it is:

- A popular web application firewall (WAF) that can detect and block attacks such as SQL Injection, XSS, and others based on OWASP Core Rule Set (CRS) rules.

  • Why use it on AWS:

- It can run on EC2 instances or containers in front of your application, or integrated into reverse proxies (such as Nginx, Apache, or HAProxy).

- When combined with Application Load Balancer or Network Load Balancer, you need to evaluate the architecture to properly redirect HTTP(s) traffic.

5.2 Gitleaks and Detect Secrets

  • Gitleaks

- Scans Git repositories for exposed secrets (keys, tokens, passwords).

  • Detect Secrets (by Yelp)

- Similar to Gitleaks, it detects credentials and sensitive information in commits.

  • Why use them:

- Prevents AWS credentials from being publicly exposed on GitHub, which is extremely dangerous.

- Integrating into the CI pipeline prevents merges containing secrets from occurring.

---

6. Integration and Response Automation

6.1 Amazon EventBridge and Lambda

  • Triggering Responses:

- You can configure rules that trigger Lambda functions or Step Functions upon receiving alerts from any open source tool (via CloudWatch logs or API).

- Example: upon detecting a malicious IP via Suricata, Lambda updates the Security Group or AWS WAF rules to block that IP.

6.2 AWS Security Hub

  • Centralizing Findings:

- Although it is a managed service, Security Hub can receive findings from partner solutions and, in some cases, from open source tools integrated via API or Amazon EventBridge.

- This allows correlating findings from GuardDuty, Inspector, and your open source IDS solution in a single dashboard.

---

7. General Best Practices

  1. Plan for Scalability

- Open source tools require attention to capacity and performance. If the environment generates many logs, evaluate the use of managed services or distributed architectures (for example, a Suricata cluster or ELK/OpenSearch cluster).

  1. Automate Patches and Updates

- It is vital to keep security tools always up to date, fixing flaws and ensuring new detection signatures. Use CI/CD pipelines and automation scripts (CloudFormation, Terraform, Ansible).

  1. Integrate with Native Services

- A hybrid strategy (open source + AWS native services) usually maximizes benefits. For example, using Suricata with VPC Traffic Mirroring and correlating findings in GuardDuty for 360° detection.

  1. Monitor Storage and Processing Costs

- Logs can grow exponentially. Evaluate retention policies, compression (at ingestion), and transition to S3 Glacier if you need to keep logs for long-term compliance.

  1. Perform Intrusion Testing and Red Team Exercises

- To effectively validate your security tools, simulate attack scenarios. This verifies whether alerts and automated responses work as expected.

---

Conclusion

Adopting open source tools for AWS workload security can offer advantages such as transparency, high customization, and broad integration with different ecosystems. However, it is essential to carefully evaluate the complexity of deployment, maintenance, and scalability of each solution — often, a hybrid approach, combining managed services (such as GuardDuty, Security Hub, or Inspector) with open source projects (Wazuh, Falco, Suricata, Trivy, etc.), brings the best of both worlds.

---

Additional Resources