Skip to main content

More Info:

Subnet flow logs record all traffic flowing into and out of a Subnet. These logs are critical for auditing and review after security incidents.

Risk Level

Low

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • HIPAA
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of not having Flow Logs enabled on a subnet for AWS Security Groups, you can follow these step-by-step instructions using the AWS Management Console:
  1. Sign in to the AWS Management Console: Go to https://aws.amazon.com/ and sign in to your AWS account.
  2. Navigate to VPC Dashboard: Click on the “Services” dropdown menu at the top left corner, then select “VPC” under the Networking & Content Delivery section.
  3. Select the VPC: In the VPC Dashboard, locate and click on the VPC that contains the subnet where you want to enable Flow Logs.
  4. Select the Subnet: In the left-hand menu, click on “Subnets” to view all the subnets within the selected VPC. Locate and select the specific subnet where you want to enable Flow Logs by clicking on the checkbox next to the subnet.
  5. Enable Flow Logs: With the subnet selected, click on the “Actions” dropdown menu above the subnets list, and then select “Create flow log” from the options.
  6. Configure Flow Logs: In the “Create flow log” wizard, you will need to configure the following:
    • Filter: Choose the type of traffic you want to capture in the flow logs (e.g., All traffic, Accepted traffic, Rejected traffic).
    • Destination: Select the destination where you want to store the flow logs (e.g., CloudWatch Logs, S3).
    • IAM Role: If you haven’t already set up the necessary IAM role for Flow Logs, you may need to create a new IAM role or choose an existing one that grants the required permissions.
  7. Review and Create: Review the configuration settings to ensure they are correct, then click on the “Create flow log” button to enable Flow Logs on the selected subnet.
  8. Verify: Once the Flow Logs are enabled, you can verify that they are working correctly by checking the designated destination (e.g., CloudWatch Logs or S3) for log data.
By following these steps, you can successfully remediate the misconfiguration of not having Flow Logs enabled on a subnet for AWS Security Groups using the AWS Management Console.

To remediate the misconfiguration of enabling Flow Logs on a subnet for AWS Security Groups using AWS CLI, follow these steps:
  1. Enable VPC Flow Logs on the Subnet: Run the following AWS CLI command to enable VPC Flow Logs on the desired subnet:
    Replace <subnet-id> with the ID of the subnet for which you want to enable Flow Logs, <log-group-name> with the name of the CloudWatch Logs group where the logs will be stored, and <IAM-role-arn> with the ARN of the IAM role that will be used to deliver the logs.
  2. Configure Flow Log Settings: You can further configure the Flow Log settings by specifying the desired parameters like --max-aggregation-interval, --log-destination-type, --log-destination, etc., based on your requirements.
  3. Verify Flow Logs: To verify that Flow Logs have been enabled successfully, you can run the following command:
    This command will display the details of the enabled Flow Logs, including the FlowLogId, DeliverLogsPermissionArn, LogGroupName, and ResourceId.
By following these steps, you can successfully remediate the misconfiguration of enabling Flow Logs on a subnet for AWS Security Groups using AWS CLI.
To remediate the misconfiguration of enabling Flow Logs on a subnet for AWS Security Groups using Python, you can use the AWS SDK for Python (Boto3) to programmatically enable Flow Logs. Here are the step-by-step instructions to remediate this misconfiguration:
  1. Install the Boto3 library:
  1. Configure AWS credentials: Ensure that you have configured your AWS credentials either by setting environment variables or using the AWS CLI aws configure command.
  2. Write a Python script to enable Flow Logs on the desired subnet:
  1. Replace the placeholders in the script with your actual values:
  • DeliverLogsPermissionArn: Replace with the ARN of an IAM role that has permission to deliver logs to CloudWatch Logs.
  • LogDestination: Replace with the ARN of the CloudWatch Logs log group where you want to store the Flow Logs.
  • ResourceIds: Replace with the subnet ID where you want to enable Flow Logs.
  1. Run the Python script: Execute the Python script to enable Flow Logs on the specified subnet. Make sure to have the necessary permissions to create Flow Logs and access the specified resources.
By following these steps and running the Python script, you can programmatically enable Flow Logs on a subnet for AWS Security Groups.
This adds flow logging for the specified subnet and does not force replacement of the subnet itself (it creates a separate aws_flow_log resource plus IAM and log group prerequisites).For verification, terraform plan should show:
  • + creation of aws_iam_role.vpc_flow_logs_role
  • + creation of aws_iam_role_policy.vpc_flow_logs_policy
  • + creation of aws_cloudwatch_log_group.vpc_flow_logs
  • + creation of aws_flow_log.subnet_flow_logs with no ~ or - changes required on existing subnets beyond depending on these new resources.

Additional Reading: