image/svg+xml Checkov home
  • Docs
    • Quick start
    • Overview
    • Integrations
  • Download
  • Docs
    • Quick start
    • Overview
    • Integrations

Checkov Documentation

  • 1.Welcome
    • What is Checkov?
    • Terms and Concepts
    • Quick Start
    • Feature Descriptions
    • Migration
  • 2.Basics
    • Installing Checkov
    • CLI Command Reference
    • Suppressing and Skipping Policies
    • Hard and soft fail
    • Scanning Credentials and Secrets
    • Reviewing Scan Results
    • Visualizing Checkov Output
    • Handling Variables
  • 3.Custom Policies
    • Custom Policies Overview
    • Python Custom Policies
    • YAML Custom Policies
    • Custom YAML Policies Examples
    • Sharing Custom Policies
  • 4.Integrations
    • Jenkins
    • Bitbucket Cloud Pipelines
    • GitHub Actions
    • GitLab CI
    • Kubernetes
    • Pre-Commit Hooks
    • Docker
  • 5.Policy Index
    • all resource scans
    • ansible resource scans
    • argo_workflows resource scans
    • arm resource scans
    • azure_pipelines resource scans
    • bicep resource scans
    • bitbucket_configuration resource scans
    • bitbucket_pipelines resource scans
    • circleci_pipelines resource scans
    • cloudformation resource scans
    • dockerfile resource scans
    • github_actions resource scans
    • github_configuration resource scans
    • gitlab_ci resource scans
    • gitlab_configuration resource scans
    • kubernetes resource scans
    • openapi resource scans
    • secrets resource scans
    • serverless resource scans
    • terraform resource scans
  • 6.Contribution
    • Checkov Runner Contribution Guide
    • Implementing CI Metadata extractor
    • Implementing ImageReferencer
    • Contribution Overview
    • Contribute Python-Based Policies
    • Contribute YAML-based Policies
    • Contribute New Terraform Provider
    • Contribute New Argo Workflows configuration policy
    • Contribute New Azure Pipelines configuration policy
    • Contribute New Bitbucket configuration policy
    • Contribute New GitHub configuration policy
    • Contribute New Gitlab configuration policy
  • 7.Scan Examples
    • Terraform Plan Scanning
    • Terraform Scanning
    • Helm
    • Kustomize
    • AWS SAM configuration scanning
    • Ansible configuration scanning
    • Argo Workflows configuration scanning
    • Azure ARM templates configuration scanning
    • Azure Pipelines configuration scanning
    • Azure Bicep configuration scanning
    • Bitbucket configuration scanning
    • AWS CDK configuration scanning
    • Cloudformation configuration scanning - {:.toctree-l3} Example misconfigured Cloudformation - {:.toctree-l3} Running in CLI - {:.toctree-l3} Example output
      • The Cloudformation Graph
    • Dockerfile configuration scanning
    • GitHub configuration scanning
    • Gitlab configuration scanning
    • Kubernetes configuration scanning
    • OpenAPI configuration scanning
    • SCA scanning
    • Serverless framework configuration scanning
  • 8.Outputs
    • CSV
    • CycloneDX BOM
    • GitLab SAST
    • JUnit XML
    • SARIF
  • Docs
  • 7.scan examples
  • Cloudformation configuration scanning
Edit on GitHub

Cloudformation configuration scanning

Checkov supports the evaluation of policies on your Cloudformation files. When using checkov to scan a directory that contains a Cloudformation template it will validate if the file is compliant with AWS best practices such as making sure S3 buckets are encrypted, HTTPS is being used, and more.

Full list of Cloudformation policies checks can be found here.

Example misconfigured Cloudformation

Resources:
  MyDB0:
    Type: 'AWS::RDS::DBInstance'
    Properties:
      DBName: 'mydb'
      DBInstanceClass: 'db.t3.micro'
      Engine: 'mysql'
      MasterUsername: 'master'
      MasterUserPassword: 'password'
  MyDB1:
    Type: 'AWS::RDS::DBInstance'
    Properties:
      DBName: 'mydb'
      DBInstanceClass: 'db.t3.micro'
      Engine: 'mysql'
      MasterUsername: 'master'
      MasterUserPassword: 'password'
      StorageEncrypted: false

Running in CLI

checkov -d . --framework cloudformation

Example output

       _               _              
   ___| |__   ___  ___| | _______   __
  / __| '_ \ / _ \/ __| |/ / _ \ \ / /
 | (__| | | |  __/ (__|   < (_) \ V / 
  \___|_| |_|\___|\___|_|\_\___/ \_/  
                                      
By Prisma Cloud | version: 2.0.723 

cloudformation scan results:

Passed checks: 2, Failed checks: 6, Skipped checks: 0

Check: CKV_AWS_17: "Ensure all data stored in RDS is not publicly accessible"
   PASSED for resource: AWS::RDS::DBInstance.MyDB0
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:2-9
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/public-policies/public-2

Check: CKV_AWS_17: "Ensure all data stored in RDS is not publicly accessible"
   PASSED for resource: AWS::RDS::DBInstance.MyDB1
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:10-18
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/public-policies/public-2

Check: CKV_AWS_161: "Ensure RDS database has IAM authentication enabled"
   FAILED for resource: AWS::RDS::DBInstance.MyDB0
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:2-9
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-iam-policies/ensure-rds-database-has-iam-authentication-enabled

      2 |   MyDB0:
      3 |     Type: 'AWS::RDS::DBInstance'
      4 |     Properties:
      5 |       DBName: 'mydb'
      6 |       DBInstanceClass: 'db.t3.micro'
      7 |       Engine: 'mysql'
      8 |       MasterUsername: 'master'
      9 |       MasterUserPassword: 'password'


Check: CKV_AWS_157: "Ensure that RDS instances have Multi-AZ enabled"
   FAILED for resource: AWS::RDS::DBInstance.MyDB0
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:2-9
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/general-73

      2 |   MyDB0:
      3 |     Type: 'AWS::RDS::DBInstance'
      4 |     Properties:
      5 |       DBName: 'mydb'
      6 |       DBInstanceClass: 'db.t3.micro'
      7 |       Engine: 'mysql'
      8 |       MasterUsername: 'master'
      9 |       MasterUserPassword: 'password'


Check: CKV_AWS_16: "Ensure all data stored in the RDS is securely encrypted at rest"
   FAILED for resource: AWS::RDS::DBInstance.MyDB0
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:2-9
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/general-4

      2 |   MyDB0:
      3 |     Type: 'AWS::RDS::DBInstance'
      4 |     Properties:
      5 |       DBName: 'mydb'
      6 |       DBInstanceClass: 'db.t3.micro'
      7 |       Engine: 'mysql'
      8 |       MasterUsername: 'master'
      9 |       MasterUserPassword: 'password'


Check: CKV_AWS_161: "Ensure RDS database has IAM authentication enabled"
   FAILED for resource: AWS::RDS::DBInstance.MyDB1
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:10-18
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-iam-policies/ensure-rds-database-has-iam-authentication-enabled

      10 |   MyDB1:
      11 |     Type: 'AWS::RDS::DBInstance'
      12 |     Properties:
      13 |       DBName: 'mydb'
      14 |       DBInstanceClass: 'db.t3.micro'
      15 |       Engine: 'mysql'
      16 |       MasterUsername: 'master'
      17 |       MasterUserPassword: 'password'
      18 |       StorageEncrypted: false


Check: CKV_AWS_157: "Ensure that RDS instances have Multi-AZ enabled"
   FAILED for resource: AWS::RDS::DBInstance.MyDB1
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:10-18
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/general-73

      10 |   MyDB1:
      11 |     Type: 'AWS::RDS::DBInstance'
      12 |     Properties:
      13 |       DBName: 'mydb'
      14 |       DBInstanceClass: 'db.t3.micro'
      15 |       Engine: 'mysql'
      16 |       MasterUsername: 'master'
      17 |       MasterUserPassword: 'password'
      18 |       StorageEncrypted: false


Check: CKV_AWS_16: "Ensure all data stored in the RDS is securely encrypted at rest"
   FAILED for resource: AWS::RDS::DBInstance.MyDB1
   File: /example_RDSEncryption/RDSEncryption-FAIL.yaml:10-18
   Guide: https://docs.prismacloud.io/en/enterprise-edition/policy-reference/aws-policies/aws-general-policies/general-4

      10 |   MyDB1:
      11 |     Type: 'AWS::RDS::DBInstance'
      12 |     Properties:
      13 |       DBName: 'mydb'
      14 |       DBInstanceClass: 'db.t3.micro'
      15 |       Engine: 'mysql'
      16 |       MasterUsername: 'master'
      17 |       MasterUserPassword: 'password'
      18 |       StorageEncrypted: false



The Cloudformation Graph

Checkov follows the CFN template reference where some resource can have an attribute reference that will result in the final state, or a resource can have a dependency in another resource.

For example the following code:

Description: My super cool Lambda
Parameters:
  ParamTracingConfig:
    Description: Active tracing config
    Type: String
    Default: "PassThrough"
Resources:
  WrongTracingConfigValueLambdaFunctionWithRef:
    Type: "AWS::Lambda::Function"
    Properties:
      FunctionName: !Sub "${AWS::AccountId}-${CompanyName}-${Environment}-analysis"
      Runtime: nodejs12.x
      Role: !GetAtt IAM4Lambda.Arn
      Handler: exports.test
      Code:
        ZipFile: |
          console.log("Hello World");
      Tags:
        - Key: Name
          Value: !Sub "${AWS::AccountId}-${CompanyName}-${Environment}-analysis"
        - Key: Environment
          Value: !Sub "${AWS::AccountId}-${CompanyName}-${Environment}"
      Tracing_config:
        Mode: !Ref ParamTracingConfig

Contains the lambda resource that has the attribute Tracing_config that references the value of the parameter ParamTracingConfig. Those references are computes in a graph connecting the different cfn elements so we would be able to analyze if the parameter that is compliant or not with best practices.

Powered By

  • Slack Community
  • Prisma Cloud
  • Terms of use
  • GitHub
  • Docs
  • Privacy policy