Back to skill

Security audit

Education

Security checks for vulnerabilities and agentic risk

Overview

This education skill mostly does what it says, but its bash script has a real input-validation flaw that can let crafted numeric options run local commands.

Review this skill before installing or using it with untrusted topics or option values. The publisher should add strict integer validation and bounds for --weeks, --count, --days, and --hours-per-day, and should make progress reset behavior clearer before this is treated as routine-safe.

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/script.sh:26
Finding
Arbitrary Command Execution Through Unvalidated Bash Arithmetic Expressions<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh`, lines 26–66, 81–98, 127–158, and 264–298 **Vulnerability Type**: Command injection through unsafe arithmetic evaluation **Risk Level**: High ### Vulnerable Code ```bash --weeks) weeks="$2"; shift 2 ;; ``` ```bash echo " \"total_hours\": $(( weeks * hours_per_week ))," for (( w=1; w<=weeks; w++ )); do local comma="," [[ ${w} -eq ${weeks} ]] && comma="" echo " {\"week\": ${w}, \"focus\": \"Week ${w} — ${topic} block ${w}\", \"hours\": ${hours_per_week}}${comma}" done ``` ```bash --count) count="$2"; shift 2 ;; ``` ```bash for (( i=1; i<=count; i++ )); do echo "Q${i}. [${qtype}] [${difficulty}] Question about ${topic} — concept ${i}" done ``` ```bash --hours-per-day) hours_per_day="$2"; shift 2 ;; --days) days="$2"; shift 2 ;; ``` ```bash echo "Start: ${start_date} | ${days} days | ${hours_per_day}h/day | Total: $(( days * hours_per_day ))h" ``` ```bash echo "Total study time: $(( days * hours_per_day )) hours over ${days} days." ``` ### Technical Analysis The `--weeks`, `--count`, `--days`, and `--hours-per-day` arguments are accepted as arbitrary strings and later used in Bash arithmetic expansions or arithmetic `for` loops. Bash arithmetic evaluation does not merely convert these strings to integers. Variable values used in arithmetic contexts can be interpreted recursively as arithmetic expressions. Crafted expressions can include array-subscript syntax containing command substitutions. When Bash evaluates such an expression, the command substitution can execute an arbitrary local command. Quoting the variable when it is initially assigned does not prevent this issue because the dangerous interpretation occurs later, when the variable is consumed by `$((...))` or `((...))`. The affected inputs and evaluation points include: - `--weeks`: arithmetic multiplication and loop conditions. - `--count`: loop conditions in quiz and flashcard generation. - `--d ...[truncated 2332 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Validate every numeric option immediately after argument parsing and before using it in any Bash arithmetic context. Use strict decimal-integer checks and reasonable upper bounds: ```bash validate_positive_integer() { local name="$1" local value="$2" local maximum="$3" if [[ ! "$value" =~ ^[0-9]+$ ]] || (( 10#$value < 1 || 10#$value > maximum )); then echo "Invalid ${name}: expected an integer from 1 to ${maximum}" >&2 return 1 fi } ``` Apply validation to all affected options: ```bash validate_positive_integer "weeks" "$weeks" 520 || return 1 validate_positive_integer "count" "$count" 1000 || return 1 validate_positive_integer "days" "$days" 3660 || return 1 validate_positive_integer "hours-per-day" "$hours_per_day" 24 || return 1 ``` Additional hardening measures: 1. Use the `10#` prefix only after regex validation to force decimal interpretation and avoid unintended octal handling. 2. Reject zero, negative values, signs, whitespace, arithmetic operators, variable names, brackets, and command-substitution syntax. 3. Add upper bounds to prevent excessive CPU consumption or output generation from extremely large loop counts. 4. Check that every option requiring a value has a following argument before reading `$2`. 5. Consider moving numeric calculations and iteration into Python after strict conversion with `int()` and explicit range checks. 6. Add regression tests asserting that payloads containing `$()`, backticks, brackets, operators, variable names, negative values, and oversized integers are rejected without side effects. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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)

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Missing User Warnings

Low
Confidence
78% confidence
Finding
The skill states that progress data is stored in ~/.education/progress.json and supports a --reset action, but it does not clearly warn users that it persists data locally or that reset may delete existing progress. This can lead to unintended data retention or accidental loss, especially when invoked by an agent on a user's behalf.

Missing User Warnings

Low
Confidence
90% confidence
Finding
The progress command persists user data to ~/.education/progress.json and supports destructive reset behavior, but the help text and command descriptions do not clearly warn users that local state will be created, modified, and potentially erased. This is not code execution or privilege escalation, but it can cause unintended data loss or surprise persistence, especially when invoked by an autonomous agent on a user's behalf.

Static analysis

No suspicious patterns detected.