Virtualization, Cloud & Container Security
αΊ’o hΓ³a, ΔΓ‘m mΓ’y & BαΊ£o mαΊt Container
Key Terms
Hypervisor Types
A hypervisor (VMM β Virtual Machine Monitor) creates and manages virtual machines. The type determines the attack surface.
| Type | How It Runs | Examples | Attack Surface | Use Case |
|---|---|---|---|---|
| Type 1 Bare-metal |
Runs DIRECTLY on hardware β IS the operating system | VMware ESXi, Microsoft Hyper-V, KVM (Linux kernel) | SMALLER β no host OS layer to compromise | Data centers, cloud providers (GCP, AWS use Type 1) |
| Type 2 Hosted |
Runs on TOP of a host OS β OS + hypervisor both must be trusted | VirtualBox, VMware Workstation, Parallels | LARGER β host OS vulnerabilities add to attack surface | Developer workstations, testing environments |
Key VM Threats
| Threat | Description | Severity | Mitigation |
|---|---|---|---|
| VM Escape | Guest VM breaks out of virtualization boundary to access the host hypervisor or other VMs | CRITICAL β most severe VM vulnerability | Patch hypervisor promptly; minimize guest tools; use Type 1; separate sensitive VMs |
| VM Sprawl | Uncontrolled proliferation of VMs β forgotten, unpatched, unmanaged VMs increase attack surface | HIGH β unpatched VMs are easy targets | VM lifecycle management; automated decommissioning; inventory tracking |
| Snapshot Risk | Reverting to a snapshot undoes all patches, configuration changes, and security fixes applied since the snapshot | HIGH β can regress to vulnerable state | Snapshot management policy; prohibit production snapshot reversion without security review |
Cloud Shared Responsibility Model
The cloud provider and customer share security responsibility β but the division depends on the service model. The customer ALWAYS owns their data regardless of service model.
| Layer | IaaS Example: GCE | PaaS Example: GKE | SaaS Example: Gmail |
|---|---|---|---|
| Physical / Hardware | Provider | Provider | Provider |
| Network Infrastructure | Provider | Provider | Provider |
| Hypervisor | Provider | Provider | Provider |
| Operating System | Customer | Provider (node OS) | Provider |
| Runtime / Middleware | Customer | Provider | Provider |
| Application Code | Customer | Customer | Provider |
| Data | Customer | Customer | Customer |
| Access Configuration / IAM | Customer | Customer | Customer |
Container Security (Docker / Kubernetes)
Container Isolation Mechanism
| Mechanism | What It Isolates | Kernel Feature |
|---|---|---|
| Namespaces | PID (processes), Network, Mount (filesystem), UTS (hostname), IPC (inter-process communication), User | Linux kernel namespaces β each container has its own view |
| cgroups | CPU, memory, disk I/O, network bandwidth resource limits | Linux cgroups v2 β prevents resource exhaustion (DoS) by noisy neighbors |
Kubernetes Security Controls
| Control | What It Does | Platform C Configuration |
|---|---|---|
| RBAC | Role-based access control for Kubernetes API β who can do what in which namespace | Least privilege roles: developers get read-only on production namespace |
| NetworkPolicy | Layer 3/4 firewall for pod-to-pod traffic β default-deny + explicit allow rules | Default-deny ingress AND egress on all namespaces; explicit allow for service mesh traffic |
| Pod Security Standards | Admission control: Privileged (no restrictions), Baseline (prevents known escapes), Restricted (hardened) | Production namespace: Restricted (no root, no privileged containers, read-only root filesystem) |
| OPA / Gatekeeper | Policy-as-code admission controller β enforce custom rules at admission time | Block deployments without resource limits, block images from unregistered registries |
| Image Signing (cosign) | Cryptographically signs container images β verify provenance before admission | CI/CD pipeline signs images; Gatekeeper rejects unsigned images in production |
Container Registry Security
Scan images for known CVEs before deploying. Tools: Trivy (Platform C uses in GitHub Actions), Snyk, Grype. Pipeline exits with code 1 on Critical severity findings β blocks deployment.
Tags are MUTABLE β :latest or :v1.2 can be overwritten. Digests are immutable SHA-256 hashes. Always pin to digest in production (image@sha256:abc...).
- Type 1 hypervisor (bare-metal) has SMALLER attack surface than Type 2 β no host OS layer to compromise. Cloud providers (AWS, GCP, Azure) use Type 1.
- VM escape = most severe VM vulnerability β guest breaks out to host hypervisor or other VMs. Patch hypervisors immediately when escape vulnerabilities are disclosed.
- Customer ALWAYS owns their data in cloud β even in SaaS, the provider never takes responsibility for the customer's data content. Data classification and access control = customer responsibility.
- Containers share the kernel β not as isolated as VMs. A kernel exploit can escape all containers on the node simultaneously. VMs provide stronger isolation but use more resources.
- Snapshot reversion bypasses security patches β reverting to a snapshot from 3 months ago re-applies all vulnerabilities patched since then. Treat snapshot reversion as a security event requiring re-patching.
kubectl get networkpolicy -A.Restricted profile β no root containers (runAsNonRoot: true), read-only root filesystem, dropped all capabilities.securityContext.runAsUser: 0 or missing runAsNonRoot. Use OPA Gatekeeper to block root containers at admission.Shared responsibility reminder: Platform C on GCP (GKE = PaaS) β Google patches the GKE control plane and node OS. FinTech Company X is responsible for items 1-6 above. The PII incident was a customer responsibility failure (data encryption), not a GCP failure.
Practice Questions
Q1. A cloud data center uses VMware ESXi to run thousands of VMs directly on physical servers without any host OS. A developer's workstation uses VirtualBox to run test VMs on top of Windows. Which has a smaller attack surface and why?
A. VMware ESXi (Type 1) β it runs directly on hardware with no host OS layer, so an attacker cannot compromise a host OS to reach the hypervisorQ2. A malicious actor running code in a guest VM is able to execute code on the hypervisor host and access other VMs on the same physical server. What type of attack is this?
A. VM Escape β a guest VM breaks out of the virtualization boundary to access the hypervisor or other guest VMsQ3. Platform C runs on GKE (Google Kubernetes Engine). A customer's PII was exposed due to a missing encryption configuration in the application's ORM layer. GCP claims no responsibility for the exposure. Who is correct?
A. GCP is correct β data encryption at the application level is the customer's responsibility in the PaaS shared responsibility modelQ4. A security engineer compares Docker container isolation to VM isolation. Which statement is accurate?
A. Containers share the host kernel β a kernel vulnerability can compromise all containers on the host; VMs have separate kernels and provide stronger isolationQ5. A production Kubernetes cluster runs a critical financial application. During an emergency fix, an operations engineer reverts a VM snapshot taken before the last security patch cycle (2 months ago). What is the security risk?
A. Snapshot reversion undoes all security patches applied since the snapshot β the reverted system is now vulnerable to any CVEs that were patched in the last 2 months