Back to skill

Security audit

research-assistant

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but it can modify private Bear notes, send note-derived search terms to an external GIF tool, and contains a real command-injection bug in its --max option.

Install only if you are comfortable giving this skill access to read and modify tagged Bear notes and to derive external GIF searches from note content. Use --dry-run first, limit runs with a validated numeric --max value, and avoid using it on confidential notes until the --max validation bug and clearer external-query disclosure 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 (1)

T09 · Insecure Skill Coding Practices

Error
Location
research_assistant.sh:56
Finding
Arbitrary Command Execution Through Unvalidated --max Arithmetic Expression<![CDATA[ ## Vulnerability Details **File Location**: `research_assistant.sh`, lines 16 and 56 **Vulnerability Type**: Shell arithmetic expression injection leading to command execution **Risk Level**: High ### Vulnerable Code ```bash --max) MAX="$2"; shift 2 ;; ``` The unvalidated value is subsequently used as a Bash arithmetic operand: ```bash if [[ "$MAX" -gt 0 && "$count" -ge "$MAX" ]]; then break; fi ``` ### Technical Analysis The `--max` argument accepts arbitrary text without verifying that it is a non-negative decimal integer. Its value is later passed to the `-gt` and `-ge` arithmetic comparison operators inside `[[ ... ]]`. Bash interprets operands to arithmetic operators as arithmetic expressions rather than inert strings. Arithmetic expressions can recursively resolve variable and array references. Malicious syntax containing an array subscript and command substitution can therefore cause Bash to execute a command while evaluating the comparison. Quoting `"$MAX"` does not make an attacker-controlled arithmetic expression safe. The value must be validated before it reaches an arithmetic evaluation context. For example, an attacker-controlled argument can use a structure similar to: ```bash ./research_assistant.sh --max 'x[$(touch /tmp/research-assistant-poc)0]' --dry-run ``` When the `--max` value is evaluated by the numeric comparison, Bash may execute the embedded `touch` command. The proof-of-concept command only creates a harmless file; other commands would run with the script process's privileges. ### Attack Path 1. An attacker gains control over arguments passed to `research_assistant.sh`. This may occur through an automation layer, agent-generated invocation, wrapper script, or another interface that forwards an untrusted maximum value. 2. The attacker supplies a crafted `--max` value containing Bash arithmetic syntax and command substitution. 3. The option parser stores the value in `MAX` without validating its format. 4. Process ...[truncated 1311 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Validate `--max` immediately after reading it and before any arithmetic operation. Accept only ASCII decimal digits: ```bash --max) [[ $# -ge 2 ]] || { echo "Missing value for --max" >&2 exit 1 } MAX="$2" [[ "$MAX" =~ ^[0-9]+$ ]] || { echo "Invalid --max value: expected a non-negative integer" >&2 exit 1 } shift 2 ;; ``` For defense in depth, validate all enumerated and value-bearing options after parsing: ```bash [[ "$MAX" =~ ^[0-9]+$ ]] || { echo "Invalid --max value" >&2 exit 1 } case "$MODE" in append|prepend) ;; *) echo "Invalid --mode: expected append or prepend" >&2 exit 1 ;; esac ``` Additional hardening measures: 1. Check that each option requiring a value has another argument available before reading `$2`. 2. Do not place untrusted strings in Bash arithmetic contexts. 3. If this script is invoked by an agent, service, or wrapper, pass arguments as a structured argument array rather than constructing a shell command string. 4. Add regression tests that reject arithmetic syntax, command substitutions, signs, whitespace, and non-decimal values for `--max`. 5. Run the script with the minimum filesystem and application permissions needed to process Bear notes. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill documentation describes reading tagged Bear notes and inserting GIFs, but it also relies on an external Bear API token file and performs note modification through external CLIs without declaring explicit permissions or trust boundaries. This mismatch can cause users or orchestration systems to underestimate that the skill reads private note contents, invokes outside tooling, and makes authenticated changes to personal data.

YARA rule 'agent_skill_mcp_tool_poisoning_metadata': MCP/tool metadata poisoning indicators in tool schemas or skill manifests [agent_skills]

High
Category
YARA Match
Content
---
name: research-assistant
version: 0.1.0
description: Auto-illustrate research notes — read Bear notes tagged 「待整理」, match a topic-relevant GIF to each note's content, and insert it inline.
author: terrycarter1985
tags: [research, bear, gif, media, productivity]
metadata: {"moltbot":{"emoji":"🔬","os":["darwin"],"requires":{"bins":["grizzly","gifgrep"]}}}
capabilities: [note_taking, media_search, personal_productivity]
---

# Research Assistant

Turns rough research notes into illustrated ones. It finds every Bear note tagged
**待整理** ("to be organized"), derives a topic from each note's content, searches
for a rel
Confidence
80% confidence
Finding
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Context-Inappropriate Capability

Medium
Confidence
87% confidence
Finding
The manifest describes reading tagged Bear notes, finding relevant GIFs, and inserting them inline. While modifying notes is expected, explicitly handling a credential file in the user's home directory introduces a sensitive capability beyond the user-facing purpose and is not declared in the manifest description.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The query sent to the external GIF search tool is derived from note titles and body text, which may contain sensitive research content. Because the skill does not warn the user that note-derived text may leave the device through a third-party search service, it creates an undisclosed data leakage risk and may expose confidential topics or keywords.

Missing User Warnings

Medium
Confidence
83% confidence
Finding
The skill performs persistent modification of user notes by appending or prepending markdown content, but it provides only runtime status output and no explicit confirmation or consent gate before changing data. In an agent/skill setting, silent content mutation can lead to unwanted note corruption, clutter, or trust violations, especially if run automatically over many notes.

Static analysis

No suspicious patterns detected.