Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the insecure configuration of Network Load Balancers (NLBs) in AWS, you can follow the below steps:
  1. Log in to your AWS console and navigate to the EC2 Dashboard.
  2. Click on the “Load Balancers” option from the left-hand menu.
  3. Select the Network Load Balancer that you want to remediate.
  4. Click on the “Listeners” tab.
  5. In the “Listeners” tab, review the settings for each listener and ensure that they are using secure protocols such as HTTPS or SSL/TLS.
  6. If any of the listeners are using insecure protocols such as HTTP, click on the “Edit” button next to the listener.
  7. In the “Edit Listener” window, change the protocol to HTTPS or SSL/TLS.
  8. If you are using SSL/TLS, select a valid SSL/TLS certificate from the dropdown list.
  9. Click on the “Save” button to save the changes.
  10. Repeat steps 6-9 for all listeners that are using insecure protocols.
  11. Once all listeners are updated, review the security group settings for the NLB.
  12. Ensure that the security group only allows traffic from trusted sources and that it is not open to the public.
  13. If necessary, update the security group settings to restrict traffic to trusted sources.
  14. Click on the “Save” button to save the changes.
  15. Finally, review the NLB settings to ensure that they are compliant with your organization’s security policies and best practices.
By following these steps, you can remediate the insecure configuration of Network Load Balancers in AWS and ensure that they are secure and compliant with your organization’s security policies.

To remediate the insecure configuration of Network Load Balancer (NLB) in AWS, you can follow the below steps using AWS CLI:
  1. Open the AWS CLI on your local machine or EC2 instance.
  2. Run the following command to describe the listener configuration of your NLB:
    aws elbv2 describe-listeners --load-balancer-arn <load_balancer_arn>
    
    Replace <load_balancer_arn> with the ARN of your NLB.
  3. Check the output for the “Protocol” and “SslPolicy” fields. If the “Protocol” is set to “TLS” or “HTTPS”, and the “SslPolicy” is set to “ELBSecurityPolicy-2016-08” or any other outdated policy, then it is considered an insecure configuration.
  4. To remediate this misconfiguration, run the following command to update the SSL policy of the listener:
    aws elbv2 modify-listener --listener-arn <listener_arn> --ssl-policy ELBSecurityPolicy-TLS-1-2-2017-01
    
    Replace <listener_arn> with the ARN of the listener that needs to be updated.
  5. After running the above command, verify that the SSL policy has been updated successfully by running the “describe-listeners” command again.
  6. Repeat steps 3 to 5 for all the listeners of your NLB.
  7. Once all the listeners have been updated, verify that the NLB no longer has any insecure configurations by running the “describe-listeners” command again.
By following these steps, you can remediate the insecure configuration of your NLB in AWS using AWS CLI.
To remediate an insecure configuration in AWS NLBs using Python, you can follow the below steps:
  1. Identify the insecure configuration: In this case, the insecure configuration is related to the security group of the Network Load Balancer (NLB). Make sure that the security group associated with the NLB is properly configured to allow only necessary traffic.
  2. Use Boto3 to update the security group: Boto3 is a Python library for AWS that allows you to interact with AWS services. You can use Boto3 to update the security group associated with the NLB.
  3. Define the NLB ARN: To update the security group, you need to define the ARN of the NLB. You can get the ARN of the NLB from the AWS Management Console or by using Boto3.
  4. Define the security group ID: Define the security group ID of the security group that you want to associate with the NLB. You can get the security group ID from the AWS Management Console or by using Boto3.
  5. Update the security group: Use the modify_network_interface_attribute method of the EC2 client to update the security group associated with the NLB. Pass the NLB ARN and the security group ID as parameters to the method.
Here is a sample Python code to update the security group associated with the NLB:
import boto3

# Define the NLB ARN
nlb_arn = 'arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/my-load-balancer/1234567890123456'

# Define the security group ID
security_group_id = 'sg-0123456789abcdef'

# Update the security group
ec2_client = boto3.client('ec2')
ec2_client.modify_network_interface_attribute(
    NetworkInterfaceId=nlb_arn,
    Groups=[
        security_group_id
    ]
)
Note: Make sure that you have the necessary permissions to update the security group associated with the NLB.