Back to skill

Security audit

Research Logger

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches its research-note purpose, but its script has unsafe handling of topic input that can execute code and writes notes to a predictable temporary file.

Review before installing. Use this only for non-sensitive research topics unless the input-handling bug is fixed, because crafted topic text can execute local code in fallback mode. The output path should be changed to a unique private temporary file before relying on it for Bear notes.

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
research_logger.sh:44
Finding

Arbitrary Python Code Execution Through Unsanitized Topic Input

Content
View full analysis

Vulnerability Details

File Location: research_logger.sh, line 44
Vulnerability Type: Python source-code injection
Risk Level: High

Vulnerable Code

bash
DDG_URL="https://api.duckduckgo.com/?q=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$TOPIC'))")&format=json&no_html=1"

Technical Analysis

The user-controlled TOPIC value is interpolated directly into Python source passed to python3 -c. Shell quoting does not make this safe: after shell expansion, the resulting value becomes part of the Python program rather than being passed as a separate data argument.

An attacker can provide a topic containing a closing single quote followed by arbitrary Python statements. For example, a topic shaped like the following can escape the intended Python string:

text
'); __import__("os").system("id"); #

This results in attacker-controlled Python being evaluated by the local interpreter. The attacker can replace the harmless demonstration command with commands that read or alter files, invoke other programs, access environment variables, or initiate outbound network connections.

Attack Path

  1. An attacker supplies a crafted research topic to the agent or directly to the script.
  2. The documented workflow passes that topic as the first argument to research_logger.sh.
  3. If no valid search-results file is supplied, execution enters the DuckDuckGo fallback branch.
  4. Line 44 expands the topic inside the source string given to python3 -c.
  5. The crafted input terminates the intended Python string and introduces attacker-controlled Python statements.
  6. Python executes those statements with the same operating-system identity and permissions as the agent or user running the skill.

Impact Assessment

Successful exploitation provides arbitrary command execution with the privileges of the skill process. The accessible scope can include:

  • Reading files available t ...[truncated 501 chars]
Remediation
View remediation

Remediation Suggestions

Pass the topic to Python as a positional argument rather than embedding it into executable source:

bash
ENCODED_TOPIC=$(
    python3 -c \
        'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' \
        "$TOPIC"
)
DDG_URL="https://api.duckduckgo.com/?q=${ENCODED_TOPIC}&format=json&no_html=1"

Additional hardening should include:

  • Maintain a strict separation between untrusted data and interpreter source.
  • Avoid constructing code strings from shell variables.
  • Add regression tests using quotes, semicolons, newlines, backslashes, and Python syntax in the topic.
  • Run the skill with the minimum filesystem, credential, and network permissions required.
  • Consider implementing URL construction entirely in Python using arguments or standard input if more parameters are added later.

T09 · Insecure Skill Coding Practices

Warning
Location
research_logger.sh:117
Finding

Predictable Temporary File Allows Symbolic-Link File Overwrite

Content
View full analysis

Vulnerability Details

File Location: research_logger.sh, lines 117–134
Vulnerability Type: Insecure predictable temporary file
Risk Level: Medium

Vulnerable Code

bash
OUTPUT="/tmp/research_note.md"

sed \
    -e "s|{topic}|${TOPIC}|g" \
    -e "s|{date}|${DATE}|g" \
    -e "s|{tags}|${TAGS}|g" \
    -e "s|{summary}|${SUMMARY}|g" \
    -e "s|{finding1}|${FINDING1}|g" \
    -e "s|{finding2}|${FINDING2}|g" \
    -e "s|{finding3}|${FINDING3}|g" \
    -e "s|{links}|${LINKS}|g" \
    -e "s|{media_alt}|${MEDIA_ALT}|g" \
    -e "s|{media_url}|${MEDIA_URL}|g" \
    -e "s|{action1}|Follow up on key findings|g" \
    -e "s|{action2}|Share with team|g" \
    -e "s|{action3}|Archive for future reference|g" \
    "$TEMPLATE" > "$OUTPUT"

Technical Analysis

The script always writes to the globally predictable path /tmp/research_note.md. Traditional temporary directories such as /tmp are commonly writable by multiple local users and processes.

Shell output redirection follows symbolic links. Consequently, another local process can create /tmp/research_note.md as a symbolic link to a different file before the script opens it. The redirection then truncates and overwrites the linked target if that target is writable by the account running the skill.

The fixed filename also allows unrelated concurrent invocations to overwrite each other's output, creating a secondary integrity and confidentiality risk.

Attack Path

  1. A local attacker determines that the skill writes to the fixed path /tmp/research_note.md.
  2. Before the skill runs, the attacker creates that path as a symbolic link to a target file.
  3. The agent or user invokes research_logger.sh.
  4. The shell processes > "$OUTPUT" and follows the attacker-created symbolic link.
  5. The target file is truncated and replaced with the generated Markdown content, provided it is writable by the invoking account. 6 ...[truncated 948 chars]
Remediation
View remediation

Remediation Suggestions

Create a unique temporary file atomically with restrictive permissions:

bash
umask 077
OUTPUT=$(mktemp "${TMPDIR:-/tmp}/research_note.XXXXXX.md")
trap 'rm -f -- "$OUTPUT"' EXIT

Additional hardening should include:

  • Return or print the generated unique path so the caller can pass the correct file to grizzly.
  • Keep the restrictive umask to prevent other local users from reading generated notes.
  • Avoid deleting the file before the caller consumes it; alternatively, have the script invoke the consumer directly and clean up afterward.
  • If a stable output path is required, place it in a private per-user directory with secure ownership and permissions.
  • Do not attempt to fix this solely by checking for a symbolic link before redirection, because a check followed by an open operation remains vulnerable to a time-of-check/time-of-use race.
  • Add concurrency tests to ensure simultaneous executions cannot overwrite or consume each other's notes.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented behavior does not fully match the operational behavior: the skill writes note content to /tmp, relies on outbound web access, and only instructs the agent to save to Bear in a separate step rather than doing so within the declared behavior. This mismatch is dangerous because users and security controls may approve the skill based on an incomplete description, while sensitive research content is written locally and fetched remotely without explicit disclosure.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises capabilities that require shell execution and network access, but it does not declare any explicit tool scope or permissions. This creates a trust and governance gap: an agent may invoke external commands and perform web access without clear user consent or policy enforcement, increasing the chance of unintended data exposure or unsafe execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger condition, 'When the user asks to research a topic and log it,' is broad and ambiguous enough that an agent could invoke the skill in situations where the user did not specifically consent to web searches, GIF matching, local file creation, or Bear note creation. Overbroad invocation increases the risk of surprising side effects and accidental persistence of potentially sensitive content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The usage instructions omit a clear warning that generated note content is written to a temporary local file and may then be persisted into Bear. This is risky because users may provide sensitive research topics believing the action is ephemeral, when in fact the content is stored locally and then synced or retained by a note-taking system.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

This line constructs a request to an external service using user-supplied topic data, resulting in outbound transmission of potentially sensitive content. In the context of a research tool, such network access is somewhat expected, but it still creates privacy and data-handling risk when fallback occurs implicitly.

Content

Scanner excerpt · research_logger.sh (reported line 43)May include surrounding context.

sh
LINKS=$(cut -f1,2 "$SEARCH_FILE" | awk -F'\t' '{printf "- [%s](%s)\n", $1, $2}')
else
    # Fallback: use DuckDuckGo instant answer API
    DDG_URL="https://api.duckduckgo.com/?q=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$TOPIC'))")&format=json&no_html=1"
    DDG_JSON=$(curl -sf "$DDG_URL" 2>/dev/null || echo '{}')

    SUMMARY=$(echo "$DDG_JSON" | python3 -c "

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest describes an end-to-end workflow that includes logging notes to Bear. In the actual code, the final behavior is limited to rendering a note into /tmp/research_note.md and echoing its contents, with no Bear integration, Bear URL scheme invocation, or note import step.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The top-level comment frames the script as a formatter that fills a template and outputs a Bear-ready note, but the documented standalone path also causes active network search via curl and local execution of gifgrep when inputs are missing. That documentation understates the script's operational behavior rather than describing it as both a note generator and a data-gathering tool.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

In fallback mode, the script sends the user-provided topic to DuckDuckGo without explicit notice or consent. If the topic contains sensitive internal project names, personal data, or confidential research subjects, this can cause unintended disclosure to a third party.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The script writes generated content to a predictable fixed path in /tmp, which can expose potentially sensitive research notes to other local users/processes and silently overwrite prior output. On multi-user systems this also creates opportunities for symlink or file-clobbering issues depending on environment protections.

Content

No source excerpt is available for this finding.