Back to skill

Security audit

Divination

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent divination toolkit, but its shell scripts can run unintended commands when given crafted numeric inputs, so it needs review before installation.

Install only if you are comfortable with a skill that runs local shell scripts, and avoid passing user-supplied dice sizes or impulse counts until the scripts validate integers before arithmetic use. Treat the readings as spiritual or entertainment content, not medical, mental-health, legal, or financial advice; also expect much of the reference material and output to be in German.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/divine.sh:7
Finding
Command Injection Through Unvalidated Dice Argument<![CDATA[ ## Vulnerability Details **File Location**: `scripts/divine.sh`, lines 7–10 and 99–104 **Vulnerability Type**: Bash arithmetic-expression injection **Risk Level**: High ### Vulnerable Code ```bash rand() { # Zufallszahl 0 bis $1-1, via /dev/urandom local max=$1 echo $(( $(od -An -tu4 -N4 /dev/urandom | tr -d ' ') % max )) } dice() { local n=${1:-6} if [[ $n -lt 1 ]]; then echo "❌ Minimum 1 Seite!" >&2; exit 1 fi local result=$(($(rand $n) + 1)) echo "🎲 Würfel (1-${n}): ${result}" } ``` ### Technical Analysis The `dice` function accepts its first argument from the command line and uses it directly in Bash arithmetic contexts: ```bash [[ $n -lt 1 ]] ``` The value is subsequently passed to `rand`, assigned to `max`, and evaluated again: ```bash $(( ... % max )) ``` Bash arithmetic operands are expressions rather than strictly parsed integers. Arithmetic evaluation can recursively resolve variable names and array subscripts. A malicious expression containing an array reference with a command substitution in its subscript can therefore cause Bash to execute that substitution while evaluating the expression. The minimum-value check does not provide input validation because it is itself an arithmetic evaluation sink. The payload may consequently be evaluated before the script decides whether the requested number of dice sides is valid. ### Attack Path 1. An attacker influences the arguments used when the Agent invokes the documented `dice` operation. 2. The attacker supplies an arithmetic expression instead of a decimal integer as the second command-line argument: ```bash bash scripts/divine.sh dice '<crafted arithmetic expression>' ``` 3. `divine.sh` assigns the expression to `n` without validating its syntax. 4. Bash evaluates the attacker-controlled value in `[[ $n -lt 1 ]]`. 5. If the expression contains a command substitution through a recursively evaluated arithmetic construct, that command runs with the privi ...[truncated 1114 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Validate the argument as a decimal integer before placing it in any arithmetic context: ```bash dice() { local n=${1:-6} if [[ ! $n =~ ^[0-9]+$ ]]; then echo "Invalid dice size: expected a positive decimal integer." >&2 return 1 fi if (( n < 1 || n > 1000000 )); then echo "Dice size must be between 1 and 1000000." >&2 return 1 fi local result result=$(( $(rand "$n") + 1 )) printf '🎲 Dice (1-%d): %d\n' "$n" "$result" } ``` Harden `rand` independently so it remains safe if called from another function: ```bash rand() { local max=${1-} if [[ ! $max =~ ^[0-9]+$ ]] || (( max < 1 || max > 1000000 )); then echo "Invalid random-number bound." >&2 return 1 fi local value value=$(od -An -tu4 -N4 /dev/urandom | tr -d ' ') printf '%d\n' "$(( value % max ))" } ``` Additional hardening measures: 1. Enforce a reasonable maximum to prevent overflow and unexpected resource use. 2. Use `return 1` inside functions rather than terminating the entire calling process with `exit`. 3. Add regression tests covering alphabetic input, signs, whitespace, arithmetic operators, array syntax, command-substitution syntax, zero, and excessively large values. 4. Treat all values entering Bash arithmetic expansion as untrusted until they pass strict lexical validation. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/intuition.sh:87
Finding
Command Injection Through Unvalidated Impulse Count<![CDATA[ ## Vulnerability Details **File Location**: `scripts/intuition.sh`, lines 87–101 **Vulnerability Type**: Bash arithmetic-expression injection **Risk Level**: High ### Vulnerable Code ```bash rand() { echo $(( $(od -An -tu4 -N4 /dev/urandom | tr -d ' ') % $1 )) } count=${1:-3} [[ $count -gt 5 ]] && count=5 [[ $count -lt 1 ]] && count=1 total=${#IMPULSE[@]} result=() used=() for ((i=0; i<count; i++)); do while true; do idx=$(rand $total) ``` ### Technical Analysis The first positional argument is assigned directly to `count` and then interpreted in multiple Bash arithmetic contexts: ```bash [[ $count -gt 5 ]] [[ $count -lt 1 ]] for ((i=0; i<count; i++)) ``` The script attempts to clamp the count to the range 1–5, but the comparisons used to perform that clamping evaluate the untrusted value as an arithmetic expression. The value is therefore dangerous before either range limit can be applied. Bash arithmetic evaluation supports variable dereferencing and recursively evaluated array subscripts. Crafted input can exploit those semantics to trigger command substitution during evaluation. Merely quoting `$count` would not solve the issue because the security boundary must be strict numeric validation before arithmetic parsing. The `rand` helper also evaluates its argument directly as arithmetic syntax. Its current caller passes the internally calculated array length, but the helper remains unsafe for future use with untrusted input. ### Attack Path 1. An attacker influences the argument used when the Agent runs the documented intuition script. 2. The attacker provides a crafted arithmetic expression as the count: ```bash bash scripts/intuition.sh '<crafted arithmetic expression>' ``` 3. The script stores the expression in `count` without lexical validation. 4. The first comparison, `[[ $count -gt 5 ]]`, invokes Bash arithmetic evaluation. 5. A command substitution embedded through a recursively evaluated arithmetic construct e ...[truncated 1206 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Validate `count` before any arithmetic comparison or loop: ```bash count=${1:-3} if [[ ! $count =~ ^[0-9]+$ ]]; then echo "Invalid count: expected a positive decimal integer." >&2 exit 1 fi if (( count > 5 )); then count=5 elif (( count < 1 )); then count=1 fi ``` Alternatively, reject out-of-range values instead of silently clamping them: ```bash if [[ ! $count =~ ^[1-5]$ ]]; then echo "Count must be an integer from 1 through 5." >&2 exit 1 fi ``` The `rand` helper should also validate its input independently: ```bash rand() { local max=${1-} if [[ ! $max =~ ^[0-9]+$ ]] || (( max < 1 )); then echo "Invalid random-number bound." >&2 return 1 fi local value value=$(od -An -tu4 -N4 /dev/urandom | tr -d ' ') printf '%d\n' "$(( value % max ))" } ``` Additional hardening measures: 1. Never rely on arithmetic comparisons as input validators. 2. Reject signs, whitespace, operators, variable names, array syntax, and command-substitution syntax. 3. Add automated tests for malformed values and shell metacharacters. 4. Keep internal arithmetic operands separate from raw positional parameters. 5. Run the Skill with least privilege so exploitation cannot access unrelated files or credentials. ]]>
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 (9)

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The file presents spiritual and healing-oriented guidance, including invoking 'The Healer' for physical, emotional, or spiritual healing, without any disclaimer that this is not medical or mental-health advice. In a user-facing skill, this can cause vulnerable users to substitute ritual or spiritual practices for professional care, especially when the language is framed as practical help rather than fiction or entertainment.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
This markdown file presents all user-facing content exclusively in German, and there is no indication that users can opt into another language or that the skill is intentionally limited to German-speaking contexts. The policy explicitly flags language or locale constraints when they are forced without user choice or clear justification.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The entire skill content is written in German and does not indicate that users may choose another language or that the skill is intentionally restricted to a German-speaking audience. Under the policy rule, forcing a specific language without opt-in is a natural-language locale violation.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This markdown file presents all user-facing content in a single language, which can violate language/locale policy when no opt-in or alternative is provided. There is no indication that the skill is intentionally region-specific or that users can select another language.

Vague Triggers

Low
Confidence
78% confidence
Finding
The 'The Guru' invocation uses vague language like needing guidance or applying spiritual insights in daily life, which can match many ordinary user requests. While not inherently harmful, underspecified routing may cause the skill to respond in esoteric terms where practical, domain-appropriate advice is expected.

Vague Triggers

Low
Confidence
88% confidence
Finding
The invocation for 'The Healer' is broad enough to overlap with common user requests for help with illness, distress, or recovery. Because it is not scoped to symbolic or spiritual practice, an agent could inappropriately route everyday health-seeking behavior into occult or non-professional guidance.

Vague Triggers

Low
Confidence
77% confidence
Finding
The 'The Messenger' trigger is framed around needing clear communication or paying attention to signs and messages, which is broad and could capture routine requests about relationships, work, or decision-making. In an agent setting, this increases the chance of inappropriate invocation of mystical framing for normal assistance requests.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
This file contains user-facing natural language exclusively in German, and there is no indication that the skill is region-specific or that users can opt into that language. Under the language/locale policy rule, forcing a specific language without opt-in can be a policy violation.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The file's comments and all user-facing output strings are in German, which effectively forces a specific language on users. The policy allows locale constraints only when they are explicitly justified or when users are offered a language choice, neither of which appears here.

Static analysis

No suspicious patterns detected.