Module 09 · Advanced
Cloud, Containers & Modern Surfaces
Modern estates live in shared responsibility models: cloud control planes, object storage, serverless, and Kubernetes clusters. This module teaches how operators map cloud attack surfaces, abuse common identity and configuration failures, and assess containers and orchestrators without treating them as magic black boxes. Every technique assumes authorized lab or client scope only.
Authorized testing only. Practice on systems you own, isolated labs, or targets with written permission. Unauthorized access is illegal.
Outcomes
- Map a cloud account attack surface from identity, storage, compute, and network layers
- Explain shared responsibility and why IAM is usually the highest-value cloud finding
- Assess S3/blob, metadata services, and over-permissive roles with evidence-grade notes
- Enumerate container images, runtime risks, and Kubernetes RBAC/API exposure patterns
- Use cloud and K8s tooling proportionally and report business impact, not just CLI output
Lessons
Cloud attack surface fundamentals
Identity, storage, compute, and metadata: how modern cloud estates actually fail under authorized assessment.
Learning objectives
- Describe the shared responsibility model and what a tester can and cannot claim as in-scope
- Map identity (users, roles, policies, service principals) as the primary cloud attack path
- Enumerate public and internal storage exposure with safe, non-destructive checks
- Explain instance/container metadata services and why SSRF plus metadata is high impact
- Produce report-ready evidence for misconfiguration findings without overstating exploitability
Deep teach-through
Shared responsibility and engagement framing
Cloud providers secure the underlying infrastructure; customers secure configuration, identity, data classification, and most application logic. A penetration tester’s job is almost never “hack AWS/Azure/GCP the company” — it is to assess the customer’s tenant, accounts, and workloads under written authorization.
Scope language must name accounts, subscriptions, projects, regions, and organization IDs when possible. “Our cloud” is not enough. Clarify whether production is allowed, whether control-plane enumeration is permitted, and whether social engineering of cloud support is forbidden (it usually is).
Shared multi-tenant services create hard boundaries: you may test the client’s tenant, not neighboring customers, not the provider’s management plane, and not random public buckets you found on the internet unless the engagement and law clearly allow it. Discoverability is not consent.
Think in layers: organization/tenant governance, identity and access management, network and edge, data stores, compute and serverless, CI/CD and secrets, logging and detection. Most real findings cluster in identity and data exposure, not exotic zero-days.
Identity is the new perimeter
Cloud breaches frequently start with a leaked access key, over-broad role trust, long-lived credential, or application that can assume powerful roles. Treat every secret, token, and role chain as potential privilege escalation material.
Build a mental model: principals (users, roles, service accounts), policies (what they can do), trust relationships (who can assume whom), and resource policies (what the resource allows). Cross-account roles and federated identity multiply complexity.
During authorized assessments, inventory principals with administrative or data-read capabilities, locate keys older than policy allows, and look for policies that grant * on * or overly broad service wildcards. Prefer read-only enumeration first unless the RoE permits privilege testing.
Passwords and keys in CI variables, chat logs, Terraform state, AMIs, and user-data scripts remain classic sources of initial access. Your job is to show realistic paths, not to spray every API at maximum rate.
Storage, public access, and data classification
Object storage (S3, Azure Blob, GCS) is a frequent critical surface when public ACLs, mis-set policies, or website hosting expose sensitive data. Check listing, read, and write paths carefully under authorization — unauthorized access to third-party buckets is not “research,” it is often illegal.
Distinguish public anonymous access, authenticated-but-overshared access (any principal in the org), and signed URL leakage. Impact depends on data sensitivity: customer PII, backups, source code, and infrastructure state files change severity dramatically.
Snapshots, AMIs, and unencrypted volumes with weak sharing settings can leak entire system images. Document identifiers, sample file names (not bulk exfiltration), and a clear business impact narrative.
Proportionality: prove you can read a non-sensitive marker file or metadata listing when possible; do not download entire production datasets “to make the finding look better.”
Compute, metadata services, and SSRF paths
Virtual machines, managed instances, and many container environments expose instance metadata endpoints that return temporary credentials and configuration. If an application can be tricked into requesting that endpoint (SSRF, local file include patterns, proxy abuse), the impact often becomes cloud role compromise.
Know the difference between older metadata services and hardened versions that require special headers or hop limits. Defenders increasingly block IMDSv1; operators should still check what the engagement target actually runs.
Serverless and PaaS reduce traditional OS post-exploitation but concentrate risk in function roles, environment variables, event triggers, and integration permissions. Map what each function identity can reach.
From a foothold, lateral movement may be pure API calls: list buckets, assume roles, read secrets managers, modify security groups. Capture API responses as evidence with redaction of long-lived secrets in client-facing reports.
Enumeration tooling and professional pacing
CLI tools (provider CLIs) and assessment frameworks help inventory accounts quickly. Start with whoami-style identity checks, then expand to policy simulation, public exposure scanners, and CIS-style configuration baselines.
Configuration scanners (for example CSPM-style tools) produce volume. Experts triage: prioritize identity privilege, public data, logging disabled, and internet-exposed management planes over low-signal noise.
Rate limits, API costs, and detection matter. Unbounded enumeration can look like compromise and can incur client charges. Use scoped regions, staggered queries, and agreed windows.
Every finding needs: affected principal or resource ARN/ID, permission or misconfiguration detail, proof of access path, business impact, and a remediation that maps to least privilege, encryption, logging, and network control.
Evidence, severity, and common overclaims
“We found a public bucket” is incomplete. Say what was readable, whether listing worked, whether writes were possible, and what data class was involved — with minimal samples.
Do not equate “AdministratorAccess on a sandbox account with no data” to the same severity as the same policy on production with customer records. Context is the difference between fear and accurate risk.
If you obtain temporary credentials via metadata, document TTL, attached policies, and what those credentials could reach in a controlled check agreed with the client. Avoid creating lasting backdoors unless explicitly authorized for purple-team exercises.
Cloud findings often become multi-team tickets: IAM, platform, app owners, and compliance. Write so each audience can act without a call.
Key concepts
- Shared responsibility model
- Division of security duties between cloud provider and customer; testers assess the customer’s side of the line under scope.
- IAM principal
- An identity that can act in the cloud (user, role, service account, federated identity) subject to policies and trust.
- Instance metadata service
- Link-local endpoint on many compute instances that can provide temporary credentials and host configuration to software on that host.
- Resource-based policy
- Access rules attached to a resource (bucket, queue, key) that control who can call it, often independent of caller identity policies alone.
- Least privilege
- Granting only the permissions required for a workload’s function; the primary remediation theme for most cloud findings.
Common mistakes
- Treating any public cloud resource on the internet as fair game without authorization
- Running full-account scanners against production without rate, cost, and detection discussion
- Exfiltrating large datasets to “prove” a storage finding instead of minimal evidence
- Reporting raw tool severity without mapping to data sensitivity and blast radius
- Ignoring federation, CI/CD identities, and long-lived access keys in favor of only console users
Defender view
- Centralized IAM review, short-lived credentials, and mandatory MFA on humans shrink the most common cloud breach paths.
- Public access blocks, encryption defaults, and continuous CSPM reduce accidental storage exposure.
- CloudTrail/activity logs plus alerts on unusual AssumeRole and GetObject patterns make authorized tests visible and real attacks harder to hide.
Operator checklist
- I can cite the account/subscription/project IDs in scope and those explicitly out of scope
- I start with identity context (whoami / caller identity) before noisy resource enumeration
- I have a plan for minimal evidence on data exposure findings
- I know whether metadata, privilege escalation, and destructive API calls are allowed
- My notes map each high finding to a concrete principal, resource, and remediation owner type
Example commands & patterns
# AWS — confirm identity in authorized account only
aws sts get-caller-identity
aws iam list-attached-user-policies --user-name <authorized-user>
aws s3api get-bucket-policy-status --bucket <in-scope-bucket>
aws ec2 describe-instances --region <region> --max-items 20
# Pacu / prowler-style assessments: only against authorized accounts, agreed regions, and RoE
prowler aws --region <region> -M csv json-html
Practice drills
- In a free-tier or deliberately weak cloud lab account you own, map all human and machine identities and rank them by privilege
- Create a private bucket, intentionally misconfigure a public-read object, prove access with minimal evidence, then remediate
- Document an SSRF-to-metadata attack path as a threat narrative without attacking any third-party system
- Run a configuration scanner against your lab account; triage the top ten findings into true risk vs noise
- Draft one critical and one medium cloud finding in client language with remediation steps
Tools for this lesson
Next: Apply the same identity-first mindset to containers and Kubernetes control planes in the next lesson.
Containers and Kubernetes surfaces
Images, runtimes, RBAC, and API servers: how container platforms expand attack surface and how to test them safely.
Learning objectives
- Explain image supply-chain and runtime risks that matter in real assessments
- Differentiate container escape hypotheses from ordinary application compromise
- Enumerate Kubernetes API, RBAC, secrets, and service exposure under authorization
- Use scanners and hunters as decision support, not as a substitute for threat modeling
- Write container/K8s findings that developers and platform teams can remediate
Deep teach-through
Containers are processes with packaging, not magic isolation
A container packages application code and dependencies with Linux isolation primitives (namespaces, cgroups, capabilities). Isolation quality depends on runtime configuration, kernel, and whether dangerous privileges were granted.
Compromise of an application inside a container is still a finding even without escape: secrets in environment variables, cloud roles via the node or service account, and network reachability to internal APIs often matter more than a flashy breakout demo.
Dangerous patterns include running as root unnecessarily, privileged containers, hostPath mounts of sensitive host paths, disabled seccomp/AppArmor/SELinux, and Docker socket mounts. Each turns a web bug into host or cluster risk.
Always separate: (1) vuln in app, (2) weak container config, (3) weak orchestrator identity, (4) weak cluster network policy. Conflating them produces confused reports.
Image risk and supply chain basics
Base images with unpatched OS packages, leaked secrets baked into layers, and untrusted registries are common. Static scanners find known CVEs and misconfigurations; they do not prove exploitability in context, but they prioritize investigation.
Check for secrets in image history, overly broad ENTRYPOINT scripts, and debug tooling left in production images. Prefer distroless or minimal images as remediation guidance.
CI systems that can push to production registries are high-value targets. Compromise of the pipeline may be more severe than compromise of a single running pod.
Document image digests, registry paths, and scanner evidence. Avoid dumping entire vulnerability databases into the executive summary — summarize critical classes and true business impact.
Kubernetes as a control plane attack surface
Kubernetes exposes an API server that is the source of truth for workloads. Anonymous or weakly authenticated API access, dashboard exposure, and overly powerful service accounts are classic findings.
RBAC binds subjects (users, groups, service accounts) to verbs on resources. Look for cluster-admin bindings, wildcards, and service accounts mounted into pods that can create privileged pods or read all secrets.
etcd, kubelet APIs, and cloud provider integrations can expand impact. Many managed K8s services change which layers you may touch — stay inside customer-authorized boundaries.
Network policies, ingress controllers, and service types (LoadBalancer/NodePort) determine how far a foothold can travel. Flat cluster networks remain common in labs and in poorly segmented production.
Enumeration workflow under RoE
From a developer laptop context: kubeconfig permissions, accessible namespaces, and ability to exec into pods. From a compromised pod: service account token, reachable API, secrets, and cloud metadata from the node environment.
Safe order: identity and permission discovery, then non-destructive resource listing, then controlled proof for high-impact access (for example reading a non-sensitive config map vs dumping all secrets).
Tools that “hunt” for weak RBAC or exposed dashboards accelerate work but generate false positives. Validate every critical claim manually with kubectl or API calls in scope.
Noise and availability: aggressive scanning of the API server or kubelets can stress control planes. Use agreed rates and maintenance windows when required.
Escapes, nodes, and cloud identity glue
Container breakout research is advanced and kernel-version dependent. In professional tests, privilege flags and mount abuse often provide more reliable, reportable paths than obscure CVEs.
Node compromise typically yields all pods on the node, kubelet credentials material, and often cloud instance roles. That is a cluster-level event — escalate to the client immediately if unexpected in a limited web test.
Workloads with cloud IAM roles via OIDC/IRSA (or equivalents) create direct cloud privilege from pod compromise. Map the trust from service account to cloud permissions explicitly in findings.
Never install cryptominers, persistent cluster malware, or unexplained DaemonSets “to demonstrate impact” unless a red-team RoE explicitly authorizes persistence and cleanup is planned.
Reporting for platform teams
Good K8s findings name namespace, service account, binding, and capability. Screenshots of dashboards help executives; YAML and RBAC snippets help engineers.
Remediation themes: least-privilege RBAC, no privileged pods by policy (PSS/PSA, OPA/Gatekeeper, Kyverno), network policies, secret management (not env-in-plain), image signing/admission, and API server exposure controls.
Separate operational hygiene (old images, missing resource limits) from exploitable paths. Both can appear, but severity must reflect attacker usefulness.
Retest criteria should be clear: binding removed, pod security enforced, secret rotated, public endpoint closed.
Key concepts
- Privileged container
- A container granted extensive host capabilities, often effectively weakening isolation to near-VM-admin levels.
- Service account token
- Credential mounted into pods by default in many clusters, authenticating the workload to the Kubernetes API.
- RBAC
- Role-based access control mapping subjects to allowed API operations on Kubernetes resources.
- Admission control
- Cluster policies that accept or reject workloads at create/update time (pod security, image rules, mutation).
- Supply-chain risk
- Threats introduced via base images, dependencies, registries, or CI/CD rather than only runtime exploitation.
Common mistakes
- Calling every container finding a “container escape” when it is only app compromise
- Dumping all secrets from a cluster to prove access instead of a minimal controlled proof
- Ignoring service account cloud roles that yield account takeover without any breakout
- Running kube hunters against shared multi-tenant clusters outside written scope
- Pasting thousands of CVE scanner rows into the report without prioritization
Defender view
- Pod security standards, network policies, and tight RBAC convert many footholds into dead ends.
- Image scanning in CI plus admission policies block known-bad or unsigned images before they schedule.
- Audit logs on the API server and alerts on sensitive verbs (get secrets, create privileged pods) enable rapid response.
Operator checklist
- I know whether cluster control-plane testing is authorized and which namespaces are in scope
- I record kubeconfig context, user/service account identity, and API server endpoint carefully
- I treat secret access and privileged pod creation as high-impact and minimize data pulled
- I validate scanner findings with manual evidence before marking critical
- My remediations name platform controls (RBAC, PSS, netpol, secrets manager), not only “patch CVE”
Example commands & patterns
kubectl config current-context
kubectl auth can-i --list
kubectl get pods,sa,secrets -A
kubectl get clusterrolebindings -o wide
trivy image <registry>/<image>:<tag>
# kube-hunter / kube-bench only against authorized lab or client clusters
kube-hunter --remote <authorized-api-or-node>
Practice drills
- Build a local kind/k3s/minikube lab; deploy a weak RBAC role and demonstrate secret read with evidence
- Scan a known vulnerable image with Trivy and write a prioritized finding for the top issues
- Map a pod service account to its Role/ClusterRole and rewrite it to least privilege
- Document a privileged container + hostPath risk path without performing destructive host changes
- Draft a cluster hardening checklist of ten controls for a fictional product team
Tools for this lesson
Next: Carry identity-first cloud thinking into wireless and adjacent physical-radio surfaces with strict legal boundaries.