Back to skill

Security audit

k8s-aiops

Security checks for vulnerabilities and agentic risk

Overview

This Kubernetes management skill needs review because its agent interface can delete workloads and disrupt nodes using existing cluster permissions without its own approval check.

Start with a dedicated read-only Kubernetes account restricted to the intended cluster and namespaces. Before enabling writes, configure your agent client to require approval for destructive calls; this skill's MCP interface does not provide that check. Preview changes, remember deletions cannot be undone, and pin a reviewed package version. The verdict follows the documented authority and controls, not SkillSpector's score; its report was marked incomplete.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (45)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 10)May include surrounding context.

md
ts, statefulsets, daemonsets, replicasets, jobs, cronjobs, services, ingresses, endpoints, configmaps, secrets (names/keys only), PVCs/PVs/storageclasses, nodes, namespaces, and events; read pod logs; describe pods/nodes; pod/node top (metrics); read-only diagnostics / RCA (pod-health, workload-readiness); scale deployments/statefulsets; rollout status/history/undo/pause/resume and set image; delete pods/deployments/jobs; create/delete namespaces; and cordon/uncordon/drain nodes. Works with any kubeconfig-reachable cluster (standard Kubernetes, k3s, EKS, GKE, AKS).
  Always use this skill for "list k8s pods", "scale deployment", "kubernetes pod logs", "describe pod", "why is my pod crashing", "diagnose pods", "which deployments are unhealthy", "rollout undo", "set image", "top pods", "drain node", "cordon node", "restart deployment", "k3s", or "kubectl"-style tasks when the context is explicitly Kubernetes / a cluster.
  Do NOT use when the target is not a Kubernetes cluster (hyperviso

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 37)May include surrounding context.

md
filiated with, endorsed by, or sponsored by the Cloud Native Computing Foundation, the Kubernetes project, or k3s/Rancher.** "Kubernetes" and "k3s" are trademarks of their respective owners. Source code is publicly auditable at [github.com/AIops-tools/K8s-AIops](https://github.com/AIops-tools/K8s-AIops) under the MIT license.

Governed Kubernetes operations — **55 MCP tools**, every one wrapped with the bundled `@governed_tool` harness: a local unified audit log under `~/.k8s-aiops/`, a token/runaway budget guard, undo-token recording, and a descriptive risk-tier label on every audit row. Works with any kubeconfig-reachable cluster (standard Kubernetes, k3s, EKS, GKE, AKS). Run `k8s-aiops init` for a friendly onboarding wizard that registers your kube contexts as named targets.

> **Standalone**: the governance harness is bundled in the package (`k8s_aiops.governance`) — k8s-aiops has no external skill-family dependency. Coverage focuses on common operations and is not yet exhaustive.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 121)May include surrounding context.

md
1. `k8s-aiops node list` → identify the node and confirm it is `Ready`/schedulable
2. `k8s-aiops node cordon <node> --dry-run` → preview, then `k8s-aiops node cordon <node>` (double confirm) — records an inverse `uncordon_node` undo descriptor
3. After maintenance: `k8s-aiops node uncordon <node>` → re-enable scheduling
4. **Failure branch**: if `doctor` shows the cluster unreachable, fix the kubeconfig context (`kubectl config get-contexts`) before retrying — cordon is never issued against an unauthenticated session.

## Usage Mode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 134)May include surrounding context.

md
> **MCP environment caveat**: MCP clients spawn the server with a CLEAN
> environment — shell exports may not reach it. Set `K8S_AIOPS_HOME`,
> `K8S_AUDIT_APPROVED_BY`, `K8S_AUDIT_RATIONALE` (and `KUBECONFIG` when the
> kubeconfig is not at `~/.kube/config`) in the MCP server config's `env`
> block, not just in your terminal.

## MCP Tools (55 — 39 read, 16 write)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 213)May include surrounding context.

md
## Troubleshooting

### "Could not load kubeconfig … context not found"
The named context does not exist in your kubeconfig. Run `kubectl config get-contexts` and set the target's `context:` to a listed name (or omit it to use current-context).

### "Authentication/authorization failed (401/403)"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/agent-guardrails.md (reported line 18)May include surrounding context.

md
not gate it — there is no read-only switch and no approval prompt to configure.
The two right places to control read vs write:

- **The kubeconfig context you connect with.** Bind it to a ServiceAccount or
  user whose RBAC grants only `get`/`list`/`watch`, and every write fails at the
  apiserver — the only place the permission actually lives. No skill-side flag
  can be argued around by a model, but a revoked RBAC verb cannot be. This is

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/agent-guardrails.md (reported line 84)May include surrounding context.

md
## Recommended setup for a local model

Start with a kubeconfig context that *cannot* write — a ServiceAccount whose
RBAC grants only `get`/`list`/`watch` — verify, and widen its permission only
when you trust the setup. RBAC is enforced at the apiserver, so a write fails at
the cluster no matter what the model attempts:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/agent-guardrails.md (reported line 111)May include surrounding context.

md
namespace in your prompt (or in the target's `namespace:` in
  `~/.k8s-aiops/config.yaml`) and ask the model to restate it in every answer.
- **Context confusion is the expensive one.** `target` selects a *cluster*, not a
  namespace. If you have prod and staging contexts in the same kubeconfig, give
  the agent a config with only the cluster it should touch — the model has no way
  to notice it is on the wrong one, because both look plausible.
- **Authentication is delegated to your kubeconfig.** Unlike the other tools in

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/agent-guardrails.md (reported line 118)May include surrounding context.

md
this line, k8s-aiops has **no credential store**: there is nothing to encrypt
  and no master password. (`k8s-aiops secret ...` lists Kubernetes *Secret
  resources* by name — it is not a credential manager.) The agent inherits the RBAC of the
  kubeconfig user. That makes RBAC your strongest guardrail — a read-only
  ServiceAccount kubeconfig enforces read-only at the *cluster*, the only place
  the permission truly lives.
- **`drain_node` is the most dangerous tool here.** It evicts pods cluster-wide

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/agent-guardrails.md (reported line 119)May include surrounding context.

md
and no master password. (`k8s-aiops secret ...` lists Kubernetes *Secret
  resources* by name — it is not a credential manager.) The agent inherits the RBAC of the
  kubeconfig user. That makes RBAC your strongest guardrail — a read-only
  ServiceAccount kubeconfig enforces read-only at the *cluster*, the only place
  the permission truly lives.
- **`drain_node` is the most dangerous tool here.** It evicts pods cluster-wide
  in effect, and its blast radius is not visible in its arguments. Keep it out of

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup-guide.md (reported line 19)May include surrounding context.

md
## Connecting to a cluster

k8s-aiops reads your **kubeconfig** — the same one `kubectl` uses
(`KUBECONFIG` env var, else `~/.kube/config`). Out of the box it talks to your
current kube-context, so a fresh install needs no config file:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup-guide.md (reported line 43)May include surrounding context.

  • name: prod context: prod-eks # a context from kubectl config get-contexts namespace: default # optional default namespace

    kubeconfig: /path/to/kubeconfig # optional, overrides KUBECONFIG/~/.kube/config

    • name: lab context: k3s-lab
text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup-guide.md (reported line 43)May include surrounding context.

  • name: prod context: prod-eks # a context from kubectl config get-contexts namespace: default # optional default namespace

    kubeconfig: /path/to/kubeconfig # optional, overrides KUBECONFIG/~/.kube/config

    • name: lab context: k3s-lab
text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup-guide.md (reported line 54)May include surrounding context.

k8s-aiops -t prod pod list -n payments

text

No secrets are stored here — authentication lives entirely in the kubeconfig.

### Works with

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 20)May include surrounding context.

md
argument-hint: "[resource name or describe your Kubernetes task]"
allowed-tools:
  - Bash
metadata: {"openclaw":{"requires":{"anyBins":["k8s-aiops","uvx"]},"optional":{"env":["K8S_AIOPS_CONFIG","KUBECONFIG","K8S_AIOPS_HOME"]},"homepage":"https://github.com/AIops-tools/K8s-AIops","emoji":"☸️","os":["macos","linux"]}}
compatibility: >
  Standalone, self-governed Kubernetes operations. The governance harness (audit, token/runaway budget, undo, risk-tier labels) is bundled in the package — no external skill-family dependency.
  All write operations are audited to a local SQLite DB under ~/.k8s-aiops/ (relocatable via K8S_AIOPS_HOME).

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 133)May include surrounding context.

md
> **MCP environment caveat**: MCP clients spawn the server with a CLEAN
> environment — shell exports may not reach it. Set `K8S_AIOPS_HOME`,
> `K8S_AUDIT_APPROVED_BY`, `K8S_AUDIT_RATIONALE` (and `KUBECONFIG` when the
> kubeconfig is not at `~/.kube/config`) in the MCP server config's `env`
> block, not just in your terminal.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup-guide.md (reported line 20)May include surrounding context.

Connecting to a cluster

k8s-aiops reads your kubeconfig — the same one kubectl uses (KUBECONFIG env var, else ~/.kube/config). Out of the box it talks to your current kube-context, so a fresh install needs no config file:

bash

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup-guide.md (reported line 43)May include surrounding context.

  • name: prod context: prod-eks # a context from kubectl config get-contexts namespace: default # optional default namespace

    kubeconfig: /path/to/kubeconfig # optional, overrides KUBECONFIG/~/.kube/config

    • name: lab context: k3s-lab
text

Credential Access

High
Category
Privilege Escalation
Confidence
80% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 24)May include surrounding context.

md
compatibility: >
  Standalone, self-governed Kubernetes operations. The governance harness (audit, token/runaway budget, undo, risk-tier labels) is bundled in the package — no external skill-family dependency.
  All write operations are audited to a local SQLite DB under ~/.k8s-aiops/ (relocatable via K8S_AIOPS_HOME).
  Credentials: k8s-aiops handles NO credentials directly — authentication is delegated to the kubeconfig (KUBECONFIG env or ~/.kube/config), which may hold client certs, bearer tokens, or exec plugins (EKS/GKE/AKS). Underlying credentials are never read, logged, or echoed. The state dir ~/.k8s-aiops should be chmod 700.
  Destructive operations (deployment/job/namespace delete, node cordon/drain, rollout undo) require double confirmation at the CLI layer and support --dry-run. All write tools pass through the @governed_tool decorator (budget/runaway guard + audit + a descriptive risk-tier label). Reversible writes record an inverse undo descriptor (scale_deployment/scale_

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 24)May include surrounding context.

md
compatibility: >
  Standalone, self-governed Kubernetes operations. The governance harness (audit, token/runaway budget, undo, risk-tier labels) is bundled in the package — no external skill-family dependency.
  All write operations are audited to a local SQLite DB under ~/.k8s-aiops/ (relocatable via K8S_AIOPS_HOME).
  Credentials: k8s-aiops handles NO credentials directly — authentication is delegated to the kubeconfig (KUBECONFIG env or ~/.kube/config), which may hold client certs, bearer tokens, or exec plugins (EKS/GKE/AKS). Underlying credentials are never read, logged, or echoed. The state dir ~/.k8s-aiops should be chmod 700.
  Destructive operations (deployment/job/namespace delete, node cordon/drain, rollout undo) require double confirmation at the CLI layer and support --dry-run. All write tools pass through the @governed_tool decorator (budget/runaway guard + audit + a descriptive risk-tier label). Reversible writes record an inverse undo descriptor (scale_deployment/scale_

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 27)May include surrounding context.

md
) require double confirmation at the CLI layer and support --dry-run. All write tools pass through the @governed_tool decorator (budget/runaway guard + audit + a descriptive risk-tier label). Reversible writes record an inverse undo descriptor (scale_deployment/scale_statefulset restore the previous replica count; set_deployment_image restores the previous image; cordon_node ↔ uncordon_node and rollout_pause ↔ rollout_resume; create_namespace ↔ delete_namespace); delete_* and rollout_undo record none. risk_level=high: delete_deployment, delete_job, delete_namespace, drain_node, rollout_undo_deployment. Secret VALUES are never read or returned by any tool.
  Webhooks: none — no outbound network calls beyond the configured Kubernetes API server.
  TLS: follows the kubeconfig (certificate-authority / insecure-skip-tls-verify); the skill does not weaken it.
  Transitive dependencies: the official kubernetes Python client and the MCP SDK. No post-install scripts or background services.
---

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 214)May include surrounding context.

md
## Troubleshooting

### "Could not load kubeconfig … context not found"
The named context does not exist in your kubeconfig. Run `kubectl config get-contexts` and set the target's `context:` to a listed name (or omit it to use current-context).

### "Authentication/authorization failed (401/403)"
The kube context lacks the RBAC verb for the resource. Check with `kubectl auth can-i <verb> <resource> -n <ns>` and switch to a context/ServiceAccount with adequate roles. For EKS/GKE/AKS, confirm the exec-plugin (aws/gcloud/az CLI) is installed and logged in.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/agent-guardrails.md (reported line 114)May include surrounding context.

md
namespace. If you have prod and staging contexts in the same kubeconfig, give
  the agent a config with only the cluster it should touch — the model has no way
  to notice it is on the wrong one, because both look plausible.
- **Authentication is delegated to your kubeconfig.** Unlike the other tools in
  this line, k8s-aiops has **no credential store**: there is nothing to encrypt
  and no master password. (`k8s-aiops secret ...` lists Kubernetes *Secret
  resources* by name — it is not a credential manager.) The agent inherits the RBAC of the

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/capabilities.md (reported line 86)May include surrounding context.

md
## Design notes / Kubernetes-client assumptions

- Authentication is delegated to the kubeconfig; the skill never touches raw
  credentials (works with client certs, tokens, and EKS/GKE/AKS exec plugins).
- Typed Api clients (`CoreV1Api`, `AppsV1Api`, `BatchV1Api`, `NetworkingV1Api`,
  `StorageV1Api`, `CustomObjectsApi`, `ApisApi`, `VersionApi`) are cached per kube

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/setup-guide.md (reported line 30)May include surrounding context.

Named targets (multiple clusters)

The fastest way is the interactive wizard, which discovers the contexts in your kubeconfig and registers the ones you pick (writing config.yaml, dir chmod 700):

bash
k8s-aiops init