Search for Well Architected Advice
< All Topics
Print

Reduce attack surface

Reducing the attack surface of your compute resources helps to minimize exposure to security risks by limiting the number of components, libraries, and services that can be exploited by attackers. This involves hardening operating systems, removing unnecessary software or services, and ensuring that only essential elements are present in your workloads. By adopting industry best practices for hardening and reducing the attack surface, you enhance the security of your infrastructure and applications.

  1. Harden operating systems: Begin by hardening the operating systems of your compute resources, such as EC2 instances or containers. Disable unnecessary services, ports, and protocols, and remove unused operating system packages. Follow security configuration guides like the Center for Internet Security (CIS) benchmarks for common operating systems to ensure that your systems are configured securely.
  2. Remove unused components and libraries: For EC2-based workloads, remove any unused applications, software packages, or libraries that are not essential to the system’s function. For serverless and container-based environments, minimize the use of external libraries or modules that could introduce vulnerabilities. Every additional component adds to the potential attack surface, so removing unused elements reduces the chance of exploitation.
  3. Use minimal base images for containers: When deploying containerized workloads, use minimal base images (such as Alpine Linux) to reduce the number of unnecessary software packages included in the container. This limits the attack surface and helps to ensure that only essential components are present in the runtime environment.
  4. Secure external dependencies: Review and regularly audit external software modules and third-party libraries used in your application code. Ensure that you are using the latest, secure versions of these libraries, and avoid dependencies that are not actively maintained or pose known security risks.
  5. Disable unnecessary network access: For EC2 instances or other compute resources, restrict unnecessary network access by disabling or blocking unused ports and services. Configure security groups and network access control lists (ACLs) to allow traffic only to the necessary components and applications.
  6. Leverage automation for hardening: Use tools like AWS Systems Manager or third-party solutions to automate the hardening of EC2 instances and other compute resources. Automating hardening processes helps ensure consistency across your environment and reduces human error.
  7. Regularly update and review hardening policies: Continuously review and update your hardening policies as your infrastructure evolves. Regularly audit your compute resources to ensure that no unnecessary components, services, or libraries are running, and remove any that are no longer required.

Supporting Questions:

  • How do you ensure that your compute resources are hardened and only essential components are running?
  • What processes do you use to minimize the use of external dependencies and unnecessary software libraries?
  • How do you regularly audit and review your infrastructure to maintain a reduced attack surface?

Roles and Responsibilities:

Security Engineer:

  • Responsibilities:
    • Implement operating system hardening policies based on best practices such as CIS benchmarks for all EC2 instances and containers.
    • Regularly audit and review external software modules, libraries, and operating system packages to ensure they do not introduce vulnerabilities.

Cloud Administrator:

  • Responsibilities:
    • Remove unused components from EC2-based workloads and container images to minimize the attack surface.
    • Configure and manage security groups and network ACLs to restrict unnecessary network access.
    • Automate the hardening of compute resources using AWS Systems Manager or other automation tools.

Artefacts:

  • Hardening Policy Documentation: Documentation outlining hardening processes and security configurations applied to EC2 instances, containers, and other compute resources.
  • Audit Reports: Regular audit reports from AWS Config or third-party tools showing removed components, hardened systems, and minimized attack surfaces.
  • Security Group and ACL Configurations: Records of network access control configurations that restrict traffic to essential services and ports.

Relevant AWS Services:

AWS Compute and Security Services:

  • AWS Systems Manager: Automates the patching and hardening of EC2 instances and other compute resources, ensuring that unnecessary components are removed and security configurations are consistently applied.
  • AWS Config: Monitors your AWS resources for configuration changes and can be used to audit systems for compliance with hardening and security policies.
  • Amazon Inspector: Scans EC2 instances and containers for vulnerabilities and deviations from hardening benchmarks, helping identify potential security risks in your compute environment.
  • AWS Security Groups and Network ACLs: Control inbound and outbound network access to EC2 instances and other compute resources, restricting unnecessary services and ports.

Third-Party and Hardening Guides:

  • CIS Benchmarks: Industry-standard security configuration guides for hardening operating systems and applications, providing a starting point for reducing the attack surface.
  • AWS Marketplace Security Tools: Leverage third-party security and hardening tools available in the AWS Marketplace to automate and enforce hardening practices across your environment.
Table of Contents