Lesson 11 of 13 · 10m
Audit Logs Are the Black Box Recorder
Policy levels and stages, the secrets RequestResponse trap, the high-signal verbs to alert on, and Falco for the dataplane.
The recorder only works if you turn it on
Every breach writeup ends with a forensic timeline — and every cluster without an audit log produces the same timeline: nothing. The API server's audit log is the cluster's black box recorder, and on most clusters it is either off or logging to a file on the API server that nobody ships anywhere.
The mechanism: --audit-policy-file points at a YAML policy; --audit-log-path (with -maxage, -maxbackup, -maxsize) writes JSON events; the webhook backend batches events to an HTTP endpoint instead. Each event records auditID, user.username (plus impersonatedUser when --as was used), verb, requestURI, sourceIPs, and responseStatus — who, what, where from, what the API server did about it.
A real event looks like:
{"verb":"create","requestURI":"/api/v1/namespaces/prod/pods/web/exec",
"user":{"username":"ci-bot"},"impersonatedUser":{"username":"admin"},
"sourceIPs":["10.2.4.7"],"responseStatus":{"code":201}}impersonatedUser is the tell — ci-bot ran exec as admin. If your alerting doesn't key on that field, --as usage is invisible to you.
Policy granularity is the part people get wrong:
- Levels:
None(skip),Metadata(the envelope — user, verb, URI, status),Request(adds the request body),RequestResponse(adds the response body too). - Stages:
RequestReceived,ResponseStarted,ResponseComplete,Panic; useomitStagesto keepRequestReceivednoise out. - Filters: per-rule
users,verbs,resources,namespaces,nonResourceURLs.
The sharp edge: RequestResponse on secrets logs the response body — which contains the secret data itself. Base64 in the log is base64 anyone with log access decodes. The standard pattern logs secrets at Metadata — you see that system:serviceaccount:prod:ci listed secrets at 03:14, without the log becoming a credential store.
The verbs that mean something
A policy that earns its disk:
apiVersion: audit.k8s.io/v1
kind: Policy
rules:
- level: Metadata
resources: [{group: "", resources: ["secrets"]}]
- level: Request
verbs: ["create", "update", "patch", "delete"]
resources:
- {group: "", resources: ["pods/exec", "pods/portforward", "pods/ephemeralcontainers"]}
- {group: "rbac.authorization.k8s.io", resources: ["clusterrolebindings", "clusterroles", "rolebindings", "roles"]}
- {group: "", resources: ["serviceaccounts/token"]}
- {group: "certificates.k8s.io", resources: ["certificatesigningrequests"]}
- level: MetadataRead it as an alert list. pods/exec at 3am is a shell in production — logged as verb create against the pods/exec subresource, which is why the subresource names go in resources, not verbs. A new clusterrolebinding is privilege redistribution — the persistence move in real campaigns. serviceaccounts/token mints credentials. impersonatedUser fields mean someone exercised --as. These are low-frequency, high-signal events; alert on them and the log becomes detection, not just forensics.
Runtime detection is the other half
Audit logging watches the control plane — API calls. It says nothing about what a container does after admission. Falco covers the dataplane: syscall-level rules via eBPF that fire on the behavioral signatures of compromise — an interactive shell spawned in a container, a process reading /var/run/secrets/kubernetes.io/serviceaccount/token, outbound connections to mining pools, unexpected binaries in a readOnlyRootFilesystem violation path. Falco also ships a Kubernetes-audit plugin that consumes the API server's webhook backend, folding control-plane events into the same rule engine — one alert surface for "a pod exec'd" and "a shell spawned inside a container."
One more honesty note on cost: audit logging is cheap at Metadata and heavy at RequestResponse — response bodies are the expensive stage, and on a busy cluster RequestResponse everywhere is gigabytes a day and a log-pipeline bill. That's the real reason the secrets-at-Metadata pattern exists, not just leak hygiene.
The two together split the coverage cleanly: audit answers "who asked the cluster to do what," Falco answers "what is the workload actually doing." Breaches look different in each — clusterrolebindings create in one, bash -i in a Node container in the other.
What to actually do
Write the policy file, ship the events off-node (webhook backend or a log agent — a log file on the API server is forensics that evaporates with the node), alert on the short verb list, run Falco on the dataplane. If you're setting it up after an incident, you're doing forensics on a recorder that was off.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
A 257-Byte Password Is the Key: Inside the OpenSSH musl Bypass
CVE-2026-123158 lets an attacker log into a locked account on musl-based systems like Alpine by sending a password nobody set. The trigger is one number, 257, and the reason is a C library returning a single asterisk. I reproduced the exact boundary against musl 1.2.4 and read the fix.
Immich Had Fourteen Advisories and One Bug It Fixed Three Times
Immich's 2026 security record runs to fourteen advisories, and they cluster hard: the sharing features, the OAuth plumbing, and one login redirect parameter that took three separate fixes across eighty-three days. Plus the 3.0 migration traps still waiting for anyone who hasn't jumped yet.
Jellyfin's Threat Model Is Your Brother-in-Law
Four Jellyfin CVEs landed in 2026 and not one of them needs an admin account. One needs only the ability to name a file. Meanwhile Jellyfin 12 shipped in September, the version numbers stopped starting with 10, and every "am I patched" check you wrote is now wrong.
Node.js Fixed 16 Flaws in One Release. Most of Them Live in HTTP/2 and TLS.
The November 11 Node.js security releases fix 16 CVEs across the 26, 24 and 22 lines, seven of them rated high. Nearly all sit in HTTP/2 and TLS, where a remote client can crash a server, leak memory, or get past per-host client-certificate checks.