T09 · Insecure Skill Coding Practices
- Location
SKILL.md:158- Finding
Destructive Kubernetes Pod Deletion Without Adequate Safety Controls
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 158-159
Vulnerability Type: Unsafe destructive operation against the active Kubernetes environment
Risk Level: HighVulnerable Code:
bash POD=$(kubectl get pods -l app=payment-service -o jsonpath='{.items[0].metadata.name}') kubectl delete pod "$POD" --grace-period=0Technical Analysis
The example script selects the first pod matching
app=payment-serviceand immediately deletes it with a zero-second grace period. It operates against the user's active Kubernetes context and default namespace without requiring an explicit cluster, context, namespace, or approved environment.The script does not verify that the target belongs to a test environment, confirm that sufficient healthy replicas remain, perform a dry run, request operator approval, or enforce the abort conditions shown in the preceding declarative example. The zero-second grace period can prevent orderly shutdown behavior and increase the likelihood of interrupted requests or incomplete application-level operations.
Attack Path
- A user or Agent has Kubernetes credentials and an active context.
- The active context points to a production or otherwise sensitive cluster.
- The default namespace contains one or more pods with the label
app=payment-service. - The generated script retrieves the first matching pod without validating its ownership, environment, health, or replica availability.
- The script force-deletes that pod with no grace period.
- If redundancy, rescheduling, disruption controls, or application shutdown handling are inadequate, the deletion causes degraded service, interrupted processing, or an outage.
Impact Assessment
The operation uses the Kubernetes deletion privileges of the invoking identity. It does not independently escalate privileges, but it can exercise already granted pod-deletion permissions against an unintended cluster or name ...[truncated 363 chars]
- Remediation
View remediation
Remediation Suggestions
- Require explicit cluster context, namespace, workload label, and environment parameters.
- Reject production targets by default and require a separate, explicit production authorization workflow.
- Validate the active context and namespace against an allowlist before performing any mutation.
- Confirm that the target is controlled by an appropriate workload controller and that enough healthy replicas will remain.
- Add a dry-run mode and display the exact target before requesting interactive operator approval.
- Use a nonzero grace period unless abrupt termination is an explicitly approved property of the experiment.
- Enforce PodDisruptionBudgets and experiment-specific least-privilege RBAC.
- Implement executable abort monitoring, maximum experiment duration, and a tested rollback procedure rather than documenting those controls only in a separate example.
- Record the selected resource UID, cluster, namespace, start time, and operator authorization for auditability.
