Back to skill

Security audit

Dreaming

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent and disclosed, but its local state configuration can be abused to execute arbitrary Python code if the state file is modified.

Install only if you want an opt-in heartbeat routine that writes reflective notes to the workspace. Before enabling it, fix or constrain dreamChance handling, keep data/dream-state.json writable only by trusted components, and avoid letting the agent store sensitive private or client information in dream files.

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
scripts/should-dream.sh:87
Finding

Arbitrary Python Code Execution Through Unsanitized dreamChance Configuration

Content
View full analysis
/dev/null || echo "1") ``` ### Technical Analysis The script reads `dreamChance` from the workspace-controlled `data/dream-state.json` file using `jq -r`. The resulting value is then interpolated directly into source code supplied to `python3 -c`. Shell quoting does not make this safe because the untrusted value is being inserted into Python program text rather than passed as data. An attacker who can alter the state file can set `dreamChance` to a string containing valid Python syntax that changes the conditional expression and invokes functions such as `__import__`. Python then interprets the injected content as executable code. The script does not verify that `dreamChance` is a JSON number, reject non-finite values, enforce the documented range of zero through one, or pass the value through a non-code channel. The fallback `|| echo "1"` also causes malformed or failed probability checks to be treated as successful dream decisions. Although this behavior do ...[truncated 1791 chars]
Remediation
View remediation
&2 exit 1 fi ``` 2. Validate the JSON type with `jq` before using the field: ```bash if ! jq -e '.dreamChance == null or (.dreamChance | type == "number")' \ "$STATE_FILE" >/dev/null; then echo "Error: dreamChance must be a JSON number" >&2 exit 1 fi ``` 3. Enforce the documented range `0.0 <= dreamChance <= 1.0` and reject malformed, infinite, or non-numeric input. 4. Fail closed when probability processing fails. Remove the `|| echo "1"` fallback, which currently treats Python errors as approval to continue. 5. Harden the state file against unauthorized modification by using restrictive directory and file permissions appropriate to the execution environment. 6. Apply equivalent strict validation to `dreamsTonight` and `maxDreamsPerNight` before using them in shell arithmetic or numeric comparisons. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

The code is related to the declared theme of quiet-hour dreaming, but it does not actually perform the main described function. The description emphasizes turning idle time into freeform thinking and producing written outputs for later review. This script only determines whether a dream should happen, chooses a prompt category/topic, and updates bookkeeping state. Its file access is limited to config/state JSON, not dream content output. That is a material description-to-behavior mismatch in primary capability, even though the quiet-hours scheduling aspect is consistent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The activation guidance is broad enough that an agent may invoke the skill during loosely defined 'quiet hours' without a narrowly scoped user request or policy guardrails. In autonomous systems, vague invocation criteria can expand the skill's operating window, causing unnecessary state changes and file creation, and increasing the chance of unintended behavior in environments where background actions should be tightly controlled.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill instructs the agent to autonomously append reflective content to persistent files under memory/dreams without a prominent warning that data will be stored for later human review. This creates a real privacy and governance risk: agents may persist sensitive inferences, internal context, or speculative content to disk without informed user consent or retention controls.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.