Cloud Container & Serverless Security — Secure In Security 2026
Secure In Security — Cloud Container & Serverless Security Contact / About / Policy
Cloud Container &
Serverless Security
Securing Modern Cloud-Native Architectures
Container Security Fundamentals
Learning Objectives
Upon completing this module, learners will be able to: (1) Explain what containers are and how they differ architecturally from virtual machines; (2) Identify the Linux kernel primitives that enable container isolation; (3) Understand the container security threat surface; (4) Apply a container security baseline and understand why containers require a dedicated security approach.

What Are Containers?

A container is a standard unit of software that packages code and all its dependencies so the application runs quickly and reliably across different computing environments. Unlike virtual machines, containers share the host operating system kernel and do not require a full OS per instance, making them lightweight, fast, and highly portable.

Containers vs. Virtual Machines

DimensionVirtual Machine (VM)Container
OSFull guest OS per VM (GBs)Shares host OS kernel (MBs)
Startup TimeMinutesMilliseconds to seconds
Isolation LevelStrong hardware-level (hypervisor)Process-level (kernel namespaces)
PortabilityLimited — image tied to hypervisorHigh — runs anywhere Docker/OCI runs
Attack SurfaceHypervisor + guest OS + appHost kernel + container runtime + app
DensityTens per hostHundreds to thousands per host
Security BoundaryHard boundary (hardware)Soft boundary (kernel features)

Linux Kernel Security Primitives

Container security is built on several Linux kernel features. Understanding these primitives is essential for evaluating container isolation and knowing where it breaks down.

PrimitiveSecurity Role
NamespacesIsolate process views of system resources: PID, network, mount, UTS, IPC, user namespaces. Each container gets its own namespace view.
cgroups (Control Groups)Limit and account for resource usage (CPU, memory, I/O, network). Prevent denial-of-service from resource exhaustion.
SeccompRestricts which Linux system calls a container process can make. A seccomp profile denies all syscalls not explicitly allowed.
AppArmor / SELinuxMandatory Access Control (MAC) systems that enforce security policies beyond DAC. Constrain container file and network access.
CapabilitiesDivide root privilege into granular units. Drop unnecessary capabilities (e.g., NET_ADMIN, SYS_ADMIN) from containers to minimize blast radius.
Overlay FilesystemUnion file system for container layers. Each container gets a writable layer on top of read-only image layers.

Container Security Threat Surface

The container security threat surface spans four distinct layers, each requiring dedicated controls:

LayerKey ThreatsPrimary Controls
Host OSKernel exploits, privilege escalation to break container boundariesHardened OS baseline, minimal kernel, runtime security
Container RuntimeRogue container escape, daemon socket exposure, runtime vulnerabilitiesUpdate runtime, restrict socket access, use rootless mode
Container ImageVulnerable base images, embedded secrets, malware in layersImage scanning, trusted registries, minimal base images
ApplicationOWASP Top 10, injection attacks, insecure dependenciesSecure coding, DAST/SAST, SCA, network policies
Docker & Container Image Security
Learning Objectives
Upon completing this module, learners will be able to: (1) Implement Docker security hardening best practices; (2) Build minimal, secure container images following CIS Docker Benchmark guidance; (3) Configure and operate a container image scanning pipeline; (4) Manage container secrets securely and avoid common credential exposure patterns.

Docker Security Hardening

Docker Engine exposes significant security controls that are disabled or permissive by default. Hardening requires explicit configuration at both the daemon and container levels.

Docker Daemon Security

  • Never expose the Docker socket (/var/run/docker.sock) to containers — this grants root-equivalent host access
  • If access is required (e.g., for CI/CD), use Docker-in-Docker (DinD) with proper isolation, or the Kaniko/Buildah alternatives
  • Enable Docker Content Trust (DCT) to verify image signatures before pulling: export DOCKER_CONTENT_TRUST=1
  • Configure daemon to use user namespaces (userns-remap) to map container root to unprivileged host user
  • Enable live-restore to keep containers running during daemon restarts, reducing availability risk
  • Restrict the Docker daemon to a Unix socket and never bind to TCP without TLS mutual authentication

Container Runtime Security Flags

Flag / OptionPurposeRecommended Setting
–no-new-privilegesPrevents privilege escalation via setuid/setgid binariesAlways set
–read-onlyMounts root filesystem as read-onlyUse unless app requires writes; mount tmpfs for /tmp
–userRun container process as non-root UIDSet to non-zero UID (e.g., --user 1001)
–cap-drop ALLDrop all Linux capabilitiesAlways drop all; add back only what is needed
–security-opt seccompApply seccomp filter profileUse Docker default or custom restrictive profile
–security-opt apparmorApply AppArmor profileUse docker-default or custom profile
–pids-limitLimit number of PIDs (prevents fork bombs)Set to reasonable limit (e.g., 100–500)
–memory / –cpusResource limits to prevent DoSAlways set appropriate limits
–networkControl network accessUse custom bridge or none; avoid --network host

Secure Container Image Construction

Image security begins at build time. The image is the supply chain artifact — vulnerabilities, misconfigurations, and secrets baked into images persist to every deployment.

Minimal Base Image Strategy

  • Use distroless or scratch base images for production workloads — eliminate shells, package managers, and unused binaries
  • If a base OS is needed, prefer Alpine Linux (musl libc, ~5MB) or slim variants of official images
  • Never use latest tag — pin to specific immutable digest: FROM node:20.11.0-alpine3.19@sha256:<digest>
  • Regularly rebuild images to pick up base image security patches; automate via CI/CD pipeline

Dockerfile Security Best Practices

  • USER instruction — always switch from root before the final CMD/ENTRYPOINT: USER nonroot or USER 1001:1001
  • Multi-stage builds — use a build stage with build tools and copy only the final artifact to a minimal runtime stage
  • COPY vs ADD — always use COPY unless ADD’s tar extraction feature is explicitly needed
  • No secrets in layers — never use ENV or ARG for passwords/API keys; use runtime secret injection
  • Minimize layers — combine RUN commands to reduce attack surface; delete package caches in same RUN
  • HEALTHCHECK instruction — add health checks so orchestrators can detect and restart compromised containers
Multi-Stage Build Security Example

Stage 1 (builder): FROM golang:1.22 AS builder — install dependencies, compile binary.

Stage 2 (runtime): FROM gcr.io/distroless/static-debian12COPY --from=builder /app/binary /binaryUSER nonroot:nonrootENTRYPOINT ["/binary"]

Result: final image contains only the compiled binary and no shell, package manager, or build tools.

Container Image Scanning

Image scanning analyzes container images for known CVEs, misconfigurations, exposed secrets, and malware. It must be integrated into the CI/CD pipeline (shift-left) and run continuously in the registry.

Scanning Integration Points

  • Pre-commit: Developer IDE plugins (Snyk, Trivy VS Code extension) for immediate feedback
  • CI pipeline: Mandatory scan gate — fail build if CRITICAL/HIGH CVEs above defined threshold
  • Registry: Continuous scanning of stored images (Amazon ECR scanning, Azure Container Registry, JFrog Xray)
  • Pre-deployment: Admission controller webhook validates scan results before pods are created in Kubernetes
  • Runtime: Behavioral scanning to detect anomalies at execution time (Falco, Aqua, Sysdig)
ToolKey Capabilities
Trivy (Aqua Security)Open-source; scans images, filesystems, Git repos, Kubernetes; integrates with all CI/CD platforms
Grype (Anchore)Open-source vulnerability scanner; pairs with Syft SBOM generator; fast and accurate
Snyk ContainerSaaS platform; developer-centric; fix advice with base image upgrade suggestions
Amazon ECR ScanningNative AWS integration; Basic (Clair) and Enhanced (Inspector) scanning tiers
Prisma Cloud ComputeEnterprise CWPP; deep runtime, network, and compliance scanning across hybrid cloud

Secrets Management in Containers

Secrets (passwords, API keys, TLS certificates, tokens) must never be baked into container images, passed as environment variables from insecure sources, or stored in plaintext in configuration files.

Secrets Anti-Patterns to Avoid

  • ENV DB_PASSWORD=SuperSecret123 in Dockerfile — visible in image history, all layers, and docker inspect
  • Storing secrets in environment variables passed via docker run -e — visible to all processes in the container
  • Copying .env files or config files with credentials into the image during build
  • Hard-coding credentials in application code committed to source control

Recommended Secrets Injection Patterns

  • Docker Secrets (Swarm mode) or Kubernetes Secrets (with encryption at rest) — mounted as tmpfs files
  • External secrets manager: AWS Secrets Manager, Azure Key Vault, HashiCorp Vault — retrieved at runtime via sidecar or init container
  • CSI Secrets Store Driver (Kubernetes) — mounts secrets from external vault directly as volume at pod startup
  • IRSA / Workload Identity — use cloud provider’s pod identity mechanism to grant IAM-based access without credentials
Kubernetes Security
Learning Objectives
Upon completing this module, learners will be able to: (1) Understand the Kubernetes architecture from a security perspective; (2) Implement RBAC, Network Policies, Pod Security Standards, and admission controls; (3) Harden the Kubernetes API server and control plane components; (4) Operate a Kubernetes cluster aligned to the CIS Kubernetes Benchmark.

Kubernetes Security Architecture

Kubernetes orchestrates containerized workloads across clusters of nodes. Its distributed architecture introduces a large and complex security surface. Compromising the API server is effectively equivalent to compromising every workload in the cluster.

Key Components & Their Security Roles

ComponentSecurity Significance
API ServerCentral control plane component — all requests pass through; must enforce AuthN, AuthZ, and admission control
etcdCluster state store — contains all secrets, configs, and workload definitions; must be encrypted and access-restricted
kubeletNode agent — executes pods; must authenticate to API server; anonymous auth must be disabled
SchedulerPlaces pods on nodes — security-relevant for placement of sensitive workloads (node affinity/taints)
Controller ManagerRuns control loops — service account token controller must be monitored for token generation abuse
Cloud ControllerInterfaces with CSP APIs — IAM scope must be minimized (least privilege cloud IAM roles)

Kubernetes RBAC

Role-Based Access Control (RBAC) is the primary authorization mechanism in Kubernetes. Misconfigured RBAC is the most common path to cluster-wide privilege escalation.

RBAC Concepts

  • Role / ClusterRoleDefines a set of permissions (verbs: get, list, create, delete, etc.) on resources (pods, secrets, deployments, etc.)
  • RoleBinding / ClusterRoleBindingBinds a Role to a Subject (User, Group, or ServiceAccount) within a namespace or cluster-wide
  • ServiceAccountIdentity for pod workloads; each pod runs under a ServiceAccount and can be granted RBAC permissions

RBAC Security Best Practices

  • Apply least privilege — grant only the minimum verbs and resources needed; avoid wildcards (verbs: ["*"], resources: ["*"])
  • Use kubectl auth can-i and tools like Rakkess or kubectl-who-can to audit what subjects can do
  • Never bind cluster-admin to service accounts, users, or groups in production
  • cluster-admin grants full access to all resources and namespaces — treat like a break-glass account
  • Disable auto-mounting of service account tokens for pods that do not need API access: automountServiceAccountToken: false
  • Audit RBAC bindings regularly — use rbac-tool, Polaris, or Tetragon to detect over-permissive bindings
  • Avoid using default service accounts — create dedicated service accounts per workload with minimal permissions

Pod Security Standards (PSS)

Pod Security Standards replaced PodSecurityPolicies in Kubernetes v1.25. They define three security profiles enforced via the built-in Pod Security Admission controller:

ProfileIntentKey Restrictions
PrivilegedNo restrictions (legacy/system)None — allows all privileged operations
BaselineMinimal restrictions for common workloadsNo privileged containers, no hostPath, no hostNetwork/PID/IPC, restricted capabilities
RestrictedHardened best-practice profileAll Baseline + non-root required, read-only root FS encouraged, allowPrivilegeEscalation: false, seccomp RuntimeDefault
Recommendation
Target the Restricted profile for all production workloads. Apply via namespace labels: pod-security.kubernetes.io/enforce: restricted. Use Audit and Warn modes first to identify violations before switching to Enforce.

Kubernetes Network Policies

By default, all pods in a Kubernetes cluster can communicate with all other pods across all namespaces. Network Policies are namespace-scoped resources that define ingress and egress rules for pod-to-pod communication, implementing micro-segmentation within the cluster.

Network Policy Best Practices

  • Start with a default-deny-all ingress and egress policy in every namespace, then explicitly allow required traffic
  • Use namespace selectors to restrict cross-namespace communication to only required service dependencies
  • Use pod selectors with specific labels to limit which pods can communicate with sensitive workloads (databases, secret stores)
  • Egress policies are equally important — prevent pods from exfiltrating data or reaching C2 infrastructure
  • Use a CNI plugin that enforces Network Policies: Calico, Cilium, Weave Net (confirm CNI supports Network Policy objects)

Admission Controllers for Security

  • OPA Gatekeeper / KyvernoPolicy-as-code engines that enforce organizational policies at admission time
  • ImagePolicyWebhookValidates image signatures and registry allowlists before pod creation
  • ValidatingAdmissionWebhookCustom validation logic for any Kubernetes resource
  • MutatingAdmissionWebhookAutomatically injects security controls (sidecars, labels, annotations)
Serverless Security Fundamentals
Learning Objectives
Upon completing this module, learners will be able to: (1) Define serverless computing and explain the Function as a Service (FaaS) execution model; (2) Identify how the shared responsibility model shifts in serverless environments; (3) Compare the security models of AWS Lambda, Azure Functions, and Google Cloud Functions; (4) Understand the unique security challenges introduced by serverless architectures.

What Is Serverless Computing?

Serverless computing is a cloud execution model where the cloud provider dynamically manages the allocation of compute resources. Developers write and deploy individual functions; the provider handles provisioning, scaling, patching, and infrastructure management entirely. The term ‘serverless’ is a misnomer — servers still exist, but they are completely abstracted from the developer.

Function as a Service (FaaS) Execution Model

  • Functions are stateless, short-lived execution units triggered by events (HTTP, queue messages, database changes, schedules)
  • Execution environments are ephemeral — a ‘cold start’ provisions a new container; ‘warm’ instances may be reused within a short window
  • Billing is per-invocation and per-millisecond of execution — unused functions cost nothing
  • Maximum execution timeout limits apply: AWS Lambda (15 min), Azure Functions (Consumption: 5–10 min), GCF (9 min)

Serverless vs. Containers — Security Comparison

Security DimensionContainersServerless (FaaS)
OS HardeningCustomer responsibilityProvider responsibility
Runtime PatchingCustomer (or managed K8s)Provider — fully managed
Network ConfigCustomer (CNI, NetworkPolicy)Provider-managed VPC/isolation; customer configures VPC integration
Attack SurfaceHost OS + runtime + image + appApp code + dependencies + IAM + event sources
VisibilityContainer logs, metrics, tracesFunction logs, X-Ray/traces; execution environment opaque
PersistencePersistent (long-lived containers)Ephemeral — no persistent local filesystem between invocations
Lateral MovementNetwork-based within clusterIAM-based; function role determines blast radius

Shared Responsibility in Serverless

The serverless model shifts the majority of infrastructure responsibility to the provider, but does not eliminate customer security obligations. The customer’s security focus shifts from infrastructure to application code, dependencies, IAM, and event source security.

Customer Security Responsibilities in Serverless
  • Application code security and secure development practices
  • Third-party library and dependency vulnerability management
  • IAM execution role permissions (least privilege)
  • Secrets and environment variable management
  • Event source authentication and input validation
  • Function-to-function and function-to-service communication security
  • Logging, monitoring, and alerting configuration
  • Data encryption and classification

Serverless Platform Security Features

FeatureAWS LambdaAzure FunctionsGoogle Cloud Functions
Execution Role / IdentityIAM Execution RoleManaged Identity / Function KeyService Account (Google IAM)
Network IsolationVPC Lambda integrationVNET IntegrationVPC Connector
Secrets MgmtSecrets Manager, SSM Parameter StoreKey Vault referencesSecret Manager
Code SigningLambda Code Signing (AWS Signer)Limited (Azure Defender)Artifact Registry signing
LoggingCloudWatch LogsApplication Insights / Log AnalyticsCloud Logging
TracingAWS X-RayApplication InsightsCloud Trace
DDoS ProtectionAWS Shield (Standard auto)Azure DDoS (via API Mgmt)Google Cloud Armor
SAST IntegrationCodeGuru (Amazon)GitHub Advanced SecurityCloud Build + Security Scanner
Serverless Attack Surfaces & Threat Modeling
Learning Objectives
Upon completing this module, learners will be able to: (1) Map the OWASP Serverless Top 10 to real-world attack scenarios; (2) Identify serverless-specific attack techniques including event injection, function chaining abuse, and DoS via resource exhaustion; (3) Conduct a serverless threat model using STRIDE methodology; (4) Implement input validation, output encoding, and secure function communication patterns.

OWASP Serverless Top 10

OWASP has identified the top 10 security risks specific to serverless architectures. These differ meaningfully from the traditional OWASP Top 10 due to the unique execution model:

#Threat / VulnerabilityDescription / ImpactSeverity
SAS-1 Function Event-Data Injection Untrusted event data passed to functions triggers command, SQL, LDAP, or NoSQL injection. Event sources (S3, SQS, API Gateway) may carry attacker-controlled payloads. Critical
SAS-2 Broken Authentication Inadequate or missing authentication on function triggers exposes functions to unauthenticated invocation via HTTP, API keys, or event sources. Critical
SAS-3 Insecure Serverless Deployment Config Default-open IAM roles, public function URLs, unencrypted environment variables, verbose error messages leaking internals. High
SAS-4 Over-Privileged Function Permissions IAM execution roles with excessive permissions; compromise of one function grants attacker broad access to cloud resources. Critical
SAS-5 Inadequate Function Monitoring Insufficient logging of invocations, errors, and resource usage prevents detection of abuse, data exfiltration, and anomalous behavior. High
SAS-6 Insecure Third-Party Dependencies Functions import vulnerable open-source libraries; serverless packaging makes dependency auditing harder without dedicated tooling. High
SAS-7 Insecure App Secrets Storage Secrets stored as plaintext environment variables, embedded in code, or in unencrypted configuration — all visible to anyone with function access. Critical
SAS-8 Denial of Service & Financial Exhaustion Attackers trigger massive invocation floods causing runaway costs (billion-dollar mistake) or service degradation via timeout chaining. High
SAS-9 Serverless Function Execution Flow Manipulation Exploiting function sequencing logic, step function state machines, or event routing to bypass business logic controls. Medium
SAS-10 Improper Exception Handling Verbose stack traces, unhandled rejections, and error messages exposing function internals, dependency versions, or infrastructure details. Medium

Serverless-Specific Attack Techniques

Event Injection

Every event source that triggers a serverless function is a potential injection vector. Unlike web applications where the HTTP request is the primary input, serverless functions may process data from dozens of sources simultaneously:

  • S3 Event injection: Attacker uploads a file with a malicious filename containing path traversal or command injection characters
  • SQS/SNS message injection: Attacker places crafted JSON payloads into a message queue consumed by a function
  • DynamoDB Streams: Database record changes processed by functions — attacker with DynamoDB write access can inject payloads
  • API Gateway: Standard HTTP injection vectors (SQLi, XSS, XXE, SSRF) — all apply when functions process HTTP events
Mitigation: Input Validation
Validate and sanitize ALL input regardless of event source. Never trust event data. Use schema validation libraries (Joi, Pydantic, Zod) to enforce strict input schemas. Treat event data from internal sources (SQS, DynamoDB Streams) with the same suspicion as external HTTP input — an upstream compromised function or service may be the source.

Denial of Wallet (DoW) Attacks

Serverless billing is consumption-based. Attackers who can trigger function invocations can generate massive compute bills, causing financial damage without causing availability impact.

  • Flood an unauthenticated API Gateway endpoint with millions of requests — each invokes a Lambda at fractions of a cent, totaling thousands of dollars
  • Trigger recursive function chains — a function that calls itself or creates a cycle of invocations
  • Mitigation: Set Lambda concurrency limits (reserved and provisioned), API Gateway throttling, AWS Budgets alerts, WAF rate limiting

Lateral Movement via IAM

In serverless environments, lateral movement occurs through IAM rather than network connections. A compromised function’s execution role is the attacker’s access vehicle:

  • Excessive permissions on the execution role allow the attacker to enumerate other AWS services, read S3 buckets, invoke other Lambda functions, or access databases
  • AssumeRole capability in the execution role can allow cross-account movement
  • Mitigation: Least-privilege execution roles scoped to exactly what the function needs; AWS IAM Access Analyzer to detect overly broad policies
DevSecOps — Securing the CI/CD Pipeline
Learning Objectives
Upon completing this module, learners will be able to: (1) Design a secure CI/CD pipeline with security gates at each stage; (2) Implement Software Composition Analysis (SCA) and Software Bill of Materials (SBOM) generation; (3) Apply infrastructure-as-code security scanning for container and serverless resources; (4) Understand and mitigate supply chain attacks targeting build pipelines.

Shift-Left Security in Container & Serverless Pipelines

Shift-left security embeds security controls earlier in the software development lifecycle, catching vulnerabilities when they are cheapest to fix — in development, not in production. For container and serverless workloads, this means integrating security tooling directly into the developer workflow and CI/CD pipeline.

Security Gates Across the SDLC Pipeline

StageSecurity ActivityTools
Code / CommitSAST, secret scanning, lintingSemgrep, Bandit, GitLeaks, SonarQube, Checkov
BuildContainer image build, dependency scan (SCA), SBOM generationTrivy, Grype, Syft, Snyk, OWASP Dependency-Check
Package / RegistryImage signing, registry push with scan gate, policy enforcementCosign, Notary v2, ECR/ACR scanning, OPA Conftest
Deploy / Pre-ProdIaC scanning, admission control, DAST on stagingtfsec, Checkov, cfn-nag, Kyverno, OWASP ZAP
ProductionRuntime security, CSPM, SIEM integration, anomaly detectionFalco, Sysdig, Aqua, Prisma Cloud, AWS GuardDuty
Monitor / FeedbackAlerting, incident response, CVE feeds, dependency update PRsDependabot, Renovate, CloudWatch, Splunk, Datadog

Software Bill of Materials (SBOM)

An SBOM is a formal, machine-readable inventory of all software components and dependencies in an application or container image. It is the foundation of software supply chain security, enabling rapid identification of components affected by newly disclosed CVEs.

SBOM Standards

  • SPDXSoftware Package Data Exchange — Linux Foundation standard; ISO/IEC 5962:2021; supported by GitHub
  • CycloneDXOWASP standard; feature-rich; supports VEX (Vulnerability Exploitability eXchange) for CVE context

SBOM Generation for Containers & Serverless

  • Syft (Anchore) — generates SBOMs from container images, directories, and archives in SPDX, CycloneDX, and JSON formats
  • Trivy — combined scanner and SBOM generator; outputs CycloneDX and SPDX formats
  • Amazon Inspector — generates SBOMs from ECR images; exports to S3 for governance programs
  • For serverless: generate SBOM from the deployment package (ZIP/JAR) before packaging and deploying
Regulatory Driver
The US Executive Order 14028 (May 2021) on Improving the Nation’s Cybersecurity mandates SBOMs for software sold to the US federal government. CISA has published minimum elements for SBOMs. Organizations in regulated industries should begin SBOM programs now.

Supply Chain Attack Prevention

Supply chain attacks compromise software at the build or distribution stage, affecting all downstream consumers. SolarWinds (2020) and the XZ Utils backdoor (2024) demonstrated the catastrophic potential of build pipeline compromise.

Key Controls

  • Code signing — sign all container images and serverless deployment packages with Cosign (Sigstore) or AWS Signer; verify signatures at deployment
  • Hermetic builds — CI/CD builds should only access pre-approved, pinned dependencies from internal mirrors; no live internet dependency resolution
  • Pinned dependencies — use exact version hashes (package-lock.json, poetry.lock, go.sum) not floating version ranges
  • Trusted base image registry — maintain an internal registry of approved, scanned base images; block pulls from public registries in production
  • Build environment hardening — build agents should be ephemeral, isolated, and minimal; rotate secrets and credentials after each build
  • SLSA Framework (Supply chain Levels for Software Artifacts) — adopt SLSA Level 2+ for provenance attestation of all artifacts
Runtime Defense & Incident Response
Learning Objectives
Upon completing this module, learners will be able to: (1) Implement runtime security monitoring for containers and serverless functions; (2) Configure Falco rules for anomaly detection in container environments; (3) Build a cloud-native incident response playbook for container and serverless compromises; (4) Apply forensic techniques to ephemeral container and serverless environments.

Container Runtime Security Monitoring

Runtime security monitoring detects threats that static scanning cannot: zero-days, misuse of legitimate tools, insider threats, and configuration drift. It observes the live behavior of containers and triggers alerts on anomalies.

Falco — Cloud-Native Runtime Security

Falco (CNCF project) is the de-facto open-source runtime security engine for containers and Kubernetes. It monitors Linux system calls and Kubernetes audit events, comparing them against a rule set to detect malicious or anomalous activity.

  • Detects: shell spawned in container, sensitive file reads (/etc/shadow, /etc/passwd), outbound network connections to unexpected IPs
  • Detects: privilege escalation, namespace changes, container image overrides, Kubernetes API abuse
  • Integrates with: Slack, PagerDuty, Splunk, Elasticsearch, Falcosidekick for alerting and response automation

Key Falco Rules for Container Security

RuleWhat It Detects
Terminal shell in containerInteractive shell session spawned inside a running container (common attacker activity)
Write below binary directoryFile write to /bin, /sbin, /usr/bin — indicates binary tampering or backdoor installation
Sensitive file opened for readingRead access to /etc/shadow, /etc/sudoers, SSH keys, cloud credential files
Outbound connection to C2 serverUnexpected outbound TCP/UDP to IPs not in allowlist (potential C2 beacon)
Container running as rootAlert when a newly started container process runs as UID 0
Privileged container startedAlert when any container starts with securityContext.privileged: true
K8s secret enumerationkubectl list secrets or API calls listing all secrets in a namespace

Serverless Runtime Security

AWS Lambda Runtime Security Controls

  • AWS Lambda Power ToolsStructured logging, tracing, and input validation utilities for Lambda functions
  • Amazon GuardDuty Lambda ProtectionDetects anomalous Lambda invocation patterns, exfiltration attempts, and credential abuse in function executions
  • AWS CloudTrailLogs all Lambda management API calls; essential for detecting unauthorized function modification or invocation
  • Function URL authenticationNever deploy Lambda function URLs without IAM authentication or custom authorizers
  • Reserved concurrencySet maximum concurrent executions per function to limit blast radius of runaway invocations

Serverless Security Observability

  • Log all invocations with structured JSON including: function name, version, request ID, event source, input schema hash, execution duration, outcome
  • Emit custom metrics for: failed input validations, authentication failures, unexpected event sources, execution timeouts
  • Distributed tracing (AWS X-Ray, Open Telemetry) to track request flow across function chains and identify anomalous call patterns

Incident Response for Ephemeral Environments

The ephemeral nature of containers and serverless functions creates unique forensic challenges: evidence may be destroyed within seconds of an incident if not captured proactively. Standard forensic procedures must be adapted for cloud-native environments.

Container Incident Response Playbook

  • Detect
    GuardDuty/Falco alert fires; correlate with CloudTrail, VPC Flow Logs, and container runtime logs
  • Preserve Evidence
    Immediately capture: running process list (docker top), network connections (netstat), environment variables (docker inspect), and take a container filesystem snapshot before stopping
  • Contain
    Apply network policy deny-all to the compromised pod’s label selector; scale deployment to 0 replicas; preserve the original pod (do not delete) for forensics
  • Isolate
    Cordon the node if host compromise is suspected (kubectl cordon <node>); drain non-affected workloads
  • Analyze
    Mount container filesystem snapshot in an isolated forensic environment; analyze logs, binaries, and network artifacts
  • Eradicate
    Rebuild image from known-good source; redeploy from clean artifact; rotate all credentials the workload had access to
  • Recover
    Deploy patched workload; verify integrity with image signature verification; increase monitoring intensity for 72 hours
  • Post-Incident
    Root cause analysis; update Falco rules, admission policies, and runbooks; report per regulatory timelines
Forensic Logging Pre-Requirement
Effective container incident response depends entirely on logging configured before an incident occurs. Ensure: (1) Container logs shipped to immutable log store (CloudWatch, Splunk) with minimum 90-day retention; (2) Kubernetes audit logs enabled with at least RequestResponse level for secrets and authentication resources; (3) VPC Flow Logs enabled for all cluster node subnets; (4) Node-level process execution audit logging (auditd or eBPF).
Glossary of Key Terms
TermDefinition
AppArmor / SELinuxMandatory Access Control (MAC) systems that enforce security policies on processes, constraining what files and system calls containers can access.
Admission ControllerKubernetes plugin that intercepts API requests and validates or mutates objects before they are persisted — used to enforce security policies.
CNAPPCloud-Native Application Protection Platform — unified security platform combining CSPM, CWPP, CIEM, and workload scanning in a single solution.
Cold StartInitial invocation of a serverless function where the provider provisions a new execution environment — security monitoring must cover cold start behavior.
Cosign / SigstoreOpen-source tools for signing, verifying, and storing container image and artifact signatures to establish provenance.
CWPPCloud Workload Protection Platform — security solution focused on protecting workloads (VMs, containers, serverless) from threats at runtime.
Denial of WalletServerless attack pattern exploiting consumption-based billing to generate financial damage by triggering massive function invocations.
Distroless ImageContainer base image that contains only the application and its runtime dependencies — no shell, package manager, or OS utilities.
eBPFExtended Berkeley Packet Filter — Linux kernel technology used by modern security tools (Falco, Cilium, Tetragon) for low-overhead syscall observation.
FalcoCNCF open-source runtime security engine that detects anomalous container and Kubernetes behavior via syscall and audit event monitoring.
FaaSFunction as a Service — serverless execution model where individual functions are deployed and executed on-demand without managing servers.
Hermetic BuildCI/CD build process that is fully isolated from external dependencies — uses only pre-approved, cached inputs to ensure reproducibility and supply chain integrity.
IRSAIAM Roles for Service Accounts — AWS mechanism that associates Kubernetes service accounts with IAM roles, enabling pods to call AWS APIs without static credentials.
Namespace (K8s)Kubernetes construct providing logical isolation of resources within a cluster — used to enforce RBAC, Network Policies, and PSS by scope.
Namespace (Linux)Kernel feature isolating container views of system resources (PID, network, mount, etc.) — fundamental to container isolation.
OPA / GatekeeperOpen Policy Agent — policy-as-code engine used as a Kubernetes admission controller to enforce organizational security policies.
SBOMSoftware Bill of Materials — formal inventory of all software components in an artifact; essential for supply chain transparency and CVE response.
SeccompSecure Computing Mode — Linux kernel feature restricting which system calls a container process can make; reduces kernel attack surface.
SLSASupply chain Levels for Software Artifacts — Google-originated framework defining increasing levels of supply chain integrity guarantees.
Workload IdentityCloud provider mechanism (AWS IRSA, GCP Workload Identity, Azure Workload Identity) granting pod/function IAM access without static credentials.

References & Further Reading