Back to skill

Security audit

Motor

Security checks for vulnerabilities and agentic risk

Overview

This skill claims to help with motor specification, but it actually behaves like a generic local data store with file-changing commands and a command-injection risk.

Review before installing. This does not appear to exfiltrate data or install a background backdoor, but it does not perform the motor-selection task it claims, writes persistent local files, can delete or overwrite its own data/export files, and contains an unsafe config command. Only use it in a contained environment after the purpose and shell-script input handling 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

GNU sed Program Injection Through Unescaped Configuration Values

Content
View full analysis
/dev/null; then sed -i "s|^${key}=.*|${key}=${val}|" "$cfg" else echo "${key}=${val}" >> "$cfg" fi ``` ### Technical Analysis The configuration key and value are inserted directly into a `sed` program without escaping. Shell quoting prevents ordinary shell expansion of these variables, but it does not make them safe when interpreted as `sed` syntax. An attacker-controlled value can contain the `|` delimiter and newline characters, terminate the intended substitution, and append another GNU `sed` command. GNU `sed` supports the `e` command, which executes an operating-system command. A malicious value can therefore transform the generated program into a substitution followed by an attacker-selected command. For example, after a configuration entry named `x` exists, a value conceptually equivalent to the following can inject an execution command: ```text safe| e id > /tmp/motor-command-output # ``` The resulting `sed` program contains an independent `e` instruction. The configuration key is also used as an unescaped regular expression, creating additional regex and delimiter injection opportunities. ### Attack Path 1. The attacker first ensures that the targeted key exists in `$DATA_DIR/config.txt`, for example by invoking: ```bash scripts/script.sh config x initial ``` 2. Because the key now exists, a subsequent invocation reaches the vulnerable `sed -i` branch. 3. The attacker supplies a value containing a delimiter, newline, GNU `sed` `e` command, and comment syntax. 4. The value terminates the intended substitution and introduces a separate executable `sed` instruction. 5. GNU `sed` executes the injected command with the privileges of the user running the Sk ...[truncated 781 chars]
Remediation
View remediation
&2 return 1 fi ``` 2. Reject newline, carriage-return, NUL, and other control characters in values unless multiline values are an explicit requirement. 3. Replace the dynamic `sed` expression with an implementation that passes values as data rather than program text. For example, create a temporary file safely and use `awk` variables: ```bash tmp=$(mktemp "${cfg}.tmp.XXXXXX") || return 1 trap 'rm -f "$tmp"' RETURN awk -F= -v key="$key" -v value="$val" ' BEGIN { updated = 0 } $1 == key { print key "=" value updated = 1 next } { print } END { if (!updated) print key "=" value } ' "$cfg" > "$tmp" && chmod --reference="$cfg" "$tmp" 2>/dev/null || true mv -- "$tmp" "$cfg" ``` 4. Ensure temporary files are created in the same directory as the destination and are atomically renamed into place. 5. Add regression tests containing `|`, backslashes, regular-expression metacharacters, command-like strings, and embedded newlines. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/script.sh:9
Finding

Invalid JSONL and Record Injection Through Unescaped Entry Data

Content
View full analysis
> "$DATA_DIR/data.jsonl" } ``` ### Technical Analysis The function constructs JSON by interpolating values directly into a format string. Although `printf` receives the values through `%s` and therefore does not interpret them as shell commands, it also performs no JSON encoding. An entry containing a quotation mark, backslash, newline, carriage return, or another JSON control character can terminate or corrupt the intended JSON string. In particular, embedded newlines can create additional physical records in a file documented as JSONL, while quotes can alter the apparent structure of the stored object. The later listing and searching functions parse records using `grep` and `cut` rather than a JSON parser, increasing the likelihood that forged or malformed records will be displayed incorrectly. ### Attack Path 1. An attacker controls or influences the text passed to `scripts/script.sh add`. 2. The attacker supplies an entry containing JSON syntax and one or more newline characters. 3. `_save_entry` writes the text directly to `data.jsonl` without JSON escaping. 4. The injected newline creates extra physical lines, or injected quotation marks alter the apparent fields. 5. Commands such as `list`, `search`, `status`, `stats`, and `remove` operate on the corrupted line-oriented data and may count, display, search, or delete records incorrectly. This issue does not directly execute commands, but it allows persistent corruption and forgery of application records. ### Impact Assessment An attacker who can submit entries can compromise the integrity of the local data store. T ...[truncated 377 chars]
Remediation
View remediation
> "$DATA_DIR/data.jsonl" ``` Additional hardening should include: 1. Reject NUL bytes and any control characters that the application does not need. 2. Parse stored records with `jq` or another JSON-aware parser instead of `grep` and `cut`. 3. Validate every record before appending or consuming it. 4. Use atomic writes or file locking if concurrent invocations are possible. 5. Add tests covering quotes, backslashes, tabs, Unicode, and embedded newline characters. ]]>
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 (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The description claims this is a motor specification and selection tool, but the code does not implement any motor-related logic, calculations, catalogs, selection criteria, or specifications. Instead, it acts as a simple local CRUD-style data manager: it saves arbitrary entries to a JSONL file, lists recent entries, searches them, removes lines by number, exports data to JSON/CSV, reports stats, and reads/writes a config file under ~/.motor. These are materially different primary behaviors from the declared purpose, so this is a clear mismatch.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The inline comments and help text repeatedly describe motor-specific functionality, while the commands only manage arbitrary entries and config data. This deceptive documentation increases the chance that users will trust and invoke the skill under false assumptions, enabling undisclosed local data capture and file writes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill is presented as a motor specification/selection tool, but the code actually implements a generic local data store with add/search/remove/export/config behavior. This capability mismatch is dangerous because it can mislead users and reviewers into approving or running a tool that silently collects and persists arbitrary user input, which is a classic sign of deceptive or repurposed functionality.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This markdown file lists generic command names and descriptions such as 'add', 'search', 'help', and 'config' without clarifying invocation scope, trigger constraints, or negative examples. In a skill-routing context, these common everyday terms are broad enough to risk unintended activation because the document does not explain when the skill should or should not be selected.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documentation includes destructive and file-affecting operations such as remove, export, and config changes, but provides no warning, confirmation requirements, or safety guidance. In an agent-executed context, underspecified destructive actions can lead to unintended local data deletion, overwriting exported files, or persistent configuration changes without informed user consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The config command modifies or creates a persistent file at $DATA_DIR/config.txt using sed and append operations, but there is no comment, docstring, or help text warning that invoking this command will write to disk. Although the command echoes the result afterward, the user is not informed in advance through the skill description or inline documentation that persistent configuration changes will be made.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.