Module 7 โ€” Cloud Architecture

๐ŸŽฏ 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.

โš ๏ธ
The #1 Cloud Breach Cause
The vast majority of cloud security breaches are customer-side misconfigurations โ€” not vulnerabilities in the cloud provider's infrastructure. Open S3 buckets, over-privileged IAM roles, and leaked credentials are overwhelmingly common.

โ˜๏ธ Cloud Provider Owns

  • Physical datacentre security
  • Network infrastructure
  • Hardware (servers, disks)
  • Hypervisor / virtualization
  • Managed service availability
  • Provider's own IAM controls

๐Ÿข YOU Own (Your Responsibility)

  • Your data and encryption choices
  • Your IAM policies and roles
  • Your application code
  • Operating system & container config
  • Network/security group rules
  • Monitoring & incident response
Shared Responsibility โ€” IaaS vs PaaS vs SaaS
Responsibility Layer IaaS (EC2/VMs) PaaS (App Engine) SaaS (Gmail/Salesforce) Data YOU YOU YOU Application YOU YOU Provider OS / Runtime YOU Provider Provider Network Config YOU Provider Provider Physical Infra Provider Provider Provider Your responsibility Provider's responsibility
As you move from IaaS โ†’ PaaS โ†’ SaaS, the provider takes on more responsibility โ€” but you still own your data and identity management

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.

๐Ÿ”‘
T-01 โ€” Over-Privileged IAM Roles [STRIDE: Elevation of Privilege]
Developer attaches 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.
CriticalElevation
๐Ÿ›ก๏ธ
Mitigations
Principle of Least Privilege โ€” grant only the specific actions needed. Use IAM Access Analyzer to detect over-privilege. Review and tighten IAM policies before production launch. Use Service Control Policies (SCPs) in AWS Organizations as guard rails.
๐Ÿ”“
T-02 โ€” Long-Lived Access Keys [STRIDE: Spoofing + Information Disclosure]
AWS access keys checked into GitHub (even briefly) are scraped by bots within seconds. Long-lived static credentials (access keys) that never expire are high-value targets. One leaked key = full account compromise if the key is over-privileged.
CriticalSpoofing
๐Ÿ›ก๏ธ
Mitigations
Use IAM roles (temporary credentials) instead of long-lived access keys wherever possible. For EC2/Lambda: use instance profiles/execution roles. For local dev: use AWS SSO. Rotate any existing long-lived keys. Enable GuardDuty to detect anomalous credential usage.
๐Ÿ˜•
T-03 โ€” Confused Deputy Attack [STRIDE: Elevation of Privilege]
A cloud service (the "deputy") has permissions your account doesn't. An attacker tricks the service into performing actions on your account by supplying your ARN. Classic example: S3 cross-account access where the bucket policy doesn't require the caller to specify their own account ID.
HighElevation
๐Ÿ›ก๏ธ
Mitigations
Use 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)

๐Ÿชฃ
T-04 โ€” Public S3 Bucket [STRIDE: Information Disclosure]
Developer creates an S3 bucket for static assets and accidentally enables public access, or sets a bucket policy with "Principal": "*". Data exposure: customer PII, database backups, environment files with secrets. Happens constantly โ€” automated scanners find these within hours.
CriticalInfo Disclosure
# โŒ 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"
๐Ÿ’พ
T-05 โ€” Unencrypted Backups at Rest [STRIDE: Information Disclosure]
Database snapshots or file backups stored in S3 without server-side encryption. A compromised AWS account or insider threat can download and read all data without any cryptographic barrier.
HighInfo Disclosure
๐Ÿ›ก๏ธ
Mitigations
Enable S3 default encryption (SSE-S3 minimum, SSE-KMS for sensitive data). Enforce encryption in bucket policy using condition: "s3:x-amz-server-side-encryption": "aws:kms". Enable S3 Object Lock for immutable backups.

4Compute Threats: Containers & Serverless

Container Attack Surface
๐Ÿ–ฅ๏ธ Host OS / Kernel (shared by all containers) โš ๏ธ Container escape โ†’ full host access ยท Privileged containers are especially dangerous Container A ๐ŸŒ Web App โš ๏ธ Running as root Container B โš™๏ธ API Service โš ๏ธ Outdated base image Container C ๐Ÿ—„๏ธ Database โš ๏ธ Volume mounted host FS ๐Ÿ“ฆ Container Registry ECR / Docker Hub / GHCR โš ๏ธ Supply chain: malicious base image
Container threats span from base image supply chain to runtime privilege to host escape
Container ThreatSTRIDEMitigation
Running as root in containerESet USER nonroot in Dockerfile; use runAsNonRoot: true in Kubernetes pod spec
Container escape via privileged modeENever use --privileged; use seccomp and AppArmor profiles; read-only filesystem
Vulnerable base image (CVEs)T ยท EScan images with Trivy/Snyk; use minimal base images (distroless, alpine); auto-rebuild on CVE alerts
Secrets in environment variablesIUse Kubernetes Secrets (encrypted at rest); prefer Vault sidecar injection or CSI secrets driver
Unrestricted inter-pod communicationEApply Kubernetes Network Policies; default-deny all ingress/egress; allow only necessary paths
โšก
Serverless Threat Model Shifts
Serverless (AWS Lambda, GCP Cloud Functions) eliminates OS and server management threats โ€” but introduces new ones unique to the execution model: short-lived functions, event-driven inputs, and per-function IAM roles.
Serverless ThreatSTRIDEMitigation
Event injection โ€” malicious data in triggering event (SNS message, S3 key, API GW body) processed as trusted inputTValidate 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 tableEScope IAM policies to specific resources (not wildcards). One function = one minimal role.
Function timeout exhaustion (billable DoS) โ€” attacker triggers expensive functionsDRate limiting at API Gateway; concurrency limits per function; cost anomaly detection alerts
Dependency confusion / supply chain โ€” malicious npm/PyPI package in function's dependenciesTPin 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:GetFunctionConfigurationIStore 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:

Cloud-Native Architecture โ€” Threat Model View
๐ŸŒ Internet ๐Ÿ‘ค User ๐Ÿ”€ CloudFront CDN + WAF rules ๐Ÿšช API Gateway Auth + rate limit โœ… AWS VPC (Private) โšก Lambda Business logic ๐Ÿ—„๏ธ RDS (PostgreSQL) Encrypted, private subnet ๐Ÿชฃ S3 Bucket Private, encrypted ๐Ÿ” Secrets Manager DB creds, API keys ๐Ÿ”ง GitHub Actions CI/CD pipeline ๐Ÿ“ฆ ECR (Container Reg) Scanned images only ๐Ÿ“Š CloudWatch + GuardDuty Monitoring + threat detect deploy โš ๏ธ WAF bypass via CDN config โš ๏ธ CI/CD pipeline compromise โš ๏ธ Open S3 bucket
Cloud-native architecture with key threat injection points highlighted โ€” CI/CD compromise, storage misconfiguration, and WAF bypass are the top concerns

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.

1
Source Code Compromise
Attacker commits malicious code via stolen developer credentials, a compromised GitHub account, or a malicious pull request merged without review.
2
Dependency Confusion / Typosquatting
Attacker publishes a malicious package to npm/PyPI with the same name as an internal package or a common typo (lodahs vs lodash). Package manager resolves to the public malicious version.
3
Build System Compromise
GitHub Actions workflow has write access to production. Compromised runner or malicious action injects backdoor into the build artifact before it's signed and deployed.
4
Secrets Leakage in Logs
Build logs printed to public GitHub Actions logs contain API keys, database URLs, or access tokens โ€” visible to anyone with read access to the repo.
๐Ÿ›ก๏ธ
Supply Chain Security Controls
  • Pin dependency versions AND verify checksums (use package-lock.json or poetry.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

โœ๏ธ Exercise 7.1
Cloud SSRF Impact
Your Lambda function has an "import data from URL" feature. An attacker sends the URL http://169.254.169.254/latest/meta-data/iam/security-credentials/. The Lambda fetches it. What is the worst-case impact?

8Module Summary

โœ…
Key Takeaways
  • 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
1 / 8