Skip to main content

More Info:

The communication between your AWS CloudFront distributions and their custom origins should be encrypted using HTTPS in order to secure the delivery of your web content.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Startup Security Baseline
  • AWS Well Architected Framework
  • 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)
  • GDPR
  • 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
  • StateRAMP
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the misconfiguration “CloudFront Distributions Should Use HTTPS For Secure Delivery of Web Content” in AWS using the AWS Console:
  1. Login to the AWS Management Console.
  2. Navigate to the CloudFront console.
  3. Select the distribution(s) that you want to modify.
  4. Click on the “Edit” button at the top of the page.
  5. In the “General” tab, under the “Viewer Protocol Policy” section, select “Redirect HTTP to HTTPS”.
  6. Click on the “Yes, Edit” button to save the changes.
  7. Wait for the changes to propagate.
Once the changes have propagated, your CloudFront distribution(s) will only allow HTTPS connections for secure delivery of web content.

To remediate the misconfiguration “CloudFront Distributions Should Use HTTPS For Secure Delivery of Web Content” for AWS using AWS CLI, follow the below steps:
  1. Login to your AWS account using AWS CLI.
  2. Identify the CloudFront distributions that are not using HTTPS for secure delivery of web content. You can use the following command to list all the CloudFront distributions in your account:
  3. Once you have identified the CloudFront distribution that is not using HTTPS, you can update it to use HTTPS by using the following command:
    Replace <distribution_id> with the ID of the CloudFront distribution that you want to update.
  4. Create a JSON file named config.json and add the following code to it:
    Replace <ACM_certificate_ARN> with the ARN of the ACM certificate that you want to use for HTTPS. Replace <origin_id> with the ID of the CloudFront origin that you want to use for HTTPS. Replace <origin_domain_name> with the domain name of the CloudFront origin that you want to use for HTTPS.
  5. Save the config.json file and run the aws cloudfront update-distribution command to update the CloudFront distribution to use HTTPS.
  6. Verify that the CloudFront distribution is now using HTTPS by accessing the distribution’s URL in a web browser. The URL should start with https://.
To remediate the misconfiguration of CloudFront distributions not using HTTPS for secure delivery of web content, you can use the following Python script:
  1. First, import the necessary AWS SDK for Python (Boto3) libraries:
  1. Next, create a Boto3 client for CloudFront:
  1. Then, use the list_distributions() method to get a list of all CloudFront distributions:
  1. Loop through the distributions and check if they are using HTTPS:
  1. If a distribution is not using HTTPS, update its configuration using the update_distribution() method:
Note: Replace YOUR_DISTRIBUTION_ID with the ID of the distribution you want to update.By following these steps, you can remediate the misconfiguration of CloudFront distributions not using HTTPS for secure delivery of web content in AWS using Python.
Replace:
  • CLOUDFRONT_DISTRIBUTION_DESCRIPTION with a description string.
  • CUSTOM_ORIGIN_DOMAIN_NAME with your custom origin DNS name.
  • CUSTOM_ORIGIN_ID with a unique ID for this origin.
  • ACM_CERTIFICATE_ARN with the ARN of your ACM certificate in us-east-1.
If you have multiple origin blocks using unencrypted traffic, set origin_protocol_policy = "https-only" in each custom_origin_config.terraform plan should show a change to the CloudFront distribution where origin.custom_origin_config.origin_protocol_policy is updated from http-only or match-viewer to https-only, with no resource replacement.

Additional Reading: