/secskills-defense:defending-kubernetesfrom secskills-defense
Hardens Kubernetes clusters against common attacks by enforcing RBAC least privilege, Pod Security Admission, network policy default-deny, and audit-log detection. Use for security posture review, incident response, or translating attack paths into defenses.
Ships in secskills-defense. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Kubernetes is insecure in useful defaults, not in exotic bugs. The attacks that land are RBAC that grants more than intended, pods that run privileged because nothing stops them, a flat pod network, and mounted service-account tokens with cluster-wide reach. Defense is mostly closing those, in priority order, and being able to see when someone tries.
This is the counterpart to attacking-eks-gke-aks and exploiting-containers:
read those to know what the attacker does; use this to know what to enforce and
what to watch.
attacking-eks-gke-aksexploiting-containers / escaping-hardened-containers for the technique;
return here for the controlinvestigating-*-incidents / hardening-cloud-posture; a
GKE/EKS/AKS incident usually needs both planestriaging-security-alertsOrder matters — these are ranked by how often the gap is the actual entry path.
The most common real weakness. Look for the bindings that are escalation primitives regardless of how innocent they look:
# Who can create pods anywhere? (→ mount any secret, run as any SA)
kubectl auth can-i create pods --all-namespaces --as=system:serviceaccount:ns:sa
# Subjects bound to cluster-admin
kubectl get clusterrolebindings -o json | \
jq '.items[] | select(.roleRef.name=="cluster-admin") | .subjects'
The dangerous verbs are not just *. create pods lets a subject run a pod
as any service account in the namespace and mount any secret — effectively
namespace-admin. escalate and bind on roles let a subject grant themselves
more than they hold. create on pods/exec, and access to
secrets, serviceaccounts/token, and nodes/proxy are each escalation
paths. Enumerate what subjects can do, not what their role is named.
PodSecurityPolicy was removed in Kubernetes 1.25; the built-in replacement
is Pod Security Admission, which enforces the three Pod Security Standards
levels — privileged, baseline, restricted — per namespace via labels:
# Namespace label: enforce the restricted profile, and warn/audit on violations
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/audit: restricted
restricted blocks the pod configurations that make escape and privilege
escalation easy: privileged containers, host namespaces (hostPID, hostNetwork,
hostIPC), host-path mounts, running as root, added capabilities. A cluster
with no enforced profile is one securityContext.privileged: true away from a
node takeover. If you need policy beyond the three levels (image provenance,
registry allow-lists), that is an external admission controller (Kyverno, OPA
Gatekeeper) — note it, do not pretend PSA covers it.
By default every pod can reach every other pod. A default-deny ingress policy per namespace, with explicit allows, is what stops a single compromised pod from becoming lateral movement. Confirm the CNI actually enforces NetworkPolicy — some configurations accept the objects and enforce nothing, which is worse than none because it looks covered.
automountServiceAccountToken: false on pods that do not call the API.
A mounted token plus a permissive RBAC binding is the standard in-cluster
pivot.nodes/proxy RBAC and an exposed 10250 are
a direct route to command execution on nodes.Most clusters run with no meaningful audit policy, so there is nothing to investigate after the fact. A cluster without an audit policy configured is the Kubernetes version of GCP Data Access logging being off — the activity is simply not recorded.
High-value audit signals:
exec, attach, and port-forward into pods — interactive accessget/list at scale, especially cluster-widecreate/update on clusterrolebindings and rolebindingsprivileged, host namespaces, or host-path mountssystem:unauthenticated requests that succeedTokenRequest APIOn managed clusters the audit log ships to the cloud logging plane (GKE →
Cloud Audit Logs, EKS → CloudWatch, AKS → Azure Monitor), which is where the
investigation joins up with the investigating-*-incidents skills.
create pods or secrets get in a namespace is namespace-admin in effect.
Enumerate capabilities, not titles.restricted and actually enforced, not merely warn. A baseline or
audit-only label stops almost none of the escape paths.get secrets has them.Fetch public advisories, specifications, and vendor reports as Markdown:
curl -sL "https://defuddle.md/<url>" # scheme in the path is optional
This strips page boilerplate — roughly 78% fewer tokens on a prose page — and returns the full text rather than a summary, so you can grep it and trust a negative result.
Three things it is not for. Fetch JSON and API responses raw, because readability extraction mangles structured data. Fetch authenticated or JavaScript-rendered pages directly, because it retrieves them anonymously. And never route adversary infrastructure (phishing links, C2, malware hosting), client-owned hosts, or engagement URLs through it — the request leaves your machine to a third party, and for live adversary infrastructure it also tips off the operator.
Some sites block the extractor and return an error blob rather than the page —
{"error":"Failed to fetch: 418 I'm a teapot"} from freedesktop.org, for
instance. That is the fetch being refused, not the source saying the thing
does not exist. Re-fetch the URL directly before drawing any conclusion from
it.
attacking-eks-gke-aks — the attack paths these controls closeexploiting-containers, escaping-hardened-containers — the escape
techniques Pod Security aims to preventhardening-cloud-posture — the cloud IAM plane around the clusterengineering-detections — turning the audit signals above into rulesinvestigating-aws-incidents / investigating-gcp-incidents — where a
managed-cluster audit trail leadsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub trilwu/secskills --plugin secskills-defense22 skills in this plugin
/analyzing-disk-imagesPerform dead-disk forensics on an acquired disk image using The Sleuth Kit, Plaso, and bulk_extractor — verify integrity and mount read-only, map partitions, recover deleted files, build a file-system and super-timeline, carve unallocated space, mine registry hives and OS artifacts, and detect anti-forensics. Use when handed a .E01/.dd/.raw/.vmdk/.vhdx disk image or forensic acquisition to examine, recovering deleted files, building a file-system timeline, or carving artifacts from unallocated space./analyzing-linux-persistenceSystematically identify and analyze persistence mechanisms on Linux systems during DFIR investigations -- sweep systemd units, cron jobs, shell initialization, SSH config, kernel modules, LD_PRELOAD, package manager hooks, udev rules, container entrypoints, and XDG autostart entries. Use when investigating a compromised Linux host, performing forensic analysis of a Linux disk image, looking for backdoors or unauthorized access mechanisms, or determining how an attacker maintained access./analyzing-malwareAnalyze suspected malware safely — containment, static triage, sandboxed detonation, unpacking, capability and C2 extraction, IOC production, and YARA rule authoring. Use when handed a suspicious file, hash, or sample, when triaging an alert artifact, or when producing detection content from a specimen.2 plugins ship this exact skill · first indexed Jul 31, 2026
Other plugins' skills for the same job