Back to skill

Security audit

Mining

Security checks for vulnerabilities and agentic risk

Overview

This skill is advertised as blockchain mining analysis, but it actually stores and edits local records and contains unsafe shell handling that can run unintended commands.

Review before installing. Do not treat this as a mining analysis tool; it is a local record manager that writes to your home directory. Avoid passing untrusted input to its config, add, or search commands, and prefer a corrected version with accurate documentation, safe serialization, and no sed interpolation.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/script.sh:145
Finding

Arbitrary Command Execution Through Sed Expression Injection

Content
View full analysis
/dev/null; then sed -i "s|^${key}=.*|${key}=${val}|" "$cfg" else echo "${key}=${val}" >> "$cfg" fi ``` ### Technical Analysis The `config` command embeds the user-controlled `key` and `val` arguments directly into a GNU `sed` program. Neither value is escaped for use as a regular expression, replacement string, or sed command. An attacker can place the `|` delimiter in `val` to terminate the replacement and append GNU sed's `e` flag. The `e` flag executes the substituted line through a shell. Although the replacement starts with `${key}=`, shell command substitution inside the resulting assignment is still evaluated. For example, a value resembling the following produces a sed expression with the `e` execution flag: ```text $(touch /tmp/mining-pwned)|e ``` For a key named `target`, the resulting expression is equivalent to: ```bash sed -i 's|^target=.*|target=$(touch /tmp/mining-pwned)|e' config.txt ``` When a matching line exists, GNU sed executes the replacement through `/bin/sh`, and the command substitution invokes `touch`. The unescaped `key` is also interpreted as regular-expression and sed syntax, expanding the injection surface. ### Attack Path 1. The attacker or an Agent acting on attacker-controlled input creates a configuration key: ```bash scripts/script.sh config target initial ``` 2. This creates a matching `target=initial` record in `config.txt`. 3. The attacker updates that key with a malicious value containing a sed delimiter and the GNU sed `e` flag: ```bash scripts/script.sh config target '$(touch /tmp/mining-pwned)|e' ``` 4. The generated sed program matches the existing record and executes the substituted value through a shell ...[truncated 723 chars]
Remediation
View remediation
&2 return 1 } ``` - Rewrite the configuration using a parser that treats keys and values strictly as data. Pass values separately rather than embedding them into executable syntax. - Write updates to a securely created temporary file in the same directory, verify success, and atomically rename the file. - If sed must be retained, escape every regular-expression and replacement metacharacter and explicitly reject delimiters, newlines, and control characters. Avoid GNU sed's `e` functionality entirely. - Add regression tests using values containing `|`, `&`, backslashes, newlines, `$()`, backticks, and sed flags. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/script.sh:10
Finding

JSONL Record Injection Through Unescaped Entry Values

Content
View full analysis
> "$DATA_DIR/data.jsonl" } ``` ### Technical Analysis The function generates JSON by inserting `cmd` and `val` directly into a formatted string. JSON-sensitive characters are not escaped, including: - Double quotes - Backslashes - Newlines - Carriage returns and other control characters Consequently, an entry can terminate the intended JSON string, corrupt the current object, or insert additional lines that appear to be independent JSONL records. Other commands parse this data using regular expressions and line-oriented utilities rather than a JSON parser. For example, `list` and `search` extract fields with `grep` and `cut`, while `stats` and `remove` treat each injected newline as a genuine record. This allows malicious content to persist and influence subsequent command output. Stored terminal escape sequences may also be printed by `list` or `search`, potentially manipulating terminal presentation when output is viewed interactively. ### Attack Path 1. The attacker supplies an `add` argument containing a newline and a forged JSON object: ```bash scripts/script.sh add $'legitimate\n{"ts":"2099-01-01 00:00:00","cmd":"add","val":"forged"}' ``` 2. `_save_entry` writes the value without JSON escaping. 3. The newline creates another physical line in `data.jsonl`. 4. `stats` and `status` count the injected line as another entry. 5. `list`, `search`, `remove`, and `export` process the malformed or forged content as stored data. 6. If terminal control characters are included, subsequent display commands emit them to the user's terminal. ### Impact Assessment An at ...[truncated 529 chars]
Remediation
View remediation
> "$DATA_DIR/data.jsonl" ``` - Parse stored records with `jq` or another JSON parser instead of `grep` and `cut`. - Reject or safely encode control characters before displaying values in a terminal. - Validate every existing JSONL record during import, listing, search, and export. - Use proper CSV serialization for CSV exports, including quoting fields and escaping embedded quotes, commas, and newlines. - Add tests covering quotes, backslashes, Unicode, newlines, commas, and terminal escape sequences. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/script.sh:73
Finding

Grep Option and Regular-Expression Injection in Search

Content
View full analysis
}" if [ -f "$DATA_DIR/data.jsonl" ]; then local matches=$(grep -ic "$term" "$DATA_DIR/data.jsonl" 2>/dev/null || echo 0) echo "Found: $matches matches" grep -i "$term" "$DATA_DIR/data.jsonl" 2>/dev/null | head -20 | while IFS= read -r line; do local val=$(echo "$line" | grep -o '"val":"[^"]*' | cut -d'"' -f4) local ts=$(echo "$line" | grep -o '"ts":"[^"]*' | cut -d'"' -f4) ``` ### Technical Analysis Quoting `"$term"` prevents shell word splitting but does not stop `grep` from interpreting an argument beginning with `-` as an option. No `--` option terminator is used. Additionally, the search term is interpreted as a basic regular expression rather than a literal string. An attacker can therefore alter search semantics with metacharacters, provide an unintended grep option, or supply a computationally expensive expression. Because the count command uses: ```bash grep ... || echo 0 ``` certain errors can also produce malformed or misleading count output instead of a single reliable integer. ### Attack Path 1. An attacker controls or influences the argument passed to `search`. 2. The attacker supplies a term beginning with `-`, causing grep to process it as an option, or supplies regular-expression syntax that changes the intended matching behavior. 3. Both grep invocations process the attacker-controlled argument without an option terminator. 4. Search results, counts, or command behavior differ from a literal text search; sufficiently costly expressions may consume excess processing time on a large data file. ### Impact Assessment The issue can cause incorrect search results, malformed output, unexpected grep behavior ...[truncated 197 chars]
Remediation
View remediation
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 (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill’s declared purpose is blockchain mining analysis, but the documented behavior is a generic local data manager with persistent storage, deletion, export, and configuration side effects. This mismatch is dangerous because users or agents may invoke it expecting read-only analytical behavior while actually triggering filesystem modifications and data handling operations outside the stated scope.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The interface shown in the documentation does not support the stated mining-analysis use case and instead exposes CRUD-style local entry management. This is a security concern because misleading capability claims can cause inappropriate trust, accidental invocation, and unintended local data operations under a false analytical pretense.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The inline documentation claims the script analyzes mining operations, but none of the commands implement mining, protocol, or on-chain analysis. In an agent setting, deceptive inline documentation can mislead operators and orchestration layers into invoking the skill in sensitive contexts, increasing the chance of unauthorized local data handling and trust abuse.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill advertises mining-analysis capabilities, but the implementation is only a generic local note and file manager. This mismatch is dangerous because users and downstream agents may grant the tool trust, inputs, or execution privileges appropriate for a domain-analysis utility while it silently performs unrelated local persistence operations, creating a deceptive capability boundary.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The description says to use the skill when you need to "understand mining mechanisms, evaluate protocol security, or reference on-chain concepts," which is broad and does not clearly distinguish this skill from general blockchain assistance. It also lacks explicit trigger boundaries or exclusion examples, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The same file claims mining-analysis functionality while listing commands that are unrelated to that purpose, creating internal inconsistency. Such conflicts increase the chance that agents and users misunderstand the skill’s effects, especially where commands like remove, export, and config may alter local state.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation advertises remove and export operations without warning that they may delete data or write files to disk. In an agent setting, undisclosed side effects can lead to unintended data loss, unexpected file creation, or unsafe automation behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The help text markets the tool as a mining-analysis utility, yet the available commands are for adding, listing, searching, removing, exporting, and configuring local records. Misleading help output can cause users to disclose sensitive operational data under false assumptions about the tool's purpose and can obscure that the command writes to disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The export functionality creates or overwrites an output file in the current working directory, but the help text does not warn that invoking export will write data to disk. Although a completion message is printed afterward, there is no pre-action disclosure in documentation or comments for this file-writing behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This shell script writes configuration values to a persistent file in the user's home directory, but the code around the write operation provides no warning, comment, or help text explaining that settings will be stored locally. For code files, persistent file writes should have some visible disclosure unless clearly covered elsewhere.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.