Cloud Architecture Threat Modeling
Cloud introduces a fundamentally different threat landscape โ shared responsibility, identity-first security, ephemeral compute, and blast-radius explosions. This module covers it all.
๐ฏ Learning Objectives
- Explain the Shared Responsibility Model and identify what YOU are responsible for
- Enumerate IAM-specific threats: over-privileged roles, credential leakage, confused deputy
- Threat model common cloud patterns: serverless, containers, object storage
- Identify data-at-rest and data-in-transit threats in cloud environments
- Understand supply chain risks in cloud-native CI/CD pipelines
1The Shared Responsibility Model
The most fundamental concept in cloud security. The cloud provider secures the cloud itself. You are responsible for security in the cloud โ your data, your identities, your configurations.
2Identity & Access Management (IAM) Threats
In cloud environments, identity is the new perimeter. With IAM credentials, an attacker can do everything your application can do โ without touching any of your code. IAM threats are the most critical cloud threats.
AdministratorAccess to an EC2 instance or Lambda function "to get it working quickly." If that resource is compromised (via SSRF, RCE, etc.), the attacker inherits full AWS admin access โ they can create new users, exfiltrate all data, or destroy all infrastructure.aws:SourceArn and aws:SourceAccount condition keys in IAM policies for cross-service permissions. This ensures the action is initiated from the expected source.3Object Storage Threats (S3, GCS, Azure Blob)
"Principal": "*". Data exposure: customer PII, database backups, environment files with secrets. Happens constantly โ automated scanners find these within hours.# โ Dangerous bucket policy
{
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-company-data/*"
}
# โ
Lock down + enable Block Public Access
aws s3api put-public-access-block \
--bucket my-bucket \
--public-access-block-configuration \
"BlockPublicAcls=true,IgnorePublicAcls=true,\
BlockPublicPolicy=true,RestrictPublicBuckets=true"
"s3:x-amz-server-side-encryption": "aws:kms". Enable S3 Object Lock for immutable backups.4Compute Threats: Containers & Serverless
| Container Threat | STRIDE | Mitigation |
|---|---|---|
| Running as root in container | E | Set USER nonroot in Dockerfile; use runAsNonRoot: true in Kubernetes pod spec |
| Container escape via privileged mode | E | Never use --privileged; use seccomp and AppArmor profiles; read-only filesystem |
| Vulnerable base image (CVEs) | T ยท E | Scan images with Trivy/Snyk; use minimal base images (distroless, alpine); auto-rebuild on CVE alerts |
| Secrets in environment variables | I | Use Kubernetes Secrets (encrypted at rest); prefer Vault sidecar injection or CSI secrets driver |
| Unrestricted inter-pod communication | E | Apply Kubernetes Network Policies; default-deny all ingress/egress; allow only necessary paths |
| Serverless Threat | STRIDE | Mitigation |
|---|---|---|
| Event injection โ malicious data in triggering event (SNS message, S3 key, API GW body) processed as trusted input | T | Validate and sanitize all event sources, even "internal" ones. Treat every event as untrusted input. |
Over-privileged Lambda execution role โ function has s3:* and dynamodb:* but only needs one table | E | Scope IAM policies to specific resources (not wildcards). One function = one minimal role. |
| Function timeout exhaustion (billable DoS) โ attacker triggers expensive functions | D | Rate limiting at API Gateway; concurrency limits per function; cost anomaly detection alerts |
| Dependency confusion / supply chain โ malicious npm/PyPI package in function's dependencies | T | Pin dependency versions; scan with Snyk; use private npm registry; sign and verify artifacts |
Secrets in environment variables โ Lambda env vars visible to anyone with lambda:GetFunctionConfiguration | I | Store secrets in AWS Secrets Manager or SSM Parameter Store; fetch at runtime with limited IAM |
5Full Cloud Architecture DFD
Let's model a typical cloud-native deployment โ serverless API + managed database + CDN + CI/CD:
6CI/CD Pipeline & Supply Chain Threats
The build pipeline is one of the highest-value attack targets. Compromise the CI/CD system and you can ship malicious code to production with valid signatures from a trusted process.
lodahs vs lodash). Package manager resolves to the public malicious version.- Pin dependency versions AND verify checksums (use
package-lock.jsonorpoetry.lock) - Use GitHub's OIDC for CI/CD credentials โ no long-lived secrets in environment
- Sign container images and verify signatures before deploy (cosign/Sigstore)
- Require 2-reviewer approval on all merges to main
- Scan dependencies on every commit (Dependabot, Snyk, Socket)
- Use SLSA framework (Supply chain Levels for Software Artifacts) as a maturity model
7Knowledge Check
http://169.254.169.254/latest/meta-data/iam/security-credentials/. The Lambda fetches it. What is the worst-case impact?8Module Summary
- Shared Responsibility: the cloud provider secures the cloud; you secure what's in it โ your data, IAM, and configs
- IAM = the new perimeter: over-privileged roles and leaked credentials are the top cloud breach vectors
- Object storage: default to private; enable Block Public Access; encrypt everything
- Containers: run as non-root; scan images; never use privileged mode; apply network policies
- Serverless: treat all event inputs as untrusted; one minimal IAM role per function; fetch secrets at runtime
- CI/CD: the pipeline is an attack target โ protect it like production; pin and scan dependencies