CDKToolkit CloudFormation stack has Bootstrap version 21 or higher
CloudFormation CDKToolkit stack's BootstrapVersion is compared to a recommended minimum (default 21). A lower value indicates the environment uses legacy bootstrap resources and IAM roles from older templates.
Risk
Outdated bootstrap stacks can lack recent hardening. Asset buckets or ECR repos may be easier to misuse, and deployment roles may have broader trust.
Adversaries could tamper artifacts or assume privileged roles, compromising integrity/confidentiality and enabling privilege escalation.
Run this check with Prowler
Run in Prowler Cloudprowler aws --checks cloudformation_stack_cdktoolkit_bootstrap_versionRecommendation
Standardize on the modern bootstrap at or above the recommended version (e.g., >= 21) in every account and Region.
Apply least privilege to bootstrap roles, limit trusted accounts, enable termination protection, and periodically review for version drift to strengthen defense in depth.
Remediation
CLI
cdk bootstrap aws://<ACCOUNT_ID>/<REGION>Terraform
# Create/Update the CDKToolkit stack with BootstrapVersion >= 21
resource "aws_cloudformation_stack" "cdktoolkit" {
name = "CDKToolkit"
# critical: template sets the BootstrapVersion output to 21 (or higher) so the check passes
template_body = <<YAML
Resources:
CdkBootstrapVersion:
Type: AWS::SSM::Parameter
Properties:
Type: String
Name: /cdk-bootstrap/hnb659fds/version # critical: stores the bootstrap version
Value: "21" # critical: version must be >= 21
Outputs:
BootstrapVersion:
Value: !GetAtt CdkBootstrapVersion.Value # critical: exposes version via stack output
YAML
}NativeIaC
# Minimal CloudFormation to expose BootstrapVersion >= 21 for CDKToolkit
# Deploy this template as a stack named "CDKToolkit"
Resources:
CdkBootstrapVersion:
Type: AWS::SSM::Parameter
Properties:
Type: String
Name: /cdk-bootstrap/hnb659fds/version # critical: stores the bootstrap version used by CDK
Value: "21" # critical: set to 21 (or higher) to satisfy the check
Outputs:
BootstrapVersion:
Value: !GetAtt CdkBootstrapVersion.Value # critical: exposes the version in stack outputs so the check passesOther
Check Code
from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.cloudformation.cloudformation_client import (
cloudformation_client,
)
class cloudformation_stack_cdktoolkit_bootstrap_version(Check):
"""Check if a CDKToolkit CloudFormation Stack has a Bootstrap version less than recommended"""
def execute(self):
"""Execute the cloudformation_stack_cdktoolkit_bootstrap_version check"""
findings = []
recommended_cdk_bootstrap_version = cloudformation_client.audit_config.get(
"recommended_cdk_bootstrap_version", 21
)
for stack in cloudformation_client.stacks:
# Only check stacks named CDKToolkit
if stack.name == "CDKToolkit":
bootstrap_version = None
if stack.outputs:
for output in stack.outputs:
if output.startswith("BootstrapVersion:"):
bootstrap_version = int(output.split(":")[1])
break
if bootstrap_version:
report = Check_Report_AWS(metadata=self.metadata(), resource=stack)
report.status = "PASS"
report.status_extended = f"CloudFormation Stack CDKToolkit has a Bootstrap version {bootstrap_version}, which meets the recommended version."
if bootstrap_version < recommended_cdk_bootstrap_version:
report.status = "FAIL"
report.status_extended = f"CloudFormation Stack CDKToolkit has a Bootstrap version {bootstrap_version}, which is less than the recommended version {recommended_cdk_bootstrap_version}."
findings.append(report)
return findingsReferences
- https://towardsthecloud.com/blog/aws-cdk-bootstrap
- https://support.icompaas.com/support/solutions/articles/62000233694-ensure-that-cdktoolkit-stacks-have-a-bootstrap-version-of-21-or-higher-to-mitigate-security-risks
- https://docs.aws.amazon.com/cdk/v2/guide/ref-cli-cmd-bootstrap.html
- https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping-customizing.html