11. Cloud and Infrastructure Security
This chapter covers how to secure systems that you do not physically own and often cannot even see — rented compute in a public cloud, and the industrial and embedded devices that run the physical world. It moves from the foundations every cloud user must internalize (who is responsible for what, and how identity replaces the network perimeter), through the defensive tooling and automation that keep large cloud estates safe, into the zero-trust architecture that modern networks are converging on, and finally to operational technology and IoT, where decades-old protocols and twenty-year device lifespans collide with internet connectivity. The thread running through all of it is that the old model — a trusted inside protected by a hard outer wall — has dissolved, and security now depends on identity, configuration, and segmentation rather than on a castle wall.
<a id="111-cloud-security-foundations"></a>
11.1 Cloud Security Foundations
Before you can defend anything in the cloud you need a correct mental model of what the cloud actually is: someone else's computers, rented through an API, shared with strangers, governed by configuration rather than cabling. This section builds that model — the service and deployment models that define what you rent, the responsibility split that defines what you must secure, and the identity, isolation, storage, and data-location concerns that cause the great majority of real cloud breaches.
Service and Deployment Models
Theory
"The cloud" is not one thing; it is a spectrum of how much of the computing stack you rent versus manage yourself. The useful way to understand it is to picture the full stack — from the physical datacenter at the bottom up to the running application at the top — and ask where the dividing line sits between "the provider operates this" and "you operate this." The three classic service models are just three places to draw that line.
| Model | You rent | You manage | Everyday analogy | Example |
|---|---|---|---|---|
| IaaS (Infrastructure as a Service) | Virtual machines, networks, storage | OS, runtime, apps, data | Renting an empty apartment | AWS EC2, Azure VMs |
| PaaS (Platform as a Service) | A managed runtime/platform | Your app code and data only | Renting a serviced office | Heroku, App Engine, RDS |
| SaaS (Software as a Service) | A finished application | Your data and user access | Staying in a hotel | Gmail, Salesforce, Microsoft 365 |
The higher you go (IaaS → PaaS → SaaS), the less you manage and therefore the less you can misconfigure — but also the less control you have. The security lesson is that your responsibilities shrink as you move up the stack, which directly sets up the Shared Responsibility Model below.
Deployment models are a separate axis — they describe who the infrastructure is shared with, not how much of the stack you rent:
- Public cloud: infrastructure shared across many unrelated customers (tenants) over the internet. Cheapest and most scalable; you trust the provider's isolation.
- Private cloud: infrastructure dedicated to a single organization (on-premises or hosted). More control and isolation, higher cost, less elasticity.
- Hybrid cloud: a deliberate mix — e.g., sensitive data on a private cloud, burst capacity on a public cloud — connected so workloads and data can move between them.
- Community cloud (less common): shared by several organizations with common requirements (e.g., a group of hospitals under the same regulations).
Examples
MANAGED BY YOU (your security responsibility) ────────────▶
On-prem IaaS PaaS SaaS
┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐
│ Apps │ │ Apps │ │ Apps │ │ Apps │ ░ provider
│ Data │ │ Data │ │ Data │ │ Data ░ │ █ you
│ Runtime│ │ Runtime│ │ Rntm ░ │ │ Rntm ░ │
│ OS │ │ OS │ │ OS ░ │ │ OS ░ │
│ Virt │ │ Virt ░ │ │ Virt ░ │ │ Virt ░ │
│ Servers│ │ Srvr ░ │ │ Srvr ░ │ │ Srvr ░ │
│ Network│ │ Net ░ │ │ Net ░ │ │ Net ░ │
└────────┘ └────────┘ └────────┘ └────────┘
all you you own the you own code you own
OS & up & data only data/access
Key Takeaways
- Service models (IaaS/PaaS/SaaS) describe how much of the stack you rent; deployment models (public/private/hybrid) describe who you share it with.
- Moving up from IaaS to SaaS reduces both your management burden and your attack surface for misconfiguration, but also your control.
- "The cloud is just someone else's computer" is a useful first instinct: the provider's security and your configuration both matter.
- Hybrid is a design choice, not a compromise — it lets you place each workload where its cost, control, and compliance needs fit best.
🧪 Practice
- Classify these as IaaS, PaaS, or SaaS: a managed PostgreSQL database, a bare Linux VM, a hosted CRM, a container platform where you push images.
- For a startup that wants to run a Python web app without patching operating systems, recommend a service model and justify it in one sentence.
- Describe one workload that belongs on a private cloud and one that belongs on a public cloud for the same company, and explain the split.
- Interview-style: "How does the service model you choose change your security responsibilities?" Hint: think about which layers of the stack you can no longer touch — and therefore can no longer secure or break.
The Shared Responsibility Model
Theory
The single most important — and most misunderstood — concept in cloud security is that security is shared between you and the provider, and the dividing line moves depending on the service model. The provider secures the cloud itself; you secure what you put in it. AWS phrases this as "security of the cloud" (theirs) versus "security in the cloud" (yours). The reason breaches happen is that people assume "it's in the cloud, so it's secure" and leave their half unattended — an open storage bucket or an over-permissioned key is squarely on the customer's side of the line.
A clean analogy: a bank provides the vault, the guards, and the alarm (the provider's responsibility), but you still have to lock your own safe-deposit box and not write the combination on the door (your responsibility). The vault being world-class does nothing if you leave your box open.
The line shifts with the service model. In IaaS you are responsible for the guest OS, patching, firewall rules, encryption, and identity; in SaaS the provider handles almost everything except your data, your user accounts, and your access configuration — which, notably, is exactly where SaaS incidents occur (weak passwords, no MFA, wrong sharing settings).
Examples
IaaS PaaS SaaS
Data YOU YOU YOU ◀── always yours
Identity/access YOU YOU YOU ◀── always yours
Application YOU YOU provider
OS / patching YOU provider provider
Network controls YOU(cfg) shared provider
Hypervisor provider provider provider
Physical provider provider provider ◀── always theirs
Constant across ALL models: your DATA and your ACCESS config are YOURS.
# Terraform: the customer's half of IaaS responsibility made explicit.
# The provider secures the hardware; THIS is what you must get right.
resource "aws_s3_bucket_public_access_block" "data" {
bucket = aws_s3_bucket.data.id
block_public_acls = true # your job: deny public ACLs
block_public_policy = true # your job: deny public bucket policies
ignore_public_acls = true
restrict_public_buckets = true # belt-and-suspenders against exposure
}
Key Takeaways
- The provider secures the cloud (hardware, hypervisor, physical datacenter); you secure what you run in it (data, access, and — depending on model — OS, apps, network config).
- The boundary slides up the stack from IaaS to SaaS, but your data and access configuration are always your responsibility.
- Most cloud breaches are customer-side misconfigurations, not provider failures — "it's in the cloud" is not a security control.
- Knowing exactly where the line sits for each service you use is a prerequisite to securing it.
🧪 Practice
- For AWS S3 (storage), Azure VMs, and Google Workspace, state which party is responsible for patching the operating system.
- A company's SaaS CRM leaks records because an admin set a report to "anyone with the link." Whose responsibility was that, and why?
- List the responsibilities that stay with the customer regardless of IaaS/PaaS/SaaS.
- Interview-style: "A team says 'we moved to the cloud so backups are handled for us.' What's wrong with that assumption?" Hint: separate durability of the storage service from responsibility for a recoverable backup of your data.
Cloud Identity and IAM Policies
Theory
In a traditional datacenter the network was the control: if you were on the LAN you were mostly trusted. In the cloud there is no LAN you own — every action is an authenticated, authorized API call. That makes Identity and Access Management (IAM) the real perimeter. A stolen or over-privileged credential in the cloud is equivalent to an attacker walking straight through the front door, because the "door" is simply whether the API accepts your identity and grants the action.
IAM has a few building blocks that recur across every provider:
- Principals — the who: users, groups, roles, and service accounts.
- Policies — the what: documents that allow or deny specific actions on specific resources, often with conditions.
- Roles — a set of permissions that a principal temporarily assumes, rather than permanent credentials. Roles are the preferred pattern because they issue short-lived credentials and avoid long-lived secrets.
The governing principle is least privilege: grant only the permissions actually needed, scoped to the specific resources needed. The most common failure is the opposite — wildcard policies ("Action": "*", "Resource": "*") attached broadly "to make it work," which turn any compromise into a full account takeover. A related risk is privilege escalation through IAM itself: if a principal can modify policies or pass roles, it can grant itself more power, so permissions like iam:PassRole, iam:CreatePolicyVersion, and sts:AssumeRole deserve special scrutiny.
Examples
// Least-privilege policy: read ONE prefix of ONE bucket, nothing else.
// Note the specific Action and Resource, and a condition narrowing it further.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["s3:GetObject"], // one action, not s3:*
"Resource": "arn:aws:s3:::reports-bucket/2026/*", // one bucket, one prefix
"Condition": {
"IpAddress": { "aws:SourceIp": "203.0.113.0/24" } // only from office range
}
}]
}
// ANTI-PATTERN: the policy that causes account takeovers.
// A single wildcard on actions AND resources = effectively admin.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "*", // every action in the account
"Resource": "*" // on every resource
}]
}
Key Takeaways
- In the cloud, identity is the perimeter: every action is an authorized API call, so a credential is as powerful as what its policy allows.
- Prefer roles and short-lived credentials over long-lived access keys; rotate and scope anything long-lived.
- Enforce least privilege with specific actions, specific resources, and conditions — never default to
*. - Guard IAM-modifying permissions (
iam:PassRole, policy edits,AssumeRole) carefully; they enable self-escalation from a minor foothold to full control.
🧪 Practice
- Rewrite a wildcard policy (
Action: "*",Resource: "*") into a least-privilege version for "an app that only reads messages from one SQS queue."- Explain why assuming a role for 1 hour is safer than embedding a permanent access key in a deployed container.
- Identify which of these permissions could enable privilege escalation and say why:
s3:GetObject,iam:PutUserPolicy,ec2:DescribeInstances.- Interview-style: "Why is a leaked IAM access key often worse than a leaked database password?" Hint: consider blast radius across services and whether the key can grant itself more access.
Multi-Tenancy Isolation Risks
Theory
Public cloud economics come from multi-tenancy: many unrelated customers share the same underlying physical hardware, with the provider using virtualization to keep them logically separated. The risk this introduces is isolation failure — a defect that lets one tenant observe or affect another. Think of an apartment building: you expect your walls to keep neighbors out, but thin walls (information leakage), a shared ventilation system (side channels), or a master key held carelessly (control-plane flaws) all break that expectation.
The isolation boundaries, from strongest to weakest, roughly are: separate physical hosts > hardware-virtualized VMs > containers sharing a kernel > shared process/runtime (as in some serverless or SaaS). Weaker isolation is cheaper and denser but leaves more shared surface. The notable risk classes are:
- Hypervisor / VM escape: a bug lets code break out of its VM onto the host and reach other tenants' VMs — rare but catastrophic.
- Container escape: easier than VM escape because containers share the host kernel; a kernel bug or a misconfigured privileged container can break out.
- Side channels: shared CPU caches, memory, or hardware leak information across tenants without a direct breach (Spectre/Meltdown-class attacks, covered in 14.3, were partly cloud-relevant for this reason).
- Noisy-neighbor / resource exhaustion: one tenant degrading another's performance — an availability, not confidentiality, concern.
- Shared-service data bleed: in SaaS, a logic bug returns tenant A's data to tenant B (a broken
tenant_idcheck), which is the most common practical multi-tenancy failure.
Examples
Shared physical host
┌───────────────────────────────────────────────┐
│ Hypervisor │ ← escape here = game over
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Tenant A │ │ Tenant B │ │ Tenant C │ │
│ │ VM │ │ VM │ │ VM │ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ ▲ shared CPU cache / RAM = side-channel ▲ │
└───────────────────────────────────────────────┘
Strongest ─────────────────────────────────▶ Weakest isolation
Separate host > VM > Container (shared kernel) > Shared runtime
# The everyday multi-tenancy bug in SaaS: a missing tenant scope.
# VULNERABLE: trusts the record ID without checking who owns it.
def get_invoice(invoice_id):
return db.query("SELECT * FROM invoices WHERE id = ?", invoice_id)
# Tenant B passes Tenant A's invoice_id and reads it. Cross-tenant leak.
# FIXED: every query is scoped to the caller's tenant.
def get_invoice(invoice_id, tenant_id):
return db.query(
"SELECT * FROM invoices WHERE id = ? AND tenant_id = ?",
invoice_id, tenant_id) # ownership enforced in the query itself
Key Takeaways
- Multi-tenancy means sharing physical hardware with strangers; security depends on the provider's isolation holding.
- Isolation strength ranks: separate hosts > VMs > containers (shared kernel) > shared runtimes — denser is cheaper but leakier.
- Catastrophic-but-rare risks (VM/container escape, side channels) are the provider's problem; the common practical risk is your own missing
tenant_idchecks in SaaS code. - For highly sensitive workloads you can pay for stronger isolation (dedicated hosts, confidential computing) to reduce shared surface.
🧪 Practice
- Rank these by isolation strength and explain the ordering: two containers on one node, two VMs on one host, two workloads on dedicated bare-metal hosts.
- Spot the vulnerability in a function that fetches
orderby ID alone in a multi-tenant app, and fix it.- Explain why a container escape is generally considered more likely than a hypervisor escape.
- Interview-style: "What options exist if a workload is too sensitive to share hardware with other tenants?" Hint: think dedicated/bare-metal instances and confidential computing (encrypted-in-use memory).
Cloud Storage Exposure and Misconfiguration
Theory
Object storage — AWS S3 buckets, Azure Blob containers, Google Cloud Storage — is where an enormous share of real-world cloud data leaks have occurred, almost never through a provider breach and almost always through a customer leaving a bucket readable by "everyone." The reason this keeps happening is a mismatch between how easy it is to make storage public and how invisible that setting is afterward: one checkbox or one broad policy, and terabytes of data are indexable by anyone who guesses or scans for the URL. Attackers routinely scan for open buckets the way burglars check for unlocked doors.
The core defenses are straightforward and layered:
- Default private, deny public: modern providers now block public access by default; keep those blocks on at the account level so an individual mistake cannot override them.
- Least-privilege access policies rather than broad grants; beware the subtle difference between
AuthenticatedUsers(which in AWS historically meant any AWS account, not yours) and your specific principals. - Encryption at rest (usually on by default) and encryption in transit (enforce TLS-only access).
- Versioning and object lock to survive accidental or malicious deletion/overwrite (overlaps with immutable backups in 13.5).
- Continuous monitoring for any resource that becomes public — this is exactly what CSPM (11.2) automates.
A second, quieter failure is over-sharing within the organization or via pre-signed URLs that never expire — access that is not "public" but far broader than intended.
Examples
How an open bucket becomes a breach:
Attacker Internet Your bucket
│ mass-scan for buckets │ │
│─────────────────────────────▶ GET company-backups.s3... │
│ │ 200 OK + ListObjects │ ◀ public READ
│◀───────────────────────────── <all object keys> │ + LIST on
│ download every object │ │ = full dump
# Detective control: find buckets that are readable by the world.
# (Illustrative AWS CLI — run against your own account only.)
for b in $(aws s3api list-buckets --query 'Buckets[].Name' --output text); do
pub=$(aws s3api get-bucket-policy-status --bucket "$b" \
--query 'PolicyStatus.IsPublic' --output text 2>/dev/null)
echo "$b public=$pub" # flag any bucket reporting public=True
done
Key Takeaways
- Open object storage is the archetypal cloud breach — a customer misconfiguration, not a provider failure.
- Enforce "block public access" at the account level so individual mistakes cannot expose data; default to private.
- Layer defenses: least-privilege policies, TLS-only, encryption at rest, versioning/object-lock, and continuous exposure monitoring.
- Watch non-obvious over-sharing too: "authenticated users" scoped too broadly, and never-expiring pre-signed links.
🧪 Practice
- Describe, step by step, how an attacker finds and dumps a publicly readable storage bucket.
- List four distinct controls that together keep a bucket holding PII safe, and say what each one defends against.
- Explain the danger of an AWS policy granting access to
AuthenticatedUsers.- Interview-style: "Why do open-bucket breaches persist despite providers defaulting to private?" Hint: think about explicit overrides, legacy buckets, pre-signed URLs, and drift over time.
Data Residency and Sovereignty
Theory
Cloud data physically lives in datacenters located in specific countries, and where it lives has legal consequences independent of how well it is technically secured. Data residency is the requirement that data be stored (and sometimes processed) within a particular geographic boundary. Data sovereignty is the stronger idea that data is subject to the laws of the country it resides in — including that country's government potentially compelling access. The distinction matters because a dataset can be perfectly encrypted and still create legal exposure simply by sitting in the wrong jurisdiction.
The drivers are regulatory: the EU's GDPR restricts transfers of personal data outside the EU/EEA unless adequate protections exist; many countries (e.g., in finance, health, or public sector) mandate in-country storage; and laws like the US CLOUD Act can compel US-headquartered providers to produce data even when it is stored abroad, which is precisely what raises sovereignty concerns for non-US customers. These forces sometimes conflict — one law demands local storage while another claims extraterritorial access — and the resolution is architectural, not just contractual.
Practical controls include: pinning resources to specific cloud regions and disabling replication to others; using provider features that guarantee data stays in-region; choosing sovereign cloud offerings operated by local entities; and, as a technical backstop, holding your own encryption keys (BYOK/HYOK, see KMS in 11.2) so that even a lawful demand to the provider yields only ciphertext.
Examples
Residency vs. Sovereignty
RESIDENCY (where it is stored) SOVEREIGNTY (whose law applies)
┌────────────────────────────┐ ┌────────────────────────────────┐
│ "EU customer data must stay │ │ "Data in Country X is subject │
│ in eu-west-1 (Ireland)." │ → │ to X's laws, incl. lawful │
│ A storage-location rule. │ │ access demands — even to a │
└────────────────────────────┘ │ foreign-owned provider there." │
└────────────────────────────────┘
Control: pin region, block Control: sovereign cloud + hold
cross-region replication your own keys (provider sees only
ciphertext).
# Pinning a workload to an EU region and preventing accidental data egress.
provider "aws" {
region = "eu-west-1" # all resources created here by default
}
resource "aws_s3_bucket" "eu_data" {
bucket = "customer-pii-eu"
}
# No replication_configuration block = data is NOT copied to other regions.
# A residency control enforced by omission as much as by configuration.
Key Takeaways
- Residency = where data is stored; sovereignty = whose laws govern it, including compelled access.
- Regulations (GDPR, sector mandates) and extraterritorial laws (e.g., CLOUD Act) can pull in opposite directions; resolve this in architecture.
- Enforce location by pinning regions and disabling cross-region replication; consider sovereign-cloud offerings for strict cases.
- Holding your own encryption keys is the technical backstop: a lawful demand to the provider then yields only ciphertext.
🧪 Practice
- In one sentence each, distinguish data residency from data sovereignty with a concrete example of each.
- Explain how holding your own encryption keys mitigates a sovereignty concern even when the provider is foreign-owned.
- Name two technical settings you would configure to keep a dataset inside a single country.
- Interview-style: "An EU company uses a US cloud provider's EU region. Why might sovereignty still be a concern?" Hint: consider laws that reach a provider based on where the company is headquartered, not where the data sits.
<a id="112-cloud-defense-practices"></a>
11.2 Cloud Defense Practices
Knowing the foundations tells you what can go wrong; this section covers the tooling and practices that keep it from going wrong at scale. Cloud estates are too large and change too fast to secure by hand, so the theme here is continuous, automated defense — scanning posture, protecting workloads, securing serverless code, capturing a complete audit trail, managing encryption keys, and building accounts that are safe by default.
Cloud Security Posture Management (CSPM)
Theory
A real cloud account has thousands of resources created and changed daily by many teams, and any one of them can be misconfigured into a breach (an open bucket, a security group open to 0.0.0.0/0, a disabled log). No human can watch all of that, so Cloud Security Posture Management tools do it continuously: they connect to your cloud via API, inventory every resource, and compare each one's configuration against a library of best-practice and compliance rules, then alert (or auto-remediate) on violations. Think of CSPM as a tireless building inspector that re-checks every door, window, and lock in a skyscraper every few minutes and files a report of anything left unlocked.
CSPM focuses specifically on the configuration and control-plane layer — it is not scanning the contents of your VMs (that is CWPP, next). Its value is catching drift: the gap that opens between your intended secure state and the actual state as people make changes over time. Mature CSPM does three things: (1) continuous misconfiguration detection mapped to frameworks like CIS Benchmarks, PCI-DSS, or GDPR; (2) prioritized findings (an open database beats an untagged resource); and (3) optional auto-remediation, where a detected violation triggers an automatic fix. The ideal is to shift this left — run the same policy checks against infrastructure-as-code in CI so misconfigurations are caught before deployment, not after.
Examples
CSPM control loop (runs continuously):
┌──────────────┐ read config ┌─────────────┐ compare ┌───────────┐
│ Cloud APIs │ ───────────────▶ │ CSPM engine │ ──────────▶ │ Rule set │
│ (all regions)│ │ (inventory) │ │ CIS/PCI.. │
└──────────────┘ └──────┬──────┘ └───────────┘
│ violation?
┌───────────────┼────────────────┐
▼ ▼ ▼
Alert SOC Open ticket Auto-remediate
(e.g., re-enable
public-access block)
# A CSPM-style policy as code (illustrative). Checks that S3 buckets
# forbid public access. Tools like this run in CI AND against live accounts.
policy: s3-no-public-access
resource: aws.s3
description: Buckets must block all public access
filters:
- type: check-public-access
BlockPublicAcls: false # any of these being false = a finding
BlockPublicPolicy: false
IgnorePublicAcls: false
RestrictPublicBuckets: false
actions:
- type: set-public-block # auto-remediation: turn the blocks back on
state: true
Key Takeaways
- CSPM continuously inventories cloud resources and checks their configuration against best-practice and compliance rules, catching misconfiguration drift no human could track.
- It targets the control plane (settings, policies, exposure), not the contents of workloads — that is CWPP's job.
- Findings should be prioritized by real risk and mapped to frameworks (CIS, PCI-DSS, GDPR); auto-remediation closes the loop for well-understood violations.
- Shift the same checks left into CI against infrastructure-as-code to prevent misconfigurations before they ship.
🧪 Practice
- List five configuration checks a CSPM tool should run on a new AWS account.
- Explain "configuration drift" and why a one-time audit is insufficient without CSPM.
- Give one misconfiguration where auto-remediation is safe and one where it is risky, with reasons.
- Interview-style: "What's the difference between CSPM and a vulnerability scanner running inside a VM?" Hint: control-plane configuration versus in-workload software flaws.
Cloud Workload Protection Platforms (CWPP)
Theory
CSPM watches the settings of your cloud; Cloud Workload Protection Platforms watch what is running inside the workloads — the VMs, containers, and serverless functions themselves. Where CSPM asks "is this bucket public?", CWPP asks "does this container have a vulnerable library, a known-bad process, or a suspicious outbound connection?" The two are complementary halves of cloud defense: configuration versus runtime.
CWPP exists because cloud workloads are numerous, ephemeral, and heterogeneous — a container may live for minutes — so protection has to be lightweight, automated, and able to follow a workload wherever it runs. Its typical capabilities span the workload lifecycle:
- Vulnerability and image scanning: scan container images and VM contents for known CVEs before deployment and continuously after.
- Configuration/hardening checks inside the workload (CIS OS benchmarks, insecure settings).
- Runtime protection: behavioral monitoring, file-integrity monitoring, and blocking anomalous activity (a web server suddenly spawning a shell).
- Network segmentation / microsegmentation between workloads (ties to 11.3).
- Integrity and drift detection for the running system.
A key CWPP philosophy for containers is immutability: a running container should never be patched in place; instead you rebuild the image and redeploy. This makes unexpected changes inside a running container inherently suspicious and easy to detect.
Examples
CSPM vs. CWPP — two complementary lenses on the same cloud:
CONTROL PLANE (CSPM) DATA PLANE / RUNTIME (CWPP)
┌──────────────────────────┐ ┌────────────────────────────────┐
│ Is the bucket public? │ │ Is this container image CVE-free?│
│ Is logging enabled? │ │ Is a shell spawning in prod? │
│ Is the SG open to world? │ │ Was a system file modified? │
│ Is MFA enforced? │ │ Is traffic going to a C2 host? │
└──────────────────────────┘ └────────────────────────────────┘
"settings are safe" "what's running is safe"
# CWPP in the pipeline: block a deploy if the image has HIGH/CRITICAL CVEs.
# (Illustrative CI step wrapping a scanner such as Trivy/Grype.)
- name: scan-image
run: |
trivy image --severity HIGH,CRITICAL \
--exit-code 1 \ # non-zero fails the build
myapp:${{ github.sha }}
# Runtime half (conceptual rule): alert if a container process tree
# ever includes an interactive shell in production.
# process.name in [bash, sh, zsh] AND env == prod -> ALERT + kill
Key Takeaways
- CWPP protects what runs inside workloads (vulns, runtime behavior, integrity); CSPM protects the cloud's configuration. You need both.
- Capabilities span the lifecycle: pre-deploy image/VM scanning, in-workload hardening, and runtime behavioral protection.
- Treat containers as immutable — rebuild and redeploy rather than patch in place, which makes in-place changes a reliable alarm.
- Protection must be lightweight and automated to keep up with ephemeral, numerous cloud workloads.
🧪 Practice
- Sort these into CSPM or CWPP: open security group, container running a vulnerable OpenSSL, disabled CloudTrail, a cron job added to a running pod.
- Explain why container immutability makes runtime detection easier.
- Write a CI gate (pseudocode) that fails a build when a container image contains a critical vulnerability.
- Interview-style: "A workload passes all CSPM checks but is still compromised. How?" Hint: perfect configuration can still run vulnerable or malicious code — that's the runtime gap CWPP covers.
Serverless Function Security
Theory
Serverless computing (AWS Lambda, Azure Functions, Google Cloud Functions) runs your code without any server for you to manage — you upload a function, and the provider executes it on demand, scaling automatically and charging per invocation. The security appeal is real: the provider patches the OS and runtime, and functions are short-lived and stateless, so there is no long-running host to persist on. But serverless does not remove security concerns; it shifts them, and introduces a few of its own.
The shifts: with no OS to secure, your attention moves almost entirely to your code, its dependencies, its permissions, and its inputs. The specific risk profile:
- Over-privileged function roles — the dominant serverless risk. Each function should have its own minimal role; a common mistake is one broad role reused across many functions, so compromising any function grants wide access.
- Event-data injection — functions are triggered by many event sources (HTTP, queues, storage events, emails), and every trigger is untrusted input. The attack surface is wider and less obvious than a single web form.
- Vulnerable dependencies — functions are often dependency-heavy; a known-vulnerable library ships straight into the execution environment.
- Insecure secrets handling — hardcoding secrets or stuffing them in environment variables rather than using a secrets manager.
- Broken function flows — chained functions where one trusts another's output without re-validation.
Two serverless properties help defenders: very short execution lifetimes limit persistence, and per-function roles enable extremely granular least privilege — if you actually use them.
Examples
# AWS Lambda handler. Two classic serverless mistakes and their fixes.
import os, json, boto3
# BAD: secret hardcoded / from plain env var, committed to the repo.
# API_KEY = "sk_live_1234..." # never do this
# GOOD: fetch from a secrets manager at runtime; role grants only this secret.
def get_api_key():
sm = boto3.client("secretsmanager")
return sm.get_secret_value(SecretId="prod/payments/api-key")["SecretString"]
def handler(event, context):
# Every event source is UNTRUSTED input — validate before use.
body = json.loads(event.get("body") or "{}")
amount = body.get("amount")
if not isinstance(amount, int) or amount <= 0: # input validation
return {"statusCode": 400, "body": "invalid amount"}
# ... function logic uses get_api_key(), not a baked-in secret ...
return {"statusCode": 200, "body": "ok"}
Least-privilege roles, serverless style — one role PER function:
fn: listInvoices ──▶ role: s3:GetObject on invoices/* (read only)
fn: createInvoice ──▶ role: dynamodb:PutItem on Invoices (write only)
fn: chargeCard ──▶ role: secretsmanager:GetSecretValue (1 id)
ANTI-PATTERN: all three share one role with s3:*, dynamodb:*, iam:*
→ compromising the harmless listInvoices grants the attacker everything.
Key Takeaways
- Serverless removes OS/runtime patching from your plate but shifts focus to code, dependencies, permissions, and (especially) input from many event sources.
- Over-privileged shared function roles are the top risk — give each function its own minimal role to shrink blast radius.
- Treat every trigger (HTTP, queue, storage event, email) as untrusted input requiring validation.
- Never hardcode secrets; use a secrets manager and let the function's role grant access to just the secrets it needs.
🧪 Practice
- List three event sources that can trigger a serverless function and explain why each is untrusted input.
- Rewrite a function that reads an API key from an environment variable to use a secrets manager, and adjust its role.
- Explain why "one IAM role for all our Lambdas" is dangerous and what to do instead.
- Interview-style: "What security concerns go away with serverless, and which get worse?" Hint: OS patching/persistence improve; permission sprawl and input-surface breadth worsen.
Cloud Logging and Trail Analysis
Theory
In the cloud, because every action is an API call, you can — and must — record a complete, tamper-evident log of who did what, when, from where. Services like AWS CloudTrail, Azure Activity/Monitor logs, and Google Cloud Audit Logs capture control-plane activity across the entire account. These trails are the backbone of cloud detection and forensics: without them, a breach is invisible and un-investigable; with them, you can reconstruct exactly how an attacker got in and what they touched. The analogy is a building's security-camera system that records every door opening — useless if it is off, invaluable after an incident.
There are several log layers, and you need more than one:
| Layer | Example | Answers |
|---|---|---|
| Management/audit | CloudTrail | Who made which API calls (create/delete/assume-role)? |
| Data events | S3 object access, Lambda invoke | Who read/wrote which objects? (high volume, opt-in) |
| Network flow | VPC Flow Logs | What talked to what, on which ports? |
| Application | App/service logs | What happened inside the app? |
The defender's rules follow from how attackers behave: attackers try to disable or delete logs to blind you, so (1) enable logging in all regions (attackers often operate in an unused region hoping it is unmonitored), (2) send logs to a separate, locked-down account with write-once/immutable storage so they cannot be tampered with, and (3) alert on the logging configuration itself — a StopLogging or DeleteTrail event is a high-fidelity sign of compromise. Trail analysis then feeds your SIEM and detection rules (Chapter 13).
Examples
Tamper-resistant logging architecture:
Prod account(s) Dedicated LOG account (locked down)
┌──────────────┐ push logs ┌──────────────────────────────────┐
│ CloudTrail │ ───────────────▶ │ S3 (Object Lock = WORM) ──▶ SIEM │
│ all regions │ │ only log-pipeline can write; │
└──────────────┘ │ NOBODY can delete. Alerts on: │
│ • StopLogging / DeleteTrail │
│ • root login, policy changes │
└──────────────────────────────────┘
// A high-value detection: someone tried to blind the logs.
// Fired from CloudTrail -> this event should page the on-call.
{
"eventSource": "cloudtrail.amazonaws.com",
"eventName": "StopLogging", // or DeleteTrail / UpdateTrail
"userIdentity": { "arn": "arn:aws:iam::...:user/suspicious" },
"sourceIPAddress": "198.51.100.23",
"awsRegion": "ap-south-1" // an unused region? extra suspicious
}
// Rule: ANY StopLogging/DeleteTrail -> severity HIGH, immediate alert.
Key Takeaways
- Cloud audit trails record every control-plane API call — the backbone of cloud detection and forensics.
- Use multiple layers (management, data, network-flow, application); management logs alone miss object access and network activity.
- Defend the logs themselves: all regions on, shipped to a separate immutable (WORM) log account, with alerts on any attempt to stop or delete logging.
- Trail data feeds your SIEM and detection engineering (Chapter 13); a disabled trail is both a gap and a strong compromise signal.
🧪 Practice
- Match each question to the right log type: "who deleted the database?", "which IP scanned our ports?", "who downloaded this file?".
- Explain why audit logs should be written to a separate account with immutable storage.
- Design one alert that would catch an attacker trying to cover their tracks in the cloud.
- Interview-style: "Why enable logging in regions you don't use?" Hint: attackers deliberately operate where they expect no one is watching.
Encryption and Key Management Services
Theory
Encrypting data in the cloud is easy; the hard and important part is managing the keys, because whoever controls the keys controls the data. A Key Management Service (KMS) — AWS KMS, Azure Key Vault, Google Cloud KMS — is a hardened, centralized service (often backed by hardware security modules) that generates, stores, rotates, and controls access to encryption keys, so that keys are never sitting in your application code or config files. The mental model is a bank's key-management room: the money (data) is encrypted everywhere, but access to the keys is itself a guarded, logged, access-controlled operation.
A few concepts make KMS usage sensible:
- Envelope encryption: data is encrypted with a data key; the data key is itself encrypted by a key-encryption key (KEK) held in the KMS. You store the encrypted data key alongside the data and only call KMS to unwrap it — efficient for large data and keeps the master key inside the KMS.
- Key policies and separation of duties: access to use a key is an IAM decision, so you can let a service decrypt data without any human being able to export the key. This also enables the "encrypt at rest" sovereignty backstop from 11.1 — a compelled provider yields only ciphertext if they cannot access your key.
- Rotation and auditing: keys rotate automatically on a schedule, and every key use is logged (ties back to trail analysis), so you can see who decrypted what.
- Key ownership tiers: provider-managed keys (easiest), customer-managed keys (CMK — you control policy/rotation), and BYOK/HYOK (bring/hold your own key — you import or retain the key material for maximum control).
Examples
Envelope encryption — why the master key never leaves the KMS:
Encrypt:
plaintext ──▶ [encrypt with DATA KEY] ──▶ ciphertext ─┐
DATA KEY ──▶ [KMS wraps with KEK] ──▶ encrypted DK ─┴─▶ store together
Decrypt:
encrypted DK ──▶ KMS unwraps (KEK never leaves KMS) ──▶ DATA KEY
ciphertext ──▶ [decrypt with DATA KEY] ──▶ plaintext
The KEK (master key) stays inside the KMS/HSM for its entire life.
# Envelope encryption with a KMS-issued data key (AWS KMS shown).
import boto3
from cryptography.fernet import Fernet # symmetric AEAD for the bulk data
kms = boto3.client("kms")
# 1) Ask KMS for a data key: we get it BOTH in plaintext (to use now)
# and encrypted-under-the-KEK (to store for later decryption).
resp = kms.generate_data_key(KeyId="alias/app-data", KeySpec="AES_256")
plaintext_key = resp["Plaintext"] # use in memory, then discard
encrypted_key = resp["CiphertextBlob"] # store alongside the ciphertext
# 2) Encrypt the actual payload locally with the data key (fast, no KMS calls).
token = Fernet(_to_fernet(plaintext_key)).encrypt(b"sensitive record")
del plaintext_key # minimize time the key is in memory
# To decrypt later: send encrypted_key to kms.decrypt() to recover the data key,
# then decrypt `token` locally. The KEK never leaves KMS; its use is logged.
Key Takeaways
- In the cloud, key management — not encryption itself — is the hard problem; controlling keys means controlling data.
- A KMS centralizes key generation, storage, rotation, and access, keeping keys out of code and config and logging every use.
- Envelope encryption lets you encrypt large data efficiently while the master key (KEK) never leaves the KMS/HSM.
- Choose a key-ownership tier to match your trust needs: provider-managed → customer-managed → BYOK/HYOK, where holding your own key is the sovereignty backstop.
🧪 Practice
- Explain envelope encryption and why it is better than calling the KMS to encrypt every byte of a large file.
- Describe a key policy that lets a service decrypt data but prevents any employee from exporting the key.
- State the difference between a provider-managed key and BYOK, and when you would choose each.
- Interview-style: "How can customer-controlled keys reduce exposure to a lawful data-access demand against your provider?" Hint: what the provider can hand over if it physically cannot access your key material.
Landing Zones and Guardrails
Theory
As an organization's cloud grows from one account to hundreds, securing each account by hand becomes impossible and inconsistent. A landing zone is a pre-configured, secure, multi-account cloud foundation — a blueprint that every new account is created from, already wired with identity, logging, networking, and security baselines. Rather than letting teams build accounts ad hoc (and inevitably misconfigure them), you give them a safe "zone to land in." The analogy is a planned housing development with utilities, roads, and building codes already in place, versus letting everyone build a house wherever and however they like.
The companion concept is guardrails: automated, organization-wide rules that constrain what can be done in any account, so that safety does not depend on every engineer remembering every policy. Guardrails come in two flavors:
- Preventive guardrails stop a bad action from happening at all — for example, AWS Service Control Policies (SCPs) that deny disabling CloudTrail, deny creating public S3 buckets, or restrict usage to approved regions. These are like walls: the action is simply impossible.
- Detective guardrails allow the action but detect and flag it (this is CSPM territory) — like cameras: you find out it happened and respond.
The design philosophy is secure by default and centrally governed: new accounts inherit the baseline automatically, high-risk actions are blocked for everyone (including, deliberately, most access to the root user), and security teams manage policy from one place rather than chasing hundreds of accounts. This is how cloud security scales.
Examples
Landing zone: every new account is born secure and governed.
┌───────────────── Organization (root) ──────────────────┐
│ SCP guardrails apply to ALL accounts below: │
│ • deny cloudtrail:StopLogging │
│ • deny creating public buckets │
│ • allow only approved regions (eu-west-1, us-east-1) │
└───────┬───────────────┬───────────────┬────────────────┘
│ │ │
┌─────▼────┐ ┌─────▼────┐ ┌─────▼────┐
│ Log acct │ │ Prod acct│ │ Dev acct │ ← each pre-wired with
│ (WORM) │ │ │ │ │ SSO, logging, baseline
└──────────┘ └──────────┘ └──────────┘ network + CSPM
// A PREVENTIVE guardrail: a Service Control Policy that makes it
// impossible for ANY account/role in the org to stop audit logging.
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "DenyDisablingCloudTrail",
"Effect": "Deny",
"Action": ["cloudtrail:StopLogging", "cloudtrail:DeleteTrail"],
"Resource": "*"
}]
}
// Even a full admin in a child account cannot perform these actions.
Key Takeaways
- A landing zone is a secure, repeatable multi-account foundation so every new account starts from a hardened baseline instead of ad hoc setup.
- Guardrails are org-wide automated rules: preventive (block the action, e.g., SCPs) and detective (allow but flag, e.g., CSPM).
- Preventive guardrails make whole classes of mistakes impossible for everyone — even account admins — which is how security scales to hundreds of accounts.
- The philosophy is secure-by-default and centrally governed: inherit the baseline, block high-risk actions globally, manage policy in one place.
🧪 Practice
- Classify each as preventive or detective: an SCP denying public buckets, a CSPM alert on an open security group, a policy restricting regions, a ticket opened for an untagged resource.
- List four baseline settings a landing zone should apply to every new account automatically.
- Write an SCP concept that prevents any account from operating outside two approved regions.
- Interview-style: "Why use a preventive guardrail instead of just alerting on the bad action?" Hint: compare stopping a breach from happening with finding out after it already did.
<a id="113-zero-trust-and-modern-architecture"></a>
11.3 Zero Trust and Modern Architecture
The dissolution of the network perimeter — driven by cloud, mobile, and remote work — demanded a new security model. This section covers that model, zero trust, and the architectures built on it: never trusting by location, segmenting aggressively, verifying continuously, and delivering access and security as cloud services rather than as boxes in a datacenter.
Zero Trust Principles and Tenets
Theory
The traditional security model was "castle and moat": build a strong perimeter (firewall), and trust anyone inside the network. The fatal flaw is that once an attacker gets inside — via phishing, a VPN credential, a compromised laptop — they move freely, because the inside is trusted. Zero Trust rejects the idea of a trusted inside entirely. Its slogan is "never trust, always verify": no user, device, or request is trusted because of where it comes from; every access is authenticated, authorized, and inspected on its own merits, as if the network were already hostile (because it is). The mindset shift is from "trust but verify" to "verify, then grant the minimum, then keep verifying."
The widely cited articulation is NIST SP 800-207, whose core tenets boil down to:
- Verify explicitly: authenticate and authorize every request using all available signals (user identity, device health, location, behavior), not just an IP address.
- Use least-privilege access: grant the minimum needed, ideally just-in-time and just-enough, so a compromised identity has little to reach.
- Assume breach: design as if attackers are already inside — segment aggressively, encrypt everywhere, log everything, and minimize blast radius.
The practical consequence is that the identity and the policy decision point become the perimeter, not the network boundary. Every request flows through a logical check ("policy decision point") that consults policy and signals, then a "policy enforcement point" that grants or denies — regardless of whether the request came from the corporate office or a coffee shop.
Examples
Castle-and-moat vs. Zero Trust
PERIMETER MODEL ZERO TRUST MODEL
┌───────── firewall ─────────┐ every request, inside or out, is checked:
│ trusted "inside" │ ┌────────┐ request ┌───────────────┐
│ ┌────┐ ┌────┐ ┌────┐ │ │ user + │─────────▶ │ Policy Decision│
│ │app │ │app │ │ DB │ │ │ device │ │ Point (PDP) │
│ └────┘ └────┘ └────┘ │ └────────┘ │ id? device ok? │
│ anyone inside = trusted │ ▲ │ risk? least- │
└────────────────────────────┘ │ │ priv policy │
breach of edge = total loss │ allow/deny └───────┬────────┘
└────────────────────────┘
location grants NOTHING; identity + signals do.
Key Takeaways
- Zero Trust discards the trusted-inside assumption: "never trust, always verify" — no access is granted based on network location.
- Three tenets (NIST 800-207): verify explicitly, use least-privilege/just-in-time access, and assume breach.
- Identity and the policy decision point become the real perimeter; every request is evaluated on signals, not IP.
- It is a strategy and architecture, not a single product — many controls (MFA, device trust, microsegmentation, SDP, SASE) implement it together.
🧪 Practice
- Explain in two sentences why "being on the corporate VPN" is not a sufficient reason to grant access under Zero Trust.
- Map each Zero Trust tenet (verify explicitly, least privilege, assume breach) to a concrete control.
- Describe how a policy decision point might use device health as a signal to allow or deny a request.
- Interview-style: "Is Zero Trust a product you can buy?" Hint: think strategy versus the set of technologies that implement it.
Microsegmentation
Theory
If you "assume breach," you must ensure that a compromise of one workload does not become a compromise of everything — and that is what microsegmentation achieves. Traditional networks are segmented coarsely, into a few large zones (a DMZ, an internal LAN); once inside a zone, workloads can talk to each other freely ("east-west" traffic), so one hacked server can scan and attack its neighbors. Microsegmentation shrinks the segments down to the individual workload or application, enforcing fine-grained rules about which workload may talk to which, on which port, for which purpose. The analogy is a submarine with many watertight compartments: a breach in one floods only that compartment, not the whole vessel.
The key properties:
- It controls east-west (lateral) traffic, the movement between internal workloads, which perimeter firewalls (focused on north-south, in/out traffic) largely ignore.
- Policies are expressed in terms of identity/workload attributes (e.g., "the web tier may reach the app tier on 8443") rather than IP addresses, so they survive IPs changing and workloads moving — essential in dynamic cloud environments.
- It enforces default-deny between segments: workloads can only make the connections explicitly allowed, which directly cuts off lateral movement (Chapter 12) and ransomware spread.
Implementations range from cloud security groups and Kubernetes network policies to dedicated agent-based or identity-based microsegmentation platforms. It is a direct technical expression of least privilege applied to the network.
Examples
Coarse segmentation vs. microsegmentation (same 3-tier app):
COARSE (one flat internal zone) MICROSEGMENTED (default-deny)
┌──────────────────────────┐ web ──allow:8443──▶ app
│ web app db (all can │ app ──allow:5432──▶ db
│ talk to each other freely)│ web ──X DENY X────▶ db (no direct path)
└──────────────────────────┘ everything else ──▶ DENY
hacked web box → scans+hits db hacked web box → can ONLY reach app:8443
# Kubernetes NetworkPolicy: microsegmentation as code.
# The 'db' pods accept traffic ONLY from 'app' pods, ONLY on 5432.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: db-allow-app-only }
spec:
podSelector:
matchLabels: { tier: db } # applies to database pods
policyTypes: ["Ingress"]
ingress:
- from:
- podSelector:
matchLabels: { tier: app } # only the app tier...
ports:
- protocol: TCP
port: 5432 # ...and only on Postgres' port
# Anything not matched (e.g., web tier -> db) is denied by default.
Key Takeaways
- Microsegmentation shrinks network zones to individual workloads and enforces default-deny between them, containing breaches like watertight compartments.
- It governs east-west (lateral) traffic that perimeter firewalls ignore, directly blocking lateral movement and ransomware spread.
- Policies key off workload/identity attributes, not IPs, so they survive the churn of dynamic cloud environments.
- It is least privilege applied to the network; implementations include security groups, Kubernetes network policies, and dedicated platforms.
🧪 Practice
- Define north-south versus east-west traffic and say which microsegmentation targets.
- Write (in words or policy pseudocode) the three allow-rules for a web/app/db app so the web tier cannot reach the database directly.
- Explain why identity-based rules are more robust than IP-based rules in the cloud.
- Interview-style: "How does microsegmentation limit ransomware?" Hint: ransomware depends on moving laterally to many hosts — what happens when default-deny blocks those paths?
Continuous Verification and Device Trust
Theory
A perimeter model verifies you once — at login — and then trusts you for the whole session. Zero Trust's "always verify" means verification is continuous: trust is re-evaluated throughout a session, because the situation can change (a device becomes infected mid-session, behavior turns anomalous, the risk score rises). Rather than a one-time gate, access becomes a conditional, revocable grant that the system keeps re-checking. Think of it as the difference between a bouncer checking your ID once at the door versus a system that keeps confirming you still belong and can eject you the moment something looks wrong.
Two ingredients make this work:
- Device trust: the device making a request must prove it is healthy and known, not just the user. Signals include whether the device is enrolled/managed, has disk encryption and a running EDR agent, is patched, and is not jailbroken. A valid password from an unmanaged, infected laptop should be treated very differently from the same password on a compliant corporate device. This is why Zero Trust pairs identity with device posture.
- Continuous/adaptive evaluation: the policy engine ingests ongoing signals (geovelocity, behavioral analytics, new risk indicators) and can step up authentication (demand re-MFA) or revoke access mid-session. This is the same engine behind conditional access policies in platforms like Microsoft Entra: "allow only if user is MFA'd AND device is compliant AND sign-in risk is low."
Together these ensure that access reflects current trust, not trust as it was at login an hour ago.
Examples
Conditional access decision (evaluated continuously, not just at login):
signals in ──▶ POLICY ENGINE ──▶ decision
├ user identity + MFA? │
├ device managed + encrypted? │ ALL good → ALLOW (full access)
├ patch level current? │ device risky → LIMIT (read-only / step-up MFA)
├ sign-in risk (geo/behavior) │ high risk → BLOCK + revoke session
└ data sensitivity requested │
...re-evaluated as signals change during the session...
# Conditional-access policy expressed as a rule (vendor-neutral):
GRANT access to finance-app
REQUIRE user.mfa == true
AND device.compliant == true # managed + encrypted + EDR on
AND device.patchLevel >= "current"
AND signin.riskScore < "medium"
ELSE require step-up MFA; if still failing -> DENY and end session
Key Takeaways
- Zero Trust verifies continuously, not once at login — trust is a revocable grant re-evaluated as conditions change.
- Device trust matters alongside user identity: posture signals (managed, encrypted, patched, EDR present, not jailbroken) gate access.
- Adaptive/conditional access can step up authentication or revoke a session mid-stream when risk rises.
- The policy engine combines user, device, and risk signals into a real-time allow/limit/block decision (e.g., conditional access).
🧪 Practice
- List four device-posture signals a Zero Trust policy might require before granting access to a sensitive app.
- Explain the difference between one-time (login) verification and continuous verification, with an example where the difference matters.
- Write a conditional-access rule (pseudocode) for an HR system requiring MFA, a compliant device, and low sign-in risk.
- Interview-style: "Why isn't a correct password enough under Zero Trust?" Hint: a correct password says nothing about the health of the device or the risk of this particular sign-in.
Software-Defined Perimeter (SDP)
Theory
A Software-Defined Perimeter is a concrete way to implement Zero Trust network access, built on a striking idea: make protected resources invisible to anyone not explicitly authorized. In a traditional network, a server listens on an open port that anyone can connect to and then fails authentication — which means attackers can at least see and probe it (scan, fingerprint, exploit the auth process itself). SDP flips the order: you must authenticate first, and only after you are verified does the resource even become reachable. Everything else sees nothing — the server is "dark." This is sometimes called a "black cloud." The analogy is a speakeasy whose door is invisible until you give the correct knock; everyone else walks past a blank wall.
The mechanism uses a few components:
- A controller that authenticates and authorizes users/devices and decides what each may reach.
- Gateways in front of resources that drop all traffic by default and only open a connection for a client the controller has approved.
- Often a technique called Single Packet Authorization (SPA): the client sends one cryptographically signed packet; until a valid one arrives, the gateway does not respond to anything, so port scans find nothing.
The security win is a dramatically reduced attack surface: you cannot attack what you cannot see or reach. SDP is the engine behind modern Zero Trust Network Access (ZTNA) products that are replacing VPNs — instead of placing a user "on the network," ZTNA grants a verified user a connection to one specific application, and nothing else.
Examples
VPN (network-level) vs. SDP/ZTNA (application-level):
VPN: user authenticates ─▶ placed ON the network ─▶ can reach EVERYTHING
routable (big surface)
SDP: user+device authenticate to CONTROLLER
│ approved for "app-A" only
▼
GATEWAY (dark: drops all unsolicited traffic)
│ opens a connection to app-A ONLY
▼
app-A [app-B, app-C remain invisible/unreachable]
Port scan of an SDP gateway from an unauthorized host → silence (no response).
Key Takeaways
- SDP implements Zero Trust by making resources invisible until a user/device is authenticated — "authenticate first, connect second."
- It uses a controller (decides access), gateways (default-drop all traffic), and often Single Packet Authorization so scans see nothing.
- The payoff is a shrunken attack surface: you cannot attack what you cannot see or reach.
- ZTNA products built on SDP are replacing VPNs by granting access to one application rather than placing users on the whole network.
🧪 Practice
- Explain how "authenticate before connect" reduces attack surface compared to a normal listening service.
- Describe what a port scan against an SDP-protected resource returns, and why.
- Contrast what a VPN grants a user versus what ZTNA grants, in terms of what they can reach.
- Interview-style: "Why is ZTNA considered more secure than a traditional VPN for remote access?" Hint: compare 'on the network' with 'connected to one authorized app' after continuous verification.
Secure Access Service Edge (SASE)
Theory
As users, devices, and applications all moved out of the datacenter (to home offices and the cloud), the old model of backhauling all traffic to a central datacenter for security inspection became slow and pointless — the data is not there anymore. SASE (pronounced "sassy") is the architectural response: it converges networking and security into a single, cloud-delivered service at the network edge, close to wherever the user actually is. Instead of buying and stacking separate appliances in a datacenter, you consume both connectivity and security as one cloud service that inspects and routes traffic near the user. The analogy is replacing a single central checkpoint everyone must drive to with a network of checkpoints distributed everywhere people are.
SASE is a convergence of previously separate products, usually described as networking plus security pillars:
| Side | Components | Purpose |
|---|---|---|
| Network | SD-WAN | Smart, optimized routing across sites and cloud |
| Security | SWG (secure web gateway) | Filter/inspect web traffic |
| CASB (cloud access security broker) | Govern use of SaaS apps, data | |
| ZTNA | Zero-trust access to private apps (the SDP engine above) | |
| FWaaS (firewall-as-a-service) | Cloud-delivered firewalling |
When the emphasis is purely on the security pillars delivered from the cloud (SWG + CASB + ZTNA + FWaaS) with less focus on SD-WAN, the industry calls that subset SSE (Security Service Edge). The unifying benefits are consistent policy everywhere (the same rules apply whether a user is at HQ, home, or a hotel), lower latency (inspection happens near the user, not after a backhaul), and simpler operations (one cloud service instead of a rack of boxes). SASE is essentially the delivery vehicle that makes Zero Trust practical for a distributed workforce.
Examples
Old backhaul model vs. SASE:
BACKHAUL:
remote user ──long haul──▶ corporate DC (stack of appliances) ──▶ cloud app
(slow: traffic detours to HQ just to be inspected)
SASE:
remote user ──▶ nearest SASE edge PoP ──▶ cloud app / private app
(identity-based policy: SWG+CASB+ZTNA+FWaaS applied here,
close to the user; same policy at every PoP worldwide)
Key Takeaways
- SASE converges networking (SD-WAN) and security (SWG, CASB, ZTNA, FWaaS) into one cloud service delivered at the edge near the user.
- It replaces slow backhaul-to-datacenter inspection with inspection close to users and applications, wherever they are.
- SSE is the security-only subset of SASE (SWG + CASB + ZTNA + FWaaS) without the SD-WAN networking focus.
- Benefits are consistent policy everywhere, lower latency, and simpler operations — it is how Zero Trust scales to a distributed workforce.
🧪 Practice
- Expand the acronyms SWG, CASB, ZTNA, FWaaS and state what each does in one phrase.
- Explain the problem with backhauling a remote worker's cloud-app traffic to the corporate datacenter for inspection.
- Distinguish SASE from SSE.
- Interview-style: "How does SASE support a Zero Trust strategy?" Hint: think about applying identity-based, consistent security policy to every user and app regardless of location.
Migrating from Perimeter-Based Models
Theory
No real organization can switch from castle-and-moat to Zero Trust overnight — there are legacy applications, existing VPNs, and years of implicit-trust assumptions baked into systems. Migration is therefore incremental and risk-prioritized, and understanding how to do it is as important as understanding the end state. The guiding idea is to start where the risk and value are highest, prove the model on one slice, and expand — not to rip out the perimeter on day one (which would break everything and create resistance).
A pragmatic migration path:
- Inventory and map: you cannot protect what you cannot see. Identify users, devices, applications, data flows, and the implicit trusts between them. This "map the transaction flows" step is explicitly called out in NIST's guidance.
- Establish strong identity and MFA everywhere: identity is the new perimeter, so universal MFA and a single identity provider are the foundation that everything else builds on.
- Add device trust and conditional access: begin gating access on device posture and risk for the most sensitive apps first.
- Introduce ZTNA alongside the VPN: move one application at a time behind ZTNA, running it in parallel with the VPN, then decommission VPN access to that app once proven.
- Microsegment progressively: start with monitoring (learn the real traffic), then enforce default-deny segment by segment to avoid breaking legitimate flows.
- Shrink and retire the perimeter: as apps move behind Zero Trust access, the implicit-trust network zone keeps shrinking until it is gone.
Two cross-cutting principles: run in monitor-before-enforce mode so you discover real dependencies before blocking them, and treat Zero Trust as a continuous program, not a project with an end date — policies and signals keep evolving.
Examples
Phased migration (each phase de-risks the next):
Phase 0 Inventory users/devices/apps/flows + implicit trusts
Phase 1 MFA everywhere + single IdP ← identity foundation
Phase 2 Device posture + conditional access (sensitive apps first)
Phase 3 ZTNA per-app, in PARALLEL with VPN ──▶ retire that app's VPN path
Phase 4 Microsegment: MONITOR ──▶ then ENFORCE default-deny, segment by segment
Phase 5 Perimeter trust zone shrinks ──▶ eventually gone
Throughout: monitor-before-enforce; it's a program, not a one-time project.
Key Takeaways
- Migration to Zero Trust is incremental and risk-prioritized — you cannot and should not remove the perimeter all at once.
- Start by inventorying everything and mapping transaction flows; you cannot secure what you have not mapped.
- Build on a universal identity/MFA foundation, then layer device trust, per-app ZTNA (parallel to the VPN), and progressive microsegmentation.
- Always monitor before enforcing to avoid breaking legitimate flows, and treat Zero Trust as an ongoing program, not a finite project.
🧪 Practice
- Put these migration steps in a sensible order: microsegment, deploy MFA everywhere, inventory assets and flows, move one app behind ZTNA.
- Explain why "monitor before enforce" is essential when introducing microsegmentation.
- Describe how ZTNA and a legacy VPN can coexist during migration and how you retire the VPN safely.
- Interview-style: "Why is Zero Trust a journey rather than a destination?" Hint: legacy constraints, phased rollout, and signals/policies that must keep evolving.
<a id="114-operational-technology-and-iot"></a>
11.4 Operational Technology and IoT
Not all infrastructure is cloud servers and laptops; much of it is the physical and embedded world — factory controllers, power-grid equipment, cars, medical devices, and billions of small connected gadgets. This section covers the distinct security challenges of operational technology (OT) and the Internet of Things (IoT), where safety and availability outrank confidentiality, devices live for decades, and connecting old systems to modern networks exposes them to threats they were never designed to survive.
ICS and SCADA Architecture
Theory
Operational Technology (OT) is the hardware and software that monitors and controls physical processes — valves, motors, turbines, assembly lines. Industrial Control Systems (ICS) is the umbrella term for the systems that run these processes, and SCADA (Supervisory Control and Data Acquisition) is a common ICS type used to monitor and control equipment spread over wide areas (pipelines, power grids, water utilities). The crucial point for a security learner is that OT is not just IT with different hardware — its priorities are inverted. In IT we rank C-I-A (Confidentiality first). In OT we rank A-I-C or really Safety > Availability > Integrity > Confidentiality: a leaked document is bad, but a turbine spinning out of control can kill people, so keeping the process running correctly and safely is paramount.
The core components recur across ICS:
- Sensors and actuators: measure the physical world (pressure, temperature) and act on it (open a valve).
- PLCs (Programmable Logic Controllers) / RTUs (Remote Terminal Units): rugged embedded computers that read sensors and drive actuators according to control logic — the real-time heart of the system.
- HMI (Human-Machine Interface): the operator's screen for monitoring and manual control.
- Historian: a database recording process values over time.
- Engineering workstation: where PLC logic is programmed (a high-value attacker target — it can reprogram the physical process).
These inverted priorities have hard consequences: you often cannot patch (downtime may be unacceptable or vendor-certified configurations forbid it), you often cannot reboot for updates, equipment lifespans are 15–30 years (so insecure legacy protocols persist), and even security scanning can crash fragile devices. This is why OT security leans heavily on segmentation and monitoring rather than the patch-and-scan rhythm of IT.
Examples
A basic SCADA/ICS stack and its data flow:
Engineering WS ──programs──▶ PLC/RTU ──commands──▶ Actuator (valve/motor)
│ ▲ │
│ │ └─reads──▶ Sensor (pressure/temp)
HMI (operator) ◀──status──────┘
│
Historian (records every value over time)
Priority inversion vs. IT:
IT : Confidentiality > Integrity > Availability
OT : SAFETY > Availability > Integrity > Confidentiality
Key Takeaways
- OT/ICS controls physical processes; SCADA is a wide-area ICS type for utilities and pipelines.
- Priorities are inverted versus IT: safety and availability come first, confidentiality last — because failures can injure people or damage equipment.
- Core parts: sensors/actuators, PLCs/RTUs (the real-time controllers), HMI, historian, and the high-value engineering workstation.
- Constraints — can't patch, can't reboot, decades-long lifespans, fragile devices — push OT security toward segmentation and monitoring over patch-and-scan.
🧪 Practice
- Define OT, ICS, and SCADA and give a real-world example of each.
- Explain why the CIA triad is reordered in OT and what replaces "confidentiality first."
- Identify why the engineering workstation is a top target for an attacker in an ICS environment.
- Interview-style: "Why can't you just run your normal IT vulnerability scanner across a plant's PLC network?" Hint: consider fragile devices, uptime requirements, and what a scan can do to real-time control.
The Purdue Model and OT Segmentation
Theory
Because OT systems cannot rely on patching, their primary defense is segmentation — keeping the fragile, safety-critical control systems separated from the IT network and the internet. The Purdue Model (the Purdue Enterprise Reference Architecture, PERA) is the classic blueprint for this: it organizes an industrial network into hierarchical levels, from the physical process at the bottom to the business IT network at the top, with controlled boundaries between them. The goal is that a compromise of the corporate IT network (Level 4/5) cannot flow straight down into the systems controlling turbines (Levels 0–2). Think of it as a series of nested security zones, where the deeper (more dangerous) zones are progressively harder to reach.
The levels, bottom to top:
| Level | Zone | Contains |
|---|---|---|
| 0 | Process | Physical sensors and actuators |
| 1 | Basic control | PLCs, RTUs (the controllers) |
| 2 | Area supervisory | HMIs, SCADA servers |
| 3 | Site operations | Historians, engineering workstations |
| — DMZ — | Industrial DMZ (IDMZ) | The critical buffer between OT and IT |
| 4 | Site business | Plant IT, email, ERP |
| 5 | Enterprise | Corporate IT, internet |
The single most important feature is the Industrial DMZ (IDMZ) between Levels 3 and 4: no direct traffic should cross between IT and OT. Data (e.g., from the historian to a business dashboard) is passed through brokered services in the IDMZ, and ideally only "upward" from OT to IT. In the highest-assurance cases an air gap or data diode (hardware that physically permits data to flow only one way) enforces this. The lesson of real incidents (e.g., malware reaching plant floors via flat networks and shared workstations) is that flat OT networks are the core risk, and strict level segmentation plus the IDMZ is the primary countermeasure.
Examples
Purdue Model (compromise must not flow downward):
L5 Enterprise / Internet ┐
L4 Site business IT ┘ IT zone
══════════ Industrial DMZ (IDMZ) ══════════ ◀ broker only; no direct IT↔OT
L3 Site ops (historian, eng WS) ┐
L2 Supervisory (HMI, SCADA) │ OT zone
L1 Basic control (PLC/RTU) │
L0 Process (sensors/actuators) ┘ ← closest to physical harm
Data diode (one-way) example: OT historian ──▶| diode |──▶ IT dashboard
(physically impossible to send commands back)
Key Takeaways
- The Purdue Model segments industrial networks into hierarchical levels (0 = process up to 5 = enterprise) so IT compromises cannot reach control systems.
- The Industrial DMZ (IDMZ) between Levels 3 and 4 is the critical buffer: no direct IT-to-OT traffic; data is brokered, ideally one-way.
- Data diodes/air gaps enforce one-directional flow in the highest-assurance environments.
- Flat OT networks are the central risk; strict level segmentation and the IDMZ are the primary OT countermeasures given that patching is limited.
🧪 Practice
- Place these in the correct Purdue level: a PLC, a corporate email server, an HMI, a physical temperature sensor, a historian.
- Explain the purpose of the IDMZ and why direct IT-to-OT connections are forbidden.
- Describe what a data diode does and when you would deploy one.
- Interview-style: "Why is a 'flat' OT network so dangerous, and how does the Purdue Model address it?" Hint: think about lateral movement from an infected business PC straight to a PLC.
IoT Device Constraints and Weak Defaults
Theory
The Internet of Things is the vast population of everyday objects with embedded compute and network connectivity — cameras, thermostats, smart locks, industrial sensors, medical wearables. Their security problem is structural, rooted in constraints: these devices are cheap, low-power, and resource-limited, so they often cannot run modern cryptography, endpoint agents, or frequent updates, and manufacturers competing on price and time-to-market routinely ship them insecure. The result is an enormous, long-lived, hard-to-patch attack surface. The analogy is a city that added millions of doors overnight, most of them with the same factory lock and no way to change it.
The recurring weaknesses (echoing the OWASP IoT Top 10) are:
- Weak/default/hardcoded credentials: devices ship with
admin/adminor a password baked into the firmware that cannot be changed — the single most exploited IoT flaw. - Insecure network services and exposed interfaces: unnecessary open ports, debug services, or management UIs reachable from the internet.
- Lack of secure update mechanism: no signed firmware, no update path, so known bugs live forever.
- Insecure or absent encryption: data and commands sent in the clear.
- Poor lifecycle/management: devices deployed and forgotten, no inventory, long lifespans with no vendor support.
The consequences are concrete and large-scale: the Mirai botnet famously conscripted hundreds of thousands of IoT devices by simply trying a short list of default credentials, then used them for massive DDoS attacks. The defensive priorities for an operator are therefore unglamorous but effective: change default credentials, segment IoT onto its own network (so a compromised camera cannot reach your servers), disable unused services, keep an inventory, and apply firmware updates where a secure mechanism exists.
Examples
Why Mirai worked (and still would):
attacker ──scan internet for open telnet/22──▶ IoT camera
──try default creds (admin/admin, root/root, ...)──▶ LOGIN
──drop bot, recruit device──▶ 100,000s of bots ──▶ DDoS target
Defense that breaks the whole chain:
1. no default creds (unique per-device password)
2. no exposed telnet/SSH to the internet
3. IoT on an isolated VLAN (segmentation)
# Operator hardening checklist for a newly deployed IoT device (illustrative):
# 1) Change the default credential IMMEDIATELY
# 2) Disable services you don't use (telnet, UPnP, debug)
# 3) Put it on an isolated network segment / VLAN
# 4) Check for and apply signed firmware updates
# 5) Add it to an asset inventory with an end-of-support date
nmap -sS -p- iot-device.local # discover what ports/services are exposed
# -> close/disable everything that isn't strictly required
Key Takeaways
- IoT insecurity is structural: cheap, constrained, long-lived devices shipped fast and cheap, often unpatchable.
- The top flaws are weak/default/hardcoded credentials, exposed services, and missing secure-update mechanisms (OWASP IoT Top 10).
- Mirai showed the scale of the risk — default credentials alone built a massive DDoS botnet.
- Operator defenses: change defaults, segment IoT onto isolated networks, disable unused services, inventory devices, and update firmware where possible.
🧪 Practice
- List five common IoT security weaknesses and the defense for each.
- Explain, step by step, how the Mirai botnet recruited devices and which single control would have stopped it.
- Describe why network segmentation is especially important for IoT you cannot patch.
- Interview-style: "Why are hardcoded credentials worse than merely weak ones?" Hint: consider whether the user can change them and whether the secret is identical across every device of that model.
Firmware Extraction and Analysis
Theory
To find vulnerabilities in an embedded or IoT device — or to verify a vendor's security claims — researchers analyze its firmware, the low-level software baked into the device that runs its hardware. Because the device's "program" and often its secrets live in firmware, extracting and examining it reveals hardcoded credentials, cryptographic keys, bugs, and backdoors that no external test would surface. This is a core skill in both offensive hardware research and defensive supply-chain assurance. The analogy is reading the blueprints and wiring of an appliance rather than only pressing its buttons from outside.
Firmware can be obtained several ways, from easiest to most invasive:
- Download it from the vendor's support site or intercept an over-the-air update — often the simplest route.
- Extract from the device by dumping the flash memory chip: either over a debug interface like UART (serial console) or JTAG/SWD (chip-level debug), or by physically desoldering/clipping onto the flash chip and reading it with a programmer (a SPI flash reader with a chip clip is common).
Once you have the firmware image, analysis proceeds:
- Identify and unpack with a tool like binwalk, which recognizes embedded file systems (SquashFS, JFFS2), bootloaders, and compressed blobs by signature and carves them out.
- Explore the extracted file system for the juicy parts: configuration files,
/etc/passwdor shadow hashes, private keys, API endpoints, and startup scripts. - Reverse-engineer binaries with tools like Ghidra to find vulnerabilities in the device's programs, and check for known CVEs in bundled components.
- Analyze for secrets with entropy analysis (high entropy can indicate encryption or embedded keys) and string searches.
Defensively, the same process underpins secure boot and signed firmware verification — the countermeasures that make tampering detectable and keep attackers from trivially modifying what runs.
Examples
Firmware analysis workflow:
OBTAIN EXTRACT ANALYZE
┌────────────┐ ┌─────────────┐ ┌──────────────────────┐
│ vendor DL │ │ binwalk -e │ │ grep secrets/keys │
│ OR │ ─────▶ │ carve FS │ ─────▶ │ check /etc/shadow │
│ dump flash │ │ (SquashFS..) │ │ Ghidra on binaries │
│ via UART/ │ │ │ │ match known CVEs │
│ JTAG/SPI │ └─────────────┘ └──────────────────────┘
└────────────┘
# Unpack a downloaded firmware image and hunt for low-hanging secrets.
binwalk firmware.bin # identify embedded parts by signature
binwalk -e firmware.bin # -e: extract/carve the file systems out
cd _firmware.bin.extracted/squashfs-root
grep -riE "password|api_key|BEGIN .*PRIVATE KEY" . 2>/dev/null # hardcoded secrets
cat etc/shadow # offline-crackable account hashes?
# Then load device binaries into Ghidra to reverse-engineer and find bugs.
Key Takeaways
- Firmware holds a device's logic and often its secrets; extracting and analyzing it reveals hardcoded credentials, keys, and bugs invisible from outside.
- Obtain firmware by download/OTA interception, or dump it via UART/JTAG/SPI-flash hardware access.
- Analyze with binwalk (unpack file systems), file-system inspection (shadow, keys, configs), and Ghidra (reverse-engineer binaries), then match against known CVEs.
- Secure boot and signed firmware are the defensive countermeasures that make unauthorized firmware detectable.
🧪 Practice
- List three ways to obtain a device's firmware, ordered from least to most invasive.
- Explain what
binwalk -edoes and what you would look for in the extracted file system.- Describe how secure boot defends against an attacker who modifies firmware.
- Interview-style: "You have a device's firmware image. What are the first things you grep for and why?" Hint: credentials, private keys, and account hashes that grant immediate access or decrypt traffic.
Embedded Protocol Risks: Modbus, MQTT, CAN
Theory
Embedded and OT systems communicate using specialized protocols that were, in most cases, designed decades ago for closed, trusted networks — so they frequently have no authentication, no encryption, and no integrity checks built in. The security risk is that connecting these protocols to larger or internet-exposed networks exposes decades-old trust assumptions to modern attackers. The analogy is a set of internal office intercoms with no locks: fine when only trusted staff are in the building, catastrophic once the doors are open to the street. Three representative protocols illustrate the pattern across industrial, IoT-messaging, and automotive domains.
| Protocol | Domain | Core weakness | Representative attack |
|---|---|---|---|
| Modbus | Industrial (PLCs) | No authentication or encryption; any node can issue commands | Forge a write-register command to change a setpoint or open a valve |
| MQTT | IoT messaging (pub/sub via a broker) | Auth/TLS are optional and often disabled; open brokers common | Subscribe to # wildcard and read all topics; publish forged commands |
| CAN bus | Automotive/vehicles | Broadcast bus, no authentication; any node trusts all frames | Inject frames to actuate brakes/steering; one compromised ECU affects all |
The common thread is implicit trust: these protocols assume every participant is legitimate because, historically, physical access to the bus or network was the access control. The defensive answer is rarely to fix the protocol itself (often impossible without breaking compatibility) and instead to:
- Segment and isolate so untrusted parties cannot reach the protocol (Purdue model, VLANs, keeping CAN buses gatewayed).
- Wrap with modern security: put TLS and authentication on MQTT; tunnel or gateway industrial protocols; add message authentication where the ecosystem supports it (e.g., newer secure variants).
- Monitor for anomalous commands — in OT, deep-packet inspection that understands Modbus function codes can flag an unexpected "write to register" that a normal firewall would pass.
Examples
Modbus has no auth: any reachable node can command a PLC.
attacker on the OT LAN ──▶ Modbus TCP/502 ──▶ PLC
"write coil 7 = ON" (open the valve) obeys — no credentials asked
MQTT open broker: the wildcard subscription that reads everything.
subscribe topic "#" → receives EVERY message on the broker
publish "home/locks/front" payload "UNLOCK" → forged command accepted
CAN bus: broadcast + trust-all → one malicious ECU reaches safety systems.
[infotainment ECU compromised] ──inject frames──▶ [brakes/steering ECU]
# Illustrative: a Modbus write that a protocol with no auth will simply obey.
# (Shown to make the "no authentication" risk concrete — authorized labs only.)
from pymodbus.client import ModbusTcpClient
c = ModbusTcpClient("10.0.0.5", port=502) # PLC on the OT network
c.connect()
# No login, no key, no challenge — the PLC trusts any node that can reach it:
c.write_register(address=40001, value=9999) # change a process setpoint
c.close()
# Defense is NOT in the protocol (there is none) — it's segmentation + monitoring.
Key Takeaways
- Embedded/OT protocols (Modbus, MQTT, CAN) were designed for closed, trusted networks and typically lack authentication, encryption, and integrity.
- Modbus trusts any reachable node; MQTT makes security optional (open brokers abound); CAN is a broadcast bus where any ECU trusts all frames.
- The shared flaw is implicit trust based on the historical assumption that physical/network access equals authorization.
- Defend by segmentation/isolation, wrapping protocols in modern auth/encryption where possible, and protocol-aware monitoring — not by expecting the protocol to secure itself.
🧪 Practice
- For Modbus, MQTT, and CAN, state the core security weakness and one concrete attack each enables.
- Explain why "the protocol has no authentication" is so often acceptable historically and why it becomes dangerous now.
- Describe two defenses for an MQTT deployment that must be reachable over the internet.
- Interview-style: "Why can't we just add authentication to these legacy protocols to fix them?" Hint: think backward compatibility, device constraints, and 20-year deployed lifespans.
Automotive and Medical Device Security
Theory
Two domains make the stakes of embedded security vivid because failures threaten human life directly: vehicles and medical devices. Both have become networked computers on wheels or in bodies, inheriting all the embedded-protocol and firmware risks above, but with a cyber-physical safety dimension — a successful attack is not data loss but potential physical harm. This reframes the security goal: the top priority is safety, and security exists to protect it.
Automotive: a modern car contains dozens of ECUs (Electronic Control Units) networked over buses like CAN (above), plus external attack surfaces — infotainment, Bluetooth, cellular telematics, keyless entry, and tire-pressure radios. The landmark 2015 Jeep Cherokee research showed a remote attacker pivoting from the internet-facing cellular/infotainment system through the internal network to safety-critical controls (transmission, brakes), prompting a 1.4-million-vehicle recall. The lessons drove the industry toward standards: ISO/SAE 21434 (automotive cybersecurity engineering) and UNECE R155 (regulatory requirement for a cybersecurity management system). Core defenses are internal segmentation/gateways between non-critical and safety-critical buses, secure boot and signed updates, and intrusion detection on the vehicle network.
Medical: connected infusion pumps, pacemakers, insulin pumps, and imaging systems can be life-sustaining, yet many run old, unpatchable software with long certification cycles that make updates slow. The risks are both direct (altering a device's therapy delivery) and indirect (a compromised device as a foothold into a hospital network, or ransomware taking devices offline). Regulators responded: the US FDA issues pre-market and post-market cybersecurity guidance, and a key artifact is the SBOM (Software Bill of Materials) so hospitals know what components (and thus what vulnerabilities) a device contains. Defenses mirror OT: segment medical devices onto isolated networks, monitor them, vet vendors' security, and manage the fleet's lifecycle given that patching is constrained.
Examples
The 2015 Jeep attack path (why in-vehicle segmentation matters):
Internet ──▶ cellular/telematics ──▶ infotainment (Uconnect)
│ NO gateway isolation
▼
CAN bus ──▶ transmission / brakes
Result: remote control of safety systems → 1.4M-vehicle recall.
Fix: a gateway/firewall between infotainment and the safety CAN segment,
so a compromised head unit cannot send frames to critical ECUs.
Medical device risk framing:
DIRECT harm: attacker alters infusion pump dose → patient safety event
INDIRECT: unpatchable imaging PC → ransomware foothold → hospital outage
Controls: network segmentation (isolate devices), continuous monitoring,
vendor SBOM + FDA guidance, lifecycle mgmt (patch where allowed).
Key Takeaways
- Automotive and medical devices add a cyber-physical safety dimension: attacks risk bodily harm, so safety is the top security objective.
- Cars are networks of ECUs over CAN with internet-facing surfaces; the 2015 Jeep hack pivoted from infotainment to brakes, driving ISO/SAE 21434 and UNECE R155 and the need for internal segmentation/gateways.
- Medical devices are often old and unpatchable; risks are direct (altering therapy) and indirect (network foothold, ransomware), answered by FDA guidance, SBOMs, segmentation, and lifecycle management.
- The common defensive playbook is OT-style: segment, monitor, secure-boot/sign updates, and vet the supply chain — because patching is constrained.
🧪 Practice
- Trace the 2015 Jeep attack from internet to brakes and name the single architectural control that would have blocked the pivot.
- Distinguish a "direct" from an "indirect" attack on a connected medical device, with an example of each.
- Explain what an SBOM is and why a hospital would demand one from a device vendor.
- Interview-style: "Why is patching so much harder for medical devices than for a laptop?" Hint: certification cycles, vendor approval, uptime/availability of life-sustaining functions, and device lifespan.
Physical Security and Tamper Resistance
Theory
All the preceding controls assume an attacker is remote. But embedded and IoT devices are frequently in places an attacker can physically touch — a parking-garage camera, a payment terminal, a smart meter on a house, a medical device in a clinic. Physical access is a distinct and powerful attack vector: given hardware in hand, an attacker can read memory chips, tap debug ports, probe buses, and extract secrets, bypassing network defenses entirely. The maxim "physical access is total access" is the historical default, and tamper resistance exists to push back against it. The analogy is that even the best alarm system does not help if the burglar can simply carry the whole safe away to crack it at leisure.
The threats and corresponding defenses:
- Debug-port abuse: UART/JTAG consoles left enabled give direct, often root-level access. Defense: disable or lock debug interfaces in production.
- Chip-level extraction: desoldering flash to read firmware/keys (as in firmware analysis above). Defense: encrypted storage and keys held in a secure element / TPM that resists extraction.
- Bus probing / side channels: reading data on PCB traces, or inferring keys from power consumption or electromagnetic emissions (side-channel attacks, deeper in 14.3). Defense: shielding, constant-time crypto, and secure hardware.
- Physical tampering / cloning: opening, modifying, or counterfeiting the device. Defense: tamper-evident seals (reveal intrusion) and tamper-resistant/responsive designs that make intrusion hard or that zeroize (wipe) secrets when a breach is detected.
Key building blocks of hardware-rooted trust are the secure element and TPM (Trusted Platform Module) — dedicated chips that store keys and perform crypto in a way designed to resist physical extraction — and Physical Unclonable Functions (PUFs), which derive a device-unique key from tiny manufacturing variations so there is no stored secret to steal. The design mindset is a ladder: tamper-evident (you can tell it happened) < tamper-resistant (hard to do) < tamper-responsive (actively destroys secrets on detection), chosen according to how exposed the device is and how damaging a compromise would be.
Examples
Tamper-protection ladder (choose by exposure + impact):
tamper-EVIDENT ──▶ tamper-RESISTANT ──▶ tamper-RESPONSIVE
"you can tell" "hard to open" "wipes keys on breach"
holographic seal epoxy potting, mesh sensor triggers
on an enclosure locked debug ports ZEROIZE of secure element
Hardware roots of trust:
Secure Element / TPM : keys never leave the chip in plaintext
PUF : key derived from chip's physical uniqueness
→ nothing stored to desolder and read
Why "physical access is total access" — and how a secure element breaks it:
NO secure element: attacker desolders flash ─▶ reads firmware + keys ─▶ clones
WITH secure element: keys live in tamper-resistant chip; flash holds only
ciphertext ─▶ desoldering flash yields unusable data;
prying open the secure element triggers key zeroization.
Key Takeaways
- Physical access is a distinct, powerful vector: with hardware in hand, attackers can dump chips, abuse debug ports, probe buses, and extract secrets, bypassing network defenses.
- Defenses include disabling debug interfaces, encrypting storage, and holding keys in a secure element/TPM so chip extraction yields only ciphertext.
- Hardware roots of trust (secure element, TPM, PUF) keep secrets off-chip-readable; PUFs derive keys from physical uniqueness so there is nothing stored to steal.
- Choose protection on a ladder — tamper-evident < tamper-resistant < tamper-responsive (zeroizes secrets) — matched to the device's exposure and the impact of compromise.
🧪 Practice
- Explain the saying "physical access is total access" and give two concrete physical attacks it refers to.
- Distinguish tamper-evident, tamper-resistant, and tamper-responsive with an example of each.
- Describe how a secure element or TPM changes the outcome when an attacker desolders a device's flash chip.
- Interview-style: "What is a PUF and why is 'no stored secret' valuable for a device left in the field?" Hint: if the key is derived from the chip itself, what is there for a physical attacker to read out?
<a id="12-offensive-security"></a>