Back to skill

Security audit

Poka Yoke

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local record manager, but an unsafe config command can be abused to run shell commands and some data-changing actions lack safeguards.

Review before installing. Use only with trusted local input, avoid passing untrusted text to config, and do not rely on this version for sensitive records until the sed command-injection issue, JSON/CSV escaping, remove confirmation, and export overwrite behavior are fixed.

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/script.sh:143
Finding

Arbitrary Command Execution Through GNU sed Script Injection

Content
View full analysis
/dev/null; then sed -i "s|^${key}=.*|${key}=${val}|" "$cfg" else echo "${key}=${val}" >> "$cfg" fi echo "Set: $key=$val" ``` ### Technical Analysis The user-controlled `key` and `val` arguments are inserted directly into a `sed` program. Shell double-quoting prevents ordinary shell expansion of those values, but it does not make them safe as `sed` program text. An attacker can include the `|` delimiter, regular-expression metacharacters, literal newlines, and additional `sed` commands. On GNU `sed`, the `e` command executes a shell command. A crafted multiline value can therefore terminate the intended substitution and introduce an `e` instruction. The `grep` expressions are also built from an unescaped key: ```bash grep -q "^${key}=" "$cfg" ``` This permits regular-expression manipulation, although the command-execution sink is the subsequent dynamically generated `sed` program. ### Attack Path A representative exploitation sequence on a system using GNU `sed` is: 1. Create an entry so that the configuration update branch will be taken: ```bash scripts/script.sh config target initial ``` 2. Supply a value containing a substitution delimiter, a newline, and a GNU `sed` execution command: ```bash scripts/script.sh config target $'x|\ne touch /tmp/poka-yoke-pwned\n#' ``` 3. The interpolated `sed` program becomes equivalent to: ```sed s|^target=.*|target=x| e touch /tmp/poka-yoke-pwned #| ``` 4. GNU `sed` processes the injected `e` instruction and invokes the supplied shell command. 5. The command runs with the operating-system privileges of the user or service account that invoked the Skill. An attacker could replace the illustra ...[truncated 799 chars]
Remediation
View remediation
&2; return 1; } ``` - Reject control characters and newlines in values unless multiline values are explicitly required. - Replace the dynamic `sed` expression with a parser that treats keys and values strictly as data. For example, use a fixed `awk` program with values passed through `-v`, while ensuring newlines are prohibited or safely encoded. - Write the updated configuration to a securely created temporary file in the same directory, set restrictive permissions, and atomically rename it over the original file. - Avoid interpreting configuration keys as regular expressions. Use fixed-string comparison or parse each line at the first `=` delimiter. - Add regression tests containing `|`, backslashes, newlines, regular-expression metacharacters, and attempted `sed` commands. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/script.sh:10
Finding

Unsafe JSONL and CSV Serialization of Attacker-Controlled Entry Values

Content
View full analysis
> "$DATA_DIR/data.jsonl" } ``` The same data is exported to CSV without quoting, escaping, or spreadsheet formula neutralization: ```bash cmd_export() { local fmt="${1:-json}" local out="poka-yoke-export.$fmt" if [ ! -f "$DATA_DIR/data.jsonl" ]; then echo "No data."; return 0; fi case "$fmt" in json) cp "$DATA_DIR/data.jsonl" "$out" ;; csv) echo "timestamp,command,value" > "$out" while IFS= read -r line; do ts=$(echo "$line" | grep -o '"ts":"[^"]*' | cut -d'"' -f4) c2=$(echo "$line" | grep -o '"cmd":"[^"]*' | cut -d'"' -f4) vl=$(echo "$line" | grep -o '"val":"[^"]*' | cut -d'"' -f4) echo "$ts,$c2,$vl" >> "$out" done < "$DATA_DIR/data.jsonl" ;; ``` ### Technical Analysis `_save_entry` places attacker-controlled text directly between JSON quotation marks. Characters such as double quotes, backslashes, carriage returns, and newlines are not escaped according to JSON rules. An attacker can consequently terminate the intended string, inject additional properties, or introduce extra physical lines into `data.jsonl`. The listing and export functions attempt to parse JSON using `grep` and `cut`. These commands are not JSON-aware and can misinterpret escaped or injected content. This can cause stored entries to be displayed incorrectly, omitted, split into multiple records, or exported with attacker-controlled structure. The CSV exporter also writes fields by simple c ...[truncated 1808 chars]
Remediation
View remediation
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description suggests a domain-specific manager for 'poka yoke' tasks, especially JSON/CSV-related tasks and status checking. The code instead implements a generic local data logger/CLI database stored under ~/.poka-yoke, with commands to add arbitrary entries, list/search/remove them, manage config, and export records. While 'status' and CSV/JSON export loosely relate to the description, the primary behavior is broader general-purpose record management. No dangerous hidden behavior appears, but the actual functionality is materially more expansive and less specific than declared.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The description says "Use when json poka yoke tasks, csv poka yoke tasks, checking poka yoke status," but it does not clearly define specific trigger phrases, scope boundaries, or exclusion conditions. This ambiguity could cause unintended invocation for generic JSON/CSV task discussions rather than only this skill's intended poka-yoke workflows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The remove command is explicitly destructive, but the markdown provides no warning, confirmation expectations, or indication that data may be permanently deleted. In an agent skill context, missing warnings around destructive operations increase the risk of accidental data loss, especially if an agent invokes commands from terse natural-language requests.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest limits the skill to handling poka-yoke tasks in JSON/CSV form and checking status. The code goes beyond that by providing a remove command that mutates stored records and a config command that reads and writes arbitrary key/value settings, which are not described in the manifest's stated scope.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The remove command deletes stored entries immediately with sed -i and no confirmation, backup, or undo. In an agent or automation context, a mistaken invocation, bad parameter, or prompt-induced action can irreversibly destroy user data in the local store.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The config command allows reading and writing arbitrary keys in a separate config file, which is a broader capability than managing poka-yoke tasks or checking their status. Nothing in the manifest indicates that persistent configuration management is part of the skill's purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The export command writes data to a file, but the documentation does not warn about filesystem side effects, output location, overwrite behavior, or potential exposure of stored data. In agent-driven environments, undocumented write operations can lead to accidental disclosure, clobbering existing files, or confusion about where sensitive data is persisted.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The export command copies or transforms stored entries into an output file, which can expose user-entered data outside the managed data directory. Although it prints a success message afterward, there is no prior warning in code comments, help text, or user-facing messaging that export creates a separate plaintext file containing stored data.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.