Back to skill

Security audit

truenas-aiops

Security checks for vulnerabilities and agentic risk

Overview

This skill matches its TrueNAS operations purpose, but it can perform real storage-changing actions without a built-in MCP read-only or approval gate.

Review before installing. Use a least-privilege TrueNAS API key, preferably read-only until you intentionally need writes. Do not expose write-capable MCP tools to untrusted or loosely supervised agents, and be especially careful with snapshot deletion because it is irreversible. Avoid long-lived plaintext API keys or master passwords in shell environments when possible.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
references/capabilities.md:37
Finding

Irreversible MCP Snapshot Deletion Lacks an Enforced Confirmation Gate

Content
View full analysis

Vulnerability Details

File Location: references/capabilities.md:37-44
Vulnerability Type: Destructive operation without server-enforced confirmation
Risk Level: High

Relevant excerpts:

markdown
## Write tools (6)

| Tool | Risk | REST (modelled) | Undo / safety |
|------|------|----------------|---------------|
| `pool_scrub_start` | medium | `POST /pool/scrub/run` | captures prior scan state; no undo (non-destructive); `dry_run` |
| `dataset_create` | medium | `POST /pool/dataset` | no undo (deletion out of scope); `dry_run` |
| `snapshot_create` | medium | `POST /zfs/snapshot` | records inverse `snapshot_delete` undo descriptor; `dry_run` |
| `snapshot_delete` | **high** | `DELETE /zfs/snapshot/id/{id}` | captures BEFORE state; IRREVERSIBLE, no undo; CLI double-confirm + `dry_run` |
| `service_restart` | medium | `POST /service/restart` | captures prior state; no undo; refuses a name absent from `service_list`, and refuses `ssh` without `confirm=True` (out-of-band recovery path); guards also fire under `dry_run`; CLI double-confirm |
| `undo_apply` | medium | governance store | executes a recorded inverse; itself governed; single-use; supports dry-run |

The absence of an authorization gate is further stated in SKILL.md:208-220:

markdown
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 account you connect it with (scope the TrueNAS API key to a
limited-privilege account and writes then fail at the appliance). There is no
read-only switch, policy file, or approval gate.

- Writes support `--dry-run` / `dry_run=True` and double confirmation at the CLI; CLI writes execute through the same governed tools, so they are audited + undo-recorded.

Technical Analysis

The Skill exposes snapshot_delete as an MCP write tool backed by an irreversible TrueNAS sna ...[truncated 2402 chars]

Remediation
View remediation

Remediation Suggestions

  • Enforce confirmation inside the MCP/server implementation rather than only in the CLI wrapper.
  • Make irreversible operations default to dry-run and require an explicit execution transition.
  • Have the dry-run response issue a short-lived, single-use confirmation token bound to the target, snapshot identifier, operation, authenticated caller, and previewed request.
  • Require that token for the subsequent deletion and reject direct deletion calls without it.
  • Add a configurable read-only mode and an operation allowlist enforced by the server for MCP and CLI entry points alike.
  • Require a separate high-risk approval control for irreversible operations, independent of optional audit annotations.
  • Preserve least privilege by instructing operators to use a TrueNAS API account that can access only the datasets and operations required for the current workflow.
  • Add tests proving that MCP calls cannot delete snapshots without completing the enforced preview and confirmation sequence.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (16)

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

The skill documents support for importing legacy plaintext API keys from a .env, which normalizes insecure credential handling and increases the risk of accidental disclosure through shell history, process environments, backups, or source control. In this skill's context, those credentials provide authenticated access to a TrueNAS appliance, potentially enabling sensitive read access and governed but real write actions such as snapshots, dataset creation, scrubs, and service restarts.

Content

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

md
truenas-aiops replication cloudsync
truenas-aiops secret set <target>                     # store API key encrypted
truenas-aiops secret list                             # names only
truenas-aiops secret migrate                          # import legacy plaintext .env
truenas-aiops secret rotate-password
truenas-aiops doctor
truenas-aiops mcp                                     # start MCP server (stdio)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

md
| `pool_scrub_start` | medium | `POST /pool/scrub/run` | captures prior scan state; no undo (non-destructive); `dry_run` |
| `dataset_create` | medium | `POST /pool/dataset` | no undo (deletion out of scope); `dry_run` |
| `snapshot_create` | medium | `POST /zfs/snapshot` | records inverse `snapshot_delete` undo descriptor; `dry_run` |
| `snapshot_delete` | **high** | `DELETE /zfs/snapshot/id/{id}` | captures BEFORE state; IRREVERSIBLE, no undo; CLI double-confirm + `dry_run` |
| `service_restart` | medium | `POST /service/restart` | captures prior state; no undo; refuses a name absent from `service_list`, and refuses `ssh` without `confirm=True` (out-of-band recovery path); guards also fire under `dry_run`; CLI double-confirm |
| `undo_apply` | medium | governance store | executes a recorded inverse; itself governed; single-use; supports dry-run |

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/cli-reference.md (reported line 10)May include surrounding context.

bash
truenas-aiops init                      # interactive onboarding wizard
truenas-aiops doctor [--skip-auth]      # config + secret store + connectivity (/system/info)
truenas-aiops mcp                       # start the MCP server (stdio transport)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

bash
truenas-aiops init                      # interactive onboarding wizard
truenas-aiops doctor [--skip-auth]      # config + secret store + connectivity (/system/info)
truenas-aiops mcp                       # start the MCP server (stdio transport)

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/cli-reference.md (reported line 20)May include surrounding context.

truenas-aiops secret set [--value ] # store API key (hidden prompt if no --value) truenas-aiops secret list # names only — values never shown truenas-aiops secret rm truenas-aiops secret migrate # import legacy plaintext .env (TRUENAS__APIKEY) truenas-aiops secret rotate-password # re-encrypt under a new master password

text

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
tags: [aiops, mcp, governance, truenas]
description: >
  Use this skill whenever the user needs to operate TrueNAS SCALE storage — a one-shot health overview, system info, read-only diagnostics / RCA (pool health, alerts & dataset capacity), inspect ZFS pools (list/get/status, capacity, scrub status, start a scrub), datasets (list/get/create), snapshots (list/create/delete), physical disks and S.M.A.R.T. self-test results, system alerts, services (list/restart), and replication / cloud-sync tasks.
  Always use this skill for "list truenas pools", "truenas dataset", "create zfs snapshot", "start a scrub", "diagnose truenas pool health", "why is my pool degraded", "truenas disk health", "truenas smart test", "truenas alerts", "restart truenas service", or "truenas replication" when the context is explicitly TrueNAS / TrueNAS SCALE / a ZFS NAS appliance.
  Do NOT use when the target is not a TrueNAS SCALE appliance — other NAS/storage products, backup software, hypervisor VM lifecycle, container clusters, and network devices are out of scope (negative routing hints only).
  Common TrueNAS SCALE operations with a built-in governance harness (audit, policy, token budget, undo, risk-tiers). Live-verified against real TrueNAS SCALE 25.04 and 26 appliances over both transports; see docs/VERIFICATION.md for what is and is not covered.
installer:

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description frames the skill as operating TrueNAS storage via health checks, diagnostics, and selected storage/service actions, but the same skill documentation also exposes credential-management functions including onboarding, setting, migrating, and rotating encrypted API-key secrets. Secret store administration is a materially different capability from the listed TrueNAS operational tasks and is not reflected in the primary description.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
truenas-aiops pool scrub-start <pool_name>
truenas-aiops dataset list
truenas-aiops dataset get <dataset_id>                # e.g. tank/data
truenas-aiops dataset create <tank/path> [--dry-run]
truenas-aiops snapshot list [--dataset tank/data] [--limit 200]
truenas-aiops snapshot create <dataset> <name>
truenas-aiops snapshot delete <dataset@name> [--dry-run]   # double confirm, IRREVERSIBLE

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
96% confidence
Finding

The document explicitly states that the tool does not enforce read-only mode or approval for write actions, delegating safety entirely to external account permissions or the model prompt. In an agent setting, prompts are not reliable security boundaries, so a misaligned or compromised agent could invoke destructive operations such as snapshot deletion, service restart, dataset creation, or scrub initiation whenever the connected credentials permit it.

Content

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

md
## 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 does
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 account you connect with.** Scope the TrueNAS API key to a

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · references/cli-reference.md (reported line 10)May include surrounding context.

bash
truenas-aiops init                      # interactive onboarding wizard
truenas-aiops doctor [--skip-auth]      # config + secret store + connectivity (/system/info)
truenas-aiops mcp                       # start the MCP server (stdio transport)

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

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

bash
truenas-aiops init                      # interactive onboarding wizard
truenas-aiops doctor [--skip-auth]      # config + secret store + connectivity (/system/info)
truenas-aiops mcp                       # start the MCP server (stdio transport)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

uv tool install truenas-aiops

text

## 2. Create a TrueNAS API key

In the TrueNAS SCALE web UI: **Credentials → API Keys → Add**. Copy the key
(shown once). truenas-aiops sends it as `Authorization: Bearer <key>` against the

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide explicitly recommends exporting the master password in an environment variable for unattended use. Environment variables are commonly exposed through shell history, process inspection, CI logs, crash dumps, inherited subprocess environments, or misconfigured telemetry, so this weakens protection of the encrypted secret store.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
- The API key is **never** written to disk in plaintext. It lives only in
  `~/.truenas-aiops/secrets.enc`, encrypted with Fernet (AES-128-CBC + HMAC),
  the key derived from your master password via scrypt. Only a per-store random
  salt and the ciphertext are on disk (chmod 600); the master password itself is
  never stored.
- A legacy plaintext env var `TRUENAS_<TARGET_NAME_UPPER>_APIKEY` is still
  honoured as a fallback with a deprecation warning — migrate with

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
- The API key is **never** written to disk in plaintext. It lives only in
  `~/.truenas-aiops/secrets.enc`, encrypted with Fernet (AES-128-CBC + HMAC),
  the key derived from your master password via scrypt. Only a per-store random
  salt and the ciphertext are on disk (chmod 600); the master password itself is
  never stored.
- A legacy plaintext env var `TRUENAS_<TARGET_NAME_UPPER>_APIKEY` is still
  honoured as a fallback with a deprecation warning — migrate with

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The top-level description enumerates TrueNAS operational areas such as pools, datasets, snapshots, services, and replication, but later documentation lists undo_list and undo_apply as MCP tools. Those governance-state manipulation tools act on the local harness rather than directly on TrueNAS storage operations, so the documented behavior exceeds the manifest's stated operational scope.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.