Cloud Security
Most cloud breaches are not exotic exploits — they are misconfigurations. In the shared responsibility model the provider secures the cloud, but you secure what you put in it: identity, data, and configuration. This lesson walks from the responsibility line to cloud IAM and least privilege, identity federation and workload identity, the four recurring misconfigurations (public storage, over-permissive IAM, exposed secrets, the instance metadata service), the IMDSv1→SSRF credential-theft path, KMS encryption, audit logging, org-level guardrails, CSPM/CWPP/CNAPP tooling, and a full ATT&CK-mapped attack path.
The thirteen pillars of cloud security
From the shared responsibility model to a defender's checklist — each grounded in real standards, technique IDs, and incidents.
Cloud IAM & least privilege
Key points
- Cloud IAM is policy-as-data: access is granted by attaching policies/roles to identities (users, groups, service/workload identities) and sometimes to resources (resource-based policies). The effective permission is the union of identity and resource policies, minus explicit denies and org guardrails.
- Least privilege means granting only the specific actions on the specific resources required for a task — and nothing more. Over-permissive roles are the #1 cloud privilege-escalation enabler, mapping to Account Manipulation: Additional Cloud Roles (T1098.003) and Additional Cloud Credentials (T1098.001).
- Wildcard permissions are the cardinal sin: an AWS IAM statement of Action:"*" on Resource:"*" (or the *:* equivalents in other clouds) grants admin-equivalent power. A wildcard in the Principal of a resource policy can make a resource world-accessible.
- Privilege-escalation paths in cloud IAM often come from dangerous action combinations, not a single 'admin' grant — e.g. iam:CreatePolicyVersion, iam:PassRole + ec2:RunInstances, or lambda:UpdateFunctionCode let a low-privileged identity pivot to higher privilege. This is a confused-deputy / improper privilege-management problem.
- Map to weaknesses: CWE-269 Improper Privilege Management, CWE-284 Improper Access Control, CWE-862 Missing Authorization, CWE-863 Incorrect Authorization, and CWE-732 Incorrect Permission Assignment for Critical Resource.
- Valid cloud accounts are a primary attacker foothold (Valid Accounts: Cloud Accounts, T1078.004; Default Accounts, T1078.001). Compromised long-lived access keys / service-account keys are a common entry point — prefer short-lived, federated credentials instead.
- Defensive guidance: enforce MFA on human identities, prefer roles over long-lived keys, use access analyzers / unused-permission reports to right-size policies, and apply explicit deny boundaries. NIST SP 800-210 gives general access-control guidance for cloud systems.
References
Identity federation & workload identity
Key points
- Federation lets an external identity provider (IdP) assert identity to the cloud, so you avoid creating and storing long-lived cloud credentials. Human SSO commonly uses SAML 2.0 (OASIS) or OpenID Connect (OIDC, built on OAuth 2.0).
- Standards underpinning federation: OAuth 2.0 (RFC 6749), JSON Web Tokens (RFC 7519), the SAML 2.0 bearer-assertion profile for OAuth (RFC 7522), and the JWT bearer-assertion profile (RFC 7523). OIDC is layered directly on top of OAuth 2.0.
- Workload identity federation (e.g. GitHub Actions or Kubernetes service accounts assuming a cloud role via an OIDC token) removes static CI/CD secrets entirely — the pipeline presents a short-lived OIDC token and exchanges it for temporary cloud credentials.
- Attack surface of federation: forged or stolen assertions. Golden SAML (Forge Web Credentials: SAML Tokens, T1606.002) lets an attacker who controls the IdP signing key mint arbitrary SAML assertions and impersonate any user. Stolen application access tokens (Steal Application Access Token, T1528) bypass password and MFA.
- Misconfigured trust policies (overly broad audience/subject claims, or missing condition checks on the OIDC subject) let unintended principals assume privileged roles — a federation-specific access-control flaw (CWE-284, CWE-863).
- Defensive guidance: scope trust policies tightly to specific repos/branches/subjects, protect IdP signing keys in an HSM, prefer phishing-resistant MFA (WebAuthn/FIDO2) at the IdP, and keep token lifetimes short. NIST SP 800-63 covers digital identity assurance.
References
The most common cloud misconfigurations (overview)
Key points
- Four recurring failure classes account for the majority of cloud incidents: (1) public object storage, (2) over-permissive IAM roles, (3) exposed secrets, and (4) a reachable/legacy instance metadata service.
- All four are instances of OWASP A05:2021 Security Misconfiguration and A01:2021 Broken Access Control; for cloud APIs, API8:2023 Security Misconfiguration and API5:2023 Broken Function Level Authorization apply.
- Root weaknesses span CWE-276 Incorrect Default Permissions, CWE-732 Incorrect Permission Assignment, CWE-1188 Insecure Default Initialization of Resource, CWE-200 Exposure of Sensitive Information, and CWE-16 (Configuration, a category).
- Discovery techniques attackers use to find misconfigurations: Cloud Service Discovery (T1526), Cloud Infrastructure Discovery (T1580), Cloud Storage Object Discovery (T1619), and the Cloud Service Dashboard (T1538) for reconnaissance via the management console.
- Misconfiguration is detectable and preventable at scale with policy-as-code and posture scanning (see the Guardrails and CSPM/CNAPP sections) — these are configuration problems, not zero-days.
References
Public object storage exposure (S3 / Blob / GCS)
Key points
- Object storage buckets (AWS S3, Azure Blob Storage, Google Cloud Storage) are the most notorious cloud data-leak vector: a single ACL/policy change or a public-by-default container can expose entire datasets to the internet.
- The attacker objective maps to Data from Cloud Storage (T1530); enumeration of objects is Cloud Storage Object Discovery (T1619). Bucket names are often guessable or brute-forceable, so 'security by obscurity' of the bucket name is not protection.
- Underlying weaknesses: CWE-732 Incorrect Permission Assignment for Critical Resource, CWE-276 Incorrect Default Permissions, CWE-921 Storage of Sensitive Data in a Mechanism Without Access Control, and CWE-200 Exposure of Sensitive Information.
- Common mistakes: granting AllUsers / AuthenticatedUsers (GCS) or the AWS 'Everyone' / 'Any authenticated AWS user' grantee, public bucket policies with Principal:"*", disabling S3 Block Public Access, and over-broad CORS.
- Defensive guidance: enable account-wide public-access blocks (S3 Block Public Access, Azure 'disallow public blob access', GCS Public Access Prevention / Uniform bucket-level access), enforce default encryption, require TLS-only access via policy, and enable access logging. Map controls to the CIS cloud benchmarks.
- Real incident context: numerous large-scale exposures have stemmed from world-readable S3 buckets — the lesson is that default-private services become public through customer misconfiguration, illustrating A01:2021 / A05:2021.
References
The instance metadata service: IMDSv1 vs IMDSv2 and the SSRF → credential-theft path
Key points
- Every IaaS instance can reach a link-local metadata endpoint (AWS, Azure and GCP all use 169.254.169.254) that returns instance configuration and, critically, the TEMPORARY credentials of the instance's attached role / service account.
- Attacker objective: Unsecured Credentials: Cloud Instance Metadata API (T1552.005). If an application on the instance has a Server-Side Request Forgery flaw (CWE-918 SSRF, OWASP A10:2021), an attacker can coerce the app to GET the metadata URL and exfiltrate the role's STS/access-token credentials — then use them as Valid Accounts: Cloud Accounts (T1078.004) to reach storage and other services (T1530).
- IMDSv1 is request/response with NO authentication: any process (or SSRF-coerced request) that can reach the IP gets credentials in a single GET. This is the dangerous legacy mode.
- IMDSv2 is session-oriented and SSRF-resistant: the client must first issue a PUT to obtain a short-lived session token (X-aws-ec2-metadata-token), then send that token as a header on subsequent GETs, and the response honors a configurable IP hop limit (default 1) that prevents proxied/forwarded SSRF from reaching it. Most simple SSRF primitives cannot perform the PUT-with-custom-header step.
- Defensive guidance: require IMDSv2 (HttpTokens=required), set the metadata hop limit to 1, disable the metadata endpoint on instances that do not need a role, scope instance roles to least privilege, and apply egress controls. Azure IMDS requires the Metadata:true header and GCP metadata requires Metadata-Flavor:Google — both mitigate naive SSRF, but role scoping still matters.
- Canonical real-world example: the 2019 Capital One breach — a web-application SSRF reached IMDSv1, stole the EC2 instance-role credentials, and used them to read ~100M records from S3, exactly the SSRF (T1552.005) → cloud-account (T1078.004) → data-from-cloud-storage (T1530) chain. There was no CVE; it was a configuration / SSRF design failure.
References
Exposed secrets
Key points
- Secrets (access keys, API tokens, service-account JSON keys, DB passwords, private keys) leak through source code, container images, CI logs, IaC files, environment variables, and public repos. Found secrets become Valid Accounts (T1078.004) or Additional Cloud Credentials (T1098.001).
- Underlying weaknesses: CWE-798 Use of Hard-coded Credentials, CWE-522 Insufficiently Protected Credentials, CWE-312 Cleartext Storage of Sensitive Information, and CWE-200 Exposure of Sensitive Information.
- Long-lived static credentials are the core risk: they do not expire, are widely copied, and are rarely rotated. Prefer short-lived, federated/role-based credentials (see the Federation section) so a leaked secret has minimal blast radius and lifetime.
- Defensive guidance: store secrets in a managed secrets service (AWS Secrets Manager / SSM Parameter Store, Azure Key Vault, GCP Secret Manager), inject them at runtime, enable automatic rotation, scan repos/pipelines with secret-scanning, and use push-protection / pre-commit hooks. This maps to OWASP A05:2021 and aligns with A02:2021 Cryptographic Failures where keys protect data.
- Detection: provider credential-exposure alerts and audit logs (CloudTrail or equivalents) help spot the use of leaked keys from anomalous locations.
References
Encryption & key management (KMS)
Key points
- Protect data at rest and in transit. At rest: server-side encryption with a provider KMS (AWS KMS, Azure Key Vault / Managed HSM, GCP Cloud KMS). In transit: TLS 1.2+/1.3 enforced via bucket/endpoint policy.
- Failure to encrypt sensitive data maps to CWE-311 Missing Encryption of Sensitive Data and CWE-312 Cleartext Storage; weak or mismanaged keys relate to OWASP A02:2021 Cryptographic Failures.
- Key-management decisions that matter: provider-managed keys vs customer-managed keys (CMK) vs customer-supplied / BYOK / HYOK; envelope encryption (a data key encrypted by a key-encryption key); key rotation; and KMS key POLICIES (a too-broad kms:Decrypt grant undermines all the encryption above it — access control is part of crypto).
- Key lifecycle (generation, distribution, storage, rotation, revocation, destruction) should follow NIST SP 800-57 Part 1 recommendations for key management; FIPS 140-3 validated HSM modules back Managed HSM offerings.
- Defensive guidance: use CMKs for sensitive data so you control the key policy and can revoke/rotate independently of the data; enable automatic key rotation; restrict and log KMS key usage; and separate the duty of key administration from data access. Attacker abuse of keys for impact: Data Encrypted for Impact (T1486) — adversaries can weaponize KMS to ransom your own data by deleting or denying keys.
References
Audit logging & monitoring
Key points
- Audit logs are the control-plane flight recorder: AWS CloudTrail, Azure Monitor activity logs / Microsoft Entra sign-in & audit logs, and GCP Cloud Audit Logs record who did what, when, and from where across the management API.
- Insufficient logging is a top weakness — CWE-778 Insufficient Logging, CWE-223 Omission of Security-relevant Information — and maps to OWASP A09:2021 Security Logging and Monitoring Failures. Without it, you cannot detect or investigate cloud-account abuse (T1078.004) or metadata-credential theft (T1552.005).
- Best practices: enable logging in ALL regions/accounts (an organization trail), log data-plane events for sensitive stores (S3 object-level, KMS), deliver logs to a separate, locked-down logging account/bucket, enable log-file integrity validation, and apply object-lock/immutability so an attacker who compromises the workload cannot erase the evidence.
- Attackers attempt Impair Defenses: Disable Cloud Logs (T1562.008) — stopping or altering CloudTrail or audit pipelines is a high-fidelity detection signal; alert on logging-configuration changes.
- Centralize and analyze: ship logs to a SIEM and build detections for risky IAM changes, anomalous AssumeRole/token use, public-bucket policy changes, and root / global-admin activity. NIST SP 800-92 guides security log management.
References
Org-level guardrails (SCPs, Azure Policy, GCP Org Policy)
Key points
- Preventive guardrails enforce policy across an entire org/tenant regardless of individual account/project IAM, implementing defense-in-depth and a least-privilege ceiling.
- AWS Service Control Policies (SCPs) are org-management permission boundaries: they set the MAXIMUM available permissions for member accounts (they cannot grant, only restrict) — used to deny disabling CloudTrail, deny public S3, deny unapproved regions, or deny IMDSv1.
- Azure Policy enforces and audits resource configuration tenant-wide (deny/audit/deployIfNotExists effects), e.g. require storage encryption or block public blob access; Azure Management Groups scope it hierarchically.
- GCP Organization Policy Service sets constraints across the resource hierarchy, e.g. constraints/storage.publicAccessPrevention, constraints/iam.disableServiceAccountKeyCreation, and domain-restricted sharing to block AllUsers grants.
- These map to defenses for Broken Access Control (A01:2021) and Security Misconfiguration (A05:2021) and embody the policy-enforcement-point model of zero trust (NIST SP 800-207). They prevent the misconfigurations in sections 5–8 from ever being created.
- Pattern: combine a deny-by-default guardrail (SCP / Org Policy) with least-privilege IAM and continuous CSPM detection — prevention plus detection.
References
Cloud security tooling: CSPM, CWPP, CNAPP
Key points
- CSPM (Cloud Security Posture Management) continuously scans cloud CONFIGURATION and IAM against benchmarks (CIS, provider best practices) to find misconfigurations like public buckets, over-permissive roles, IMDSv1, missing encryption, and unencrypted logs. It addresses the misconfiguration classes in sections 4–9.
- CWPP (Cloud Workload Protection Platform) protects the WORKLOADS themselves — VMs, containers, serverless — with vulnerability scanning, runtime threat detection, integrity monitoring, and hardening. Its focus is the running compute, not the cloud config.
- CNAPP (Cloud-Native Application Protection Platform) is the convergence of CSPM + CWPP (plus CIEM for entitlements, IaC scanning, and often KSPM for Kubernetes) into a unified platform that correlates posture, workload, identity, and data risk into prioritized attack paths.
- CIEM (Cloud Infrastructure Entitlement Management), often a CNAPP module, specifically right-sizes IAM entitlements and surfaces toxic permission combinations and privilege-escalation paths (relevant to T1098.003 / CWE-269).
- Teaching framing: CSPM = is it CONFIGURED safely; CWPP = is the WORKLOAD compromised; CNAPP = unified context that ties a misconfigured public asset to a vulnerable workload to an over-privileged identity to sensitive data — the full attack path. These tools detect and prioritize; guardrails (section 10) prevent.
References
Putting it together: a cloud attack path mapped to ATT&CK
Key points
- Initial access / discovery: the attacker enumerates exposed assets via Cloud Service Discovery (T1526), Cloud Infrastructure Discovery (T1580), and the web Cloud Service Dashboard (T1538), then finds an internet-facing app (Exploit Public-Facing Application, T1190).
- Credential access: an SSRF (CWE-918) in the app reaches the instance metadata service to steal the role credentials — Unsecured Credentials: Cloud Instance Metadata API (T1552.005); alternatively, leaked static keys (CWE-798) are found.
- Persistence / privilege escalation: the attacker authenticates as Valid Accounts: Cloud Accounts (T1078.004) and creates Additional Cloud Credentials (T1098.001) or Additional Cloud Roles (T1098.003) to entrench and escalate via over-permissive policies (CWE-269).
- Collection / exfiltration: the attacker enumerates and reads object storage — Cloud Storage Object Discovery (T1619), Data from Cloud Storage (T1530) — and exfiltrates via Transfer Data to Cloud Account (T1537) or Exfiltration to Cloud Storage (T1567.002).
- Impact: Data Encrypted for Impact / ransom (T1486), Resource Hijacking for cryptomining (T1496), or Impair Defenses: Disable Cloud Logs (T1562.008) to cover tracks.
- Each step has a corresponding control already covered: IMDSv2 + an SCP that denies IMDSv1 (credential access), least-privilege IAM + CIEM (priv-esc), public-access-block + CMK encryption (collection), and immutable audit logs + SIEM detections (impact / anti-forensics).
References
Defender's checklist & key takeaways
Key points
- Identity: enforce MFA (phishing-resistant where possible), eliminate long-lived keys in favor of federated/role-based short-lived credentials, and right-size every policy to least privilege — no Action:* on Resource:*.
- Compute: require IMDSv2 with hop limit 1, disable metadata where no role is needed, and patch/harden workloads (CWPP).
- Data: block public access on all object storage, default-encrypt with customer-managed KMS keys, and enforce TLS-only access.
- Secrets: never hard-code; use a managed secrets store with rotation; and scan code and pipelines.
- Visibility: enable multi-region / org-wide audit logging to an immutable, isolated destination; centralize it in a SIEM; and alert on logging changes and risky IAM events.
- Prevention at scale: deploy org-level guardrails (SCP / Azure Policy / GCP Org Policy) to make insecure states impossible, and run CSPM/CNAPP for continuous detection and attack-path prioritization.
- Foundational mindset: in the shared responsibility model the customer owns identity, data, and configuration; the overwhelming majority of cloud breaches are preventable misconfigurations, not provider failures. Align controls to the CIS Benchmarks, ISO/IEC 27017/27018, and NIST cloud guidance.
References
See the cloud kill chain end-to-end
A single misconfiguration is rarely the whole story. Trace how a public asset, an SSRF, and an over-privileged role chain into full compromise across the attack paths.