T09 · Insecure Skill Coding Practices
- Location
SKILL.md:193- Finding
Destructive MCP model removal lacks an enforced authorization gate
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:193-204; corroborated byreferences/capabilities.md:37-45andreferences/agent-guardrails.md:18-29
Vulnerability Type: Destructive operation without enforced authorization or confirmation
Risk Level: MediumEvidence
SKILL.md:193-204:text The skill delivers reads and writes and records them; it does **not** decide whether a write is permitted. That is your agent's judgement, or the permission of the host and account you run it under (point it at a runtime the account cannot administer, or hand the agent only the scan/observe tools). There is no read-only switch, deny-rules file, or approval gate — content governance (the model allow/deny policy and the `guarded_generate` block threshold) is a separate, product-level control that stays. - **Audit is the guarantee, and it is not bypassable.** Every operation — MCP and CLI alike — is logged to `~/.ai-guardian/audit.db` (relocatable via `AI_GUARDIAN_AIOPS_HOME`): params, result, status, duration, and the risk tier. Observed local-LLM usage lives in a **separate** `~/.ai-guardian/usage.db`. - `AI_GUARDIAN_AUDIT_APPROVED_BY` / `AI_GUARDIAN_AUDIT_RATIONALE` are optional annotations recorded on the audit row (who/why); they are never required and never block.references/capabilities.md:37-45:text ## Write tools (8) | Tool | Risk | Ollama endpoint / effect | Undo / safety | |------|------|--------------------------|---------------| | `pull_model` | medium | `POST /api/pull` | **refused if it violates the deny/allow policy** | | `remove_model` | **high** | `DELETE /api/delete` | captures the model manifest; records an undo (`pull_model` re-pull); CLI `--dry-run` + double confirm |references/agent-guardrails.md:18-29:text ## Authorization is not this tool's job — decide it where it belongs Whether a write should happen is your decision, or the account's. The tool ...[truncated 3163 chars]- Remediation
View remediation
Remediation Suggestions
- Enforce authorization in the MCP execution path for
remove_model, rather than relying solely on agent judgment or system-prompt instructions. - Require a short-lived, operation-bound approval token that includes the target runtime, exact model name, approving user, and expiration time.
- Add a read-only operating mode and make it the default for MCP sessions. Destructive tools should be unavailable unless explicitly enabled by the user or administrator.
- Implement an MCP dry-run that returns the exact target and planned API request, then require a separate confirmed call tied cryptographically or through server-side state to that preview.
- Apply the same double-confirmation guarantee documented for the CLI to all entry points, including MCP.
- Keep audit annotations, but do not treat them as authorization. Require verified approval independently of audit metadata.
- Permit administrators to configure deny rules for destructive tools and per-target access controls.
- Where practical, use runtime credentials restricted to inventory and observation operations, and grant model-administration privileges only for explicitly approved maintenance sessions.
- Enforce authorization in the MCP execution path for
