Back to skill

Security audit

mar-dreaming

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent, but its helper script has an unsafe state-file value that can become executable Python code.

Install only if you are comfortable with quiet-hours journal-like files being written under memory/dreams, and treat data/dream-state.json as trusted until the dreamChance parsing bug is fixed. Do not let untrusted users or automation modify the skill's data directory.

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:97
Finding

Arbitrary Python Code Injection Through Unvalidated dreamChance State Value

Content
View full analysis
/dev/null || echo "1") ``` ### Technical Analysis The `dreamChance` property is extracted from `data/dream-state.json` using `jq -r` without validating its JSON type, numeric range, or syntax. Its resulting text is then directly interpolated into the source code supplied to `python3 -c`. Because the value becomes part of executable Python source rather than being passed as data, a crafted `dreamChance` value can terminate or alter the expected expression and introduce attacker-selected Python operations. This creates an arbitrary code-execution primitive whenever the script reaches the probability check. The fallback behavior `|| echo "1"` also fails open. If Python encounters an error, the script treats the roll as successful, although this fallback is secondary to the direct code-injection risk. Exploitation requires the attacker to modify `data/dream-state.json` or otherwise control the state file resolved through `WORKSPACE`. ### Attack Path 1. An attacker obtains write ...[truncated 1426 chars]
Remediation
View remediation
= 0 and . <= 1) ' "$STATE_FILE"); then echo "Error: dreamChance must be a number between 0 and 1" >&2 exit 1 fi if ! ROLL=$(python3 - "$DREAM_CHANCE" <<'PY' import random import sys try: chance = float(sys.argv[1]) except (ValueError, IndexError): raise SystemExit(1) if not 0.0 <= chance <= 1.0: raise SystemExit(1) print(1 if random.random() < chance else 0) PY ); then echo "Error: unable to calculate dream probability" >&2 exit 1 fi ``` This approach treats the state value as input data, validates its permitted range, and prevents it from changing the Python program being executed. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill description is broad enough to invite activation during generic 'quiet' or idle periods, which can cause the agent to perform discretionary work without a narrowly scoped trigger or explicit user intent. In this skill, that discretionary work includes generating persistent written output, increasing the chance of unnecessary file creation, privacy-sensitive reflections, or operational drift.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The markdown instructs the agent to write exploratory content to persistent files but does not require a clear user-facing warning that the output will be stored for later review. Because the content is freeform and reflective, it may capture sensitive context, internal reasoning-like material, or speculative statements that users did not expect to retain.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.