Missing Encryption Flag in Configuration
ElastiCache replication groups created without the at_rest_encryption_enabled parameter explicitly set to true. Since this defaults to false, cached data and backups are stored unencrypted on disk.
AWS ElastiCache Redis clusters configured without at-rest encryption leave cached data and backup files unprotected on disk. This exposes sensitive cached information including session data, authentication tokens, user profiles, and business-critical data to unauthorized access if storage systems are compromised, lost, or improperly decommissioned.
# VULNERABLE: ElastiCache without at-rest encryption
resource "aws_elasticache_replication_group" "session_cache" {
replication_group_id = "session-cache"
description = "Redis cluster for session storage"
port = 6379
parameter_group_name = "default.redis7"
node_type = "cache.r7g.large"
num_cache_clusters = 2
automatic_failover_enabled = true
multi_az_enabled = true
# VULNERABLE: No at-rest encryption
# at_rest_encryption_enabled defaults to false
# Cached session data stored in plaintext
subnet_group_name = aws_elasticache_subnet_group.cache.name
security_group_ids = [aws_security_group.cache.id]
tags = {
Environment = "production"
Service = "session-management"
}
}# SECURE: ElastiCache with at-rest encryption
resource "aws_elasticache_replication_group" "session_cache" {
replication_group_id = "session-cache"
description = "Redis cluster for session storage"
port = 6379
parameter_group_name = "default.redis7"
node_type = "cache.r7g.large"
num_cache_clusters = 2
automatic_failover_enabled = true
multi_az_enabled = true
# SECURE: Enable at-rest encryption
at_rest_encryption_enabled = true
kms_key_id = aws_kms_key.elasticache_key.arn
# Enable in-transit encryption
transit_encryption_enabled = true
auth_token = random_password.cache_auth.result
subnet_group_name = aws_elasticache_subnet_group.cache.name
security_group_ids = [aws_security_group.cache.id]
tags = {
Environment = "production"
Service = "session-management"
EncryptedAtRest = "true"
EncryptedInTransit = "true"
}
}
# Customer-managed KMS key for encryption
resource "aws_kms_key" "elasticache_key" {
description = "KMS key for ElastiCache encryption"
deletion_window_in_days = 7
enable_key_rotation = true
tags = {
Name = "ElastiCache Encryption Key"
Purpose = "elasticache-encryption"
}
}
resource "random_password" "cache_auth" {
length = 32
special = true
}The vulnerable configuration omits the at_rest_encryption_enabled parameter (defaulting to false), leaving cached data unencrypted on disk and vulnerable to unauthorized access if storage is compromised. The secure version sets at_rest_encryption_enabled to true and uses a customer-managed KMS key, ensuring all cached data and backup files are encrypted at rest, providing protection against storage-level attacks and unauthorized access.
ElastiCache replication groups created without the at_rest_encryption_enabled parameter explicitly set to true. Since this defaults to false, cached data and backups are stored unencrypted on disk.
Sourcery automatically identifies information disclosure due to disabled at-rest encryption on elasticache clusters and many other security issues in your codebase.