Module 20 · Cloud Security · Lesson 60 of 75

Misconfigurations, logging and cloud detection

Public storage, the instance metadata service and IMDSv2, open security groups and exposed secrets; an AWS CLI audit lab; CloudTrail, GuardDuty and cloud security posture management.

In this lesson · about 45 minutes

  • Find and fix the most common cloud misconfigurations
  • Explain the metadata-service attack and why IMDSv2 stops it
  • Know which cloud logs and services detect attacks

The usual suspects

  • Public object storage (S3 buckets, Azure blob containers, GCS buckets) holding backups or customer files. Fix: Block Public Access at the account level, and serve public files through a CDN instead.
  • Open security groups: SSH (22), RDP (3389) or databases (3306, 5432, 27017) open to 0.0.0.0/0. Fix: restrict to known IPs, or use a bastion, VPN or Session Manager.
  • Instance metadata service: every VM can ask http://169.254.169.254/ for its role's temporary credentials. If a web app has an SSRF flaw (Module 11), an attacker can make the server fetch that URL and steal the keys; this is how the 2019 Capital One breach worked. IMDSv2 requires a session token obtained with a PUT request and a hop limit, which simple SSRF cannot do. Enforce it.
  • Unencrypted storage and snapshots, or public snapshots and machine images.
  • Secrets in code, user data scripts or environment variables. Use a secrets manager.
  • Logging switched off, or logs stored in the same account an attacker controls.

Cloud logs and detection

AWSAzureGCPRecords
CloudTrailActivity Log, Entra ID sign-in logsCloud Audit LogsEvery API call: who, what, when, from where
VPC Flow LogsNSG flow logsVPC Flow LogsNetwork connections
GuardDutyDefender for CloudSecurity Command CenterManaged threat detection

High-value CloudTrail events to alert on: ConsoleLogin without MFA or from a new country, StopLogging or DeleteTrail, CreateAccessKey for another user, AttachUserPolicy with admin, PutBucketPolicy making a bucket public, and many RunInstances calls (crypto-mining).

Posture management and infrastructure as code

  • CSPM tools (AWS Security Hub, Defender for Cloud, Prowler, ScoutSuite) continuously check accounts against CIS Benchmarks.
  • IaC scanning (Checkov, tfsec, KICS) catches the open bucket in the Terraform file before it is ever deployed (Module 23).
  • CNAPP platforms combine posture, workload protection, container and identity risk.

Containers and Kubernetes, briefly

Scan images for vulnerabilities, do not run containers as root or privileged, limit Kubernetes RBAC, restrict pod network traffic with network policies, and keep the API server private.

Hands-on lab (simulated terminal)

Lab: audit an AWS account with the CLI

You have read-only audit credentials for the retailer's test account. Every account ID and name is made up; output is simulated.

Step 1 of 6. Type each command and press Enter. Nothing runs on your computer.

Lab: audit an AWS account with the CLI

1. Confirm which identity your credentials belong to.

auditor@laptop:~$

Check your understanding0 of 4 correct

Question 1

1.Why does IMDSv2 stop most SSRF credential theft?

Question 2

2.Which AWS service records every API call?

Question 3

3.An alert fires on StopLogging. Why is it serious?

Question 4

4.Which tool scans Terraform files for misconfigurations before deployment?

Flashcards

Module 20 flashcards

0 of 10 known

Say the answer out loud, flip the card, then be honest: cards you miss come back at the end.

10 left in the deck

Practice exam

Module 20 checkpoint

10 questions, 12 minutes.

  • 10 questions · 12 minutes
  • No feedback until you submit. Flag questions to come back to them.
  • Aim for 85% or better before you move on. The real exam's 750 out of 900 is roughly 80–83%.

Quiz score: 0 of 4

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. All labs are simulations: no real systems are touched, and every name, address, password and hash is made up. The offensive techniques taught here are for defending systems and for authorised testing only; never scan, access or test a system without the owner's written permission. Tool and product names belong to their owners, and command output may differ slightly from yours. Read-aloud uses your device's built-in voices.