Skip to content

Cloud Native Security 05: Protect What's Running

Two days after the React2Shell flaw was published in December 2025, it was on CISA's list of vulnerabilities under attack. Attackers used it to get inside application containers and take the cloud credentials they found there1.

You won't always patch in two days. This post is about making a break-in boring, so the attacker lands in a container with nothing to use, nowhere to go and an alarm going off.


Four layers around every container

Four layers: the container gives an attacker little to work with, the network leaves nowhere to go, identity leaves nothing to steal, and detection means someone notices.

None of these is perfect. Identity has its own post, and the other three are below.


Take away what the container doesn't need

Most apps never need to be root, load kernel modules or gain new privileges. Say so in the deployment, and the kernel enforces it:

spec:
  hostUsers: false
  automountServiceAccountToken: false
  securityContext:
    runAsNonRoot: true
    runAsUser: 10001
    seccompProfile: {type: RuntimeDefault}
  containers:
  - name: app
    securityContext:
      allowPrivilegeEscalation: false
      readOnlyRootFilesystem: true
      capabilities: {drop: [ALL]}
    resources:
      limits: {memory: 512Mi}
Line What it does
hostUsers: false Root inside the container is nobody outside it. Stable since Kubernetes 1.36
automountServiceAccountToken: false Gives the app no key to the Kubernetes API
seccompProfile Blocks unusual requests to the kernel
readOnlyRootFilesystem Makes it harder for an attacker to save tools inside the container
drop: [ALL] Removes special root powers
limits Stops one app from using all the memory

Expect the read-only filesystem to break some apps at first. Give them a small writable folder for temporary files. hostUsers: false needs recent node software and doesn't work with NFS volumes.

Run code you don't trust in a stronger box

Containers share the machine's kernel, so a kernel flaw can let one escape. For customer uploads, plugins or code written by an AI agent, add a real barrier:

Option What it puts in between
gVisor A second, smaller kernel
Kata Containers A lightweight virtual machine for each pod
Confidential Containers Encrypted memory, so even the server's operator can't read it. Still young

Block all traffic, then allow what you need

By default, every pod can talk to every other pod and to the internet. One compromised app can try them all. Start each namespace with this policy, which blocks everything except finding addresses (DNS):

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny-allow-dns
spec:
  podSelector: {}
  policyTypes: [Ingress, Egress]
  egress:
  - to:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: kube-system
      podSelector:
        matchLabels:
          k8s-app: kube-dns
    ports:
    - {protocol: UDP, port: 53}
    - {protocol: TCP, port: 53}

Then add one rule for each connection the app needs. Try it in a test environment first, because it will break anything you forgot.

Two things catch people out. The policy does nothing unless your cluster's network plugin supports it, so confirm that with a real blocked connection. And clusters with a local DNS cache on each node may need one more rule.

You need Use
Network rules that work Cilium, or Calico
Rules for outside websites by name Cilium's toFQDNs
Rules that app teams can't remove ClusterNetworkPolicy, new in 2026 and still in beta

Outgoing rules matter most. Stolen data has to leave through them.


Make services prove who they are

Network rules work on labels and addresses. A service mesh adds certificates, so each service proves its identity and traffic between them is encrypted. That's called mutual TLS.

Istio's ambient mode does it without adding a helper container to every pod. Linkerd is the simpler alternative, though its stable releases now come from vendors.

  • Set mutual TLS to STRICT, since the default still accepts unencrypted traffic
  • Run Istio 1.32.1, 1.31.5 or 1.30.9 at the oldest. They fix a way around its access rules, disclosed on 2 December 20262

A mesh is one more system to run. If you have a handful of services, good network rules and TLS in the apps may be enough.


Protect the front door

Threat Where to stop it
A flood of traffic (DDoS) At your cloud or CDN provider. It's too late once it reaches the cluster
One client sending too many requests Rate limits on the gateway, such as Envoy Gateway
Known attack patterns in requests A web application firewall, from your provider or Coraza with the OWASP rules
An admin page open to the internet Take it off the internet

New setups should use Gateway API, the replacement for the older Ingress.


Notice when a container does something new

A web server doesn't normally start a shell or read /etc/shadow. Tools that watch the kernel can spot that within seconds.

You want Use
Alerts Falco
To stop the process immediately Tetragon
A separate rule set for each app KubeArmor

Start with alerts. Blocking rules can take down a healthy app when they're wrong. Send the alerts to the place your team already watches, and tune the noisy ones in the first two weeks.


Functions need the same care

Serverless functions hide the servers, and the access they hold is still yours to limit. On AWS Lambda:

  • Give each function its own role, with access only to what it uses
  • Cap how many can run at once, so a flood doesn't overload your database
  • Allow only signed code to run

Summary

If an attacker... This gets in the way
lands in a container Non-root, read-only, no extra privileges
tries to reach the machine User namespaces, seccomp, or gVisor
looks for other services Default-deny network rules
pretends to be another service Mutual TLS
starts a shell Falco
  • Add the security settings to one app, then make them your template
  • Put default-deny in one test namespace
  • Install Falco and send its alerts to your team's channel
  • List everything reachable from the internet, and remove what shouldn't be

Next: Identity, secrets and data


  1. Palo Alto Networks Unit 42, Modern Kubernetes threats: CVE-2025-55182, disclosed on 3 December 2025 and in CISA's catalogue on 5 December. ↩

  2. Istio, security news, ISTIO-SECURITY-2026-010. The pod settings are documented in the Kubernetes pages on user namespaces, seccomp and network policies. ↩

Discussion

Have thoughts on this post? Share them below — questions, corrections, or your own experience are all welcome.