AWS Config tracks resource configurations and compliance over time. It provides a complete inventory of AWS resources, configuration history, and compliance status against rules. Attackers use Config for reconnaissance and to understand the security posture of targets.
Config continuously records resource configurations, capturing every change. This creates a timeline of configuration items (CIs) that can be queried, enabling compliance auditing and troubleshooting configuration drift.
Attack note: Configuration history reveals security group changes, IAM policy modifications, and infrastructure secrets
Config Rules evaluate resource configurations against desired settings. Managed rules check common compliance requirements, while custom rules use Lambda functions. Non-compliant resources trigger remediation actions.
Attack note: Disabling or manipulating rules can hide security violations and block automated remediation
AWS Config provides a comprehensive inventory and historical record of all AWS resources. Access grants attackers detailed reconnaissance data including IAM policies, security groups, encryption settings, and the ability to identify non-compliant resources for exploitation.
aws configservice list-discovered-resources \
--resource-type AWS::IAM::Roleaws configservice get-resource-config-history \
--resource-type AWS::EC2::SecurityGroup \
--resource-id sg-12345678aws configservice describe-config-rulesaws configservice describe-compliance-by-config-ruleaws configservice select-resource-config \
--expression "SELECT * WHERE resourceType = 'AWS::S3::Bucket'"Recon Gold: Configuration history may reveal credentials that were accidentally committed and later removed.
aws configservice list-discovered-resources \
--resource-type AWS::IAM::Role \
--query 'resourceIdentifiers[*].resourceId'aws configservice get-resource-config-history \
--resource-type AWS::EC2::SecurityGroup \
--resource-id sg-12345678 \
--later-time 2024-01-01 --earlier-time 2023-01-01aws configservice get-compliance-details-by-config-rule \
--config-rule-name s3-bucket-public-read-prohibited \
--compliance-types NON_COMPLIANTaws configservice select-resource-config \
--expression "SELECT resourceId, configuration.publicAccessBlockConfiguration
WHERE resourceType = 'AWS::S3::Bucket'"aws configservice stop-configuration-recorder \
--configuration-recorder-name defaultaws configservice delete-config-rule \
--config-rule-name iam-password-policyaws configservice select-resource-config --expression "
SELECT resourceId, resourceType, configuration
WHERE resourceType = 'AWS::S3::Bucket'
AND configuration.publicAccessBlockConfiguration.blockPublicAcls = false"aws configservice select-resource-config --expression "
SELECT resourceId, availabilityZone, configuration.encrypted
WHERE resourceType = 'AWS::EC2::Volume'
AND configuration.encrypted = false"aws configservice select-resource-config --expression "
SELECT resourceId, configuration.ipPermissions
WHERE resourceType = 'AWS::EC2::SecurityGroup'
AND configuration.ipPermissions.ipRanges.cidrIp = '0.0.0.0/0'"aws configservice select-resource-config --expression "
SELECT resourceId, configuration.functionName, configuration.vpcConfig
WHERE resourceType = 'AWS::Lambda::Function'
AND configuration.vpcConfig.subnetIds IS NOT NULL"{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "config:*",
"Resource": "*"
}]
}Allows full reconnaissance and can disable Config entirely
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"config:DescribeComplianceByConfigRule",
"config:GetComplianceDetailsByConfigRule"
],
"Resource": "*"
}]
}Only allows viewing compliance status, not configurations
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"config:DeleteConfigRule",
"config:StopConfigurationRecorder",
"config:DeleteDeliveryChannel"
],
"Resource": "*"
}]
}Allows disabling Config monitoring entirely
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Action": [
"config:DeleteConfigRule",
"config:StopConfigurationRecorder",
"config:DeleteDeliveryChannel",
"config:DeleteConfigurationRecorder"
],
"Resource": "*"
}]
}SCP preventing Config from being disabled
Use Service Control Policies to prevent stopping the recorder or deleting rules.
"Effect": "Deny",
"Action": ["config:Stop*", "config:Delete*"]Enable KMS encryption for the S3 delivery bucket and SNS topic.
Alert on StopConfigurationRecorder, DeleteConfigRule, and DeleteDeliveryChannel events.
Limit cross-account aggregator permissions and require authorization.
aws configservice put-aggregation-authorization \
--authorized-account-id 123456789012 \
--authorized-aws-region us-east-1Ensure the recorder captures all supported resource types including global resources.
AllSupported: true, IncludeGlobalResourceTypes: trueSet maximum retention period (7 years) to maintain comprehensive history.
AWS Config Security Card • Toc Consulting
Always obtain proper authorization before testing